How can I prevent Plotly functions from emitting similar events?

Is there a way to prevent the homonymous event from being launched when using the relayout, restyle, update functions? Currently, I capture the plotly_relayout event to make some adjustments when the window is zoomed, dragged or resized, but when I use the relayout function it is also launched. the relayout event executing the code that I also have in the event, what I do to avoid this is use the Plotly.update function since I do not have code in the plotly_update event, however I recently found a small error with the Plotly.update function which does not happen when using Plotly.relayout. Furthermore, I think it is more efficient to use the relayout function when the only thing you want is to change layout properties, as well as restyle when you only change plot properties. I consider that emitting the event after calling the function It causes performance problems and if you are not careful you can crash the program as easily as doing the following

layer.on("plotly_relayout", e => { Plotly.relayout(layer, {...}) })
layer.on("plotly_update", e => { Plotly.update(layer, {...}, {...}) })

I could also try to add conditionals inside the event to avoid the execution of the code but I think that is not the case since as the app grows I will have the need to add more and more conditions in the event to prevent it from being executed just for using its function homonymous and maybe I even forgot to add some conditions, I think it would be a good idea in the future to add a property to the configuration to cancel the events something like the following

emitevent: false

And so we could decide whether or not we want the event to be launched when using the Plotly functions

As I mentioned, the solution I use at the moment is to use Plotly.update because it did not capture the plotly_update event, but I don’t know, maybe in the future I will have to do it and as I mentioned I found an error using the update function when making some changes to the shapes which forces me to have to change the updates for relayouts, so well I have a job,

In order to use the relayout function and prevent the plotly_relayout event code from being executed, this is my solution

Plotly.relayout(layer, { "stop": true , ... })

layer.on("plotly_relayout", e => {
     if(e.stop) return
     ...
     ...
     ...
})