Throttle UI update event
📝 Provide a description of the improvement
The update event is sometimes called very frequently, examples include:
- image resize it fires on each image resize redraw,
- dragging content over the editable (I believe it's due to caret showing the potential drop placement),
- simply holding right arrow key (to keep moving selection),
- column resize
It's similar to what we had in browsers couple of years ago with the scroll event, which in the end got throttled too.
If you'd like to see this improvement implemented, add a 👍 reaction to this post.
I wonder whether the source event should be throttled or the consumer should throttle their listeners?
IDK the full story behind the scroll event, but I'd expect:
- people blindly plugging into it with heavy code
- the event itself being deep in the browser engine's internal, possibly in another thread that takes care of rendering, hence generating a ton of complexity when trying to sync with another thread and a blocking JS event handlers
The former is a case for us too perhaps, but the latter (I guess?) has a lower impact on us.
With throttling the original event, I have a problem that there may be code that actually needs an unthrottled one.
Maybe we should have:
- EditorUI#update throttled
- EditorUI#updateUnsafeSynchronous not throttled
BTW, am I right that moving listeners of #update to a throttled event will ensure that if a UI-related logic throws, it does not interfere with the rest of the code (error goes into the global scope)?
Pardon my ignorance, what's the impact, and what problems are caused by the update being not throttled? Could there be some other solution to it?
There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.
We've closed your issue due to inactivity. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).