Improve on_scroll event handler #2274
Replies: 1 comment 2 replies
-
It's a similar story for the on_mouse_move event as well; too heavy to tie it to a backend event handler due to the latency. Ideally the debounce threshold (height, or time) would need to be more than the expected round trip latency between the frontend and backend, to avoid backing up the queue. I think reflex could expose something like However, this still wouldn't completely make the scroll handler usable, because (like mouse move), it does not carry the event details necessary to do anything useful with the event (other than run another script to get the scroll position). So really I see two issues here and they are separate
|
Beta Was this translation helpful? Give feedback.
-
Hi,
I was thinking that right now the on_scroll event isn't really suitable for a production app because, especially when used on the whole page or a very large element, it would be triggered so many times that a long queue of events would be created, also generating a large number of websocket messages.
In order to make the on_scroll event handler more efficient, maybe it would be helpful if we could specify a threshold (e.g. trigger the event every 20 pixels) or some other way to only trigger the event in some specific cases.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions