Configurable Batching Window for Reflex State Updates
0 reputation · 15 Sept 2020, 03:24 UTC
Developers need a way to control how Reflex groups state mutations into a single WebSocket push so that updates made both synchronously in an event handler and asynchronously via callbacks are guaranteed to be sent together, preventing split messages that can lead to inconsistent UI states.
Currently, Reflex batches updates internally per event‑loop tick, but this behavior is not exposed through any configuration API. There is no option to disable the batching, adjust a timeout, or define a maximum batch size, and updates scheduled with asyncio.create_task may fall outside the batch, resulting in separate pushes. The exact criteria for what constitutes a batch are undocumented and may differ between releases.
Is there a plan to expose a configurable batching timeout or maximum batch size via Reflex settings? Can developers opt out of automatic batching for specific event handlers or async callbacks? Does Reflex provide a manual flush mechanism to force pending batches to send immediately?