Expecting one event getting same event triggered multiple times

I am trying to debug a situation where I send a message to the root component of a view to persist it's state to the database. When I click the save button on the view which sends that perspective message i am getting 4 records created. effectively it is triggered multiple times from one click.

Any ideas on how to troubleshoot the same event getting triggered multiple times?

It sounds as though you have the same message handler in multiple places or you the change to the root component is retriggering the sendMessage. Add a logger to the message handler script and record which handler caught the message.

Without more information there is little else we can offer.

I am building a comment system and the form for user entry was updating view state.

the idea was to have a central source of truth for state and then when the comment is ready they insert / update to database.

database inserts were doing 4 with each mouse click on the button.

I ended up scrapping the idea of message handler and just built logic to update the view.custom.form_state object and now I get one db insert.

sorry for not articulating my original question better. I am operating from alot of ignorance here.