reflex
reflex copied to clipboard
[REF-2250] Investigate generic debounce
Currently the rx.debounce works well with inputs and textareas. Is there a way we can generalize this to work for all components such as rx.slider or the color picker example in the docs?
Current docs: https://reflex.dev/docs/library/forms/debounce/#debounce
Modifying queueEvents like this within utils/state.js seems to work. We should probably make this a flag though, we mayn't want to do this for all events.
export const queueEvents = async (events, socket) => {
// Filter out any events already in the queue.
events = events.filter((event) => {
for (const queued_event of event_queue) {
if (queued_event.name === event.name) {
return false;
}
}
return true;
});
event_queue.push(...events);
await processEvent(socket.current);
};
fixed in https://github.com/reflex-dev/reflex/pull/3091