Describe the Features
Prior to 0.9 reflex only processed one event at a time on the frontend. In 0.9 and later, the main event loop moved to the backend to avoid extra round trips for chained events. In the process, the event_processing flag which serialized event handling on the frontend was removed.
This introduced a race condition for the reflex-enterprise HTTPCookie.sync code which uses rx.call_script to submit fetch() requests to the backend to facilitate cookie syncing. When multiple events are queued around the same time, the requests can race with each other because they are all fired at once. Since the requests bare the cookies they had at the time they were sent, any request that was setting cookies could get those immediately reset when a racing request followed it.
We now have a fix in reflex-enterprise 0.9.2.post1, but it uses a global promise chain and isn't generalizable to other events.
This issue is a placeholder to consider a clean solution for serializing frontend events, possibly within a shared domain, to avoid race conditions like this.
Describe the Features
Prior to 0.9 reflex only processed one event at a time on the frontend. In 0.9 and later, the main event loop moved to the backend to avoid extra round trips for chained events. In the process, the
event_processingflag which serialized event handling on the frontend was removed.This introduced a race condition for the reflex-enterprise HTTPCookie.sync code which uses
rx.call_scriptto submitfetch()requests to the backend to facilitate cookie syncing. When multiple events are queued around the same time, the requests can race with each other because they are all fired at once. Since the requests bare the cookies they had at the time they were sent, any request that was setting cookies could get those immediately reset when a racing request followed it.We now have a fix in reflex-enterprise 0.9.2.post1, but it uses a global promise chain and isn't generalizable to other events.
This issue is a placeholder to consider a clean solution for serializing frontend events, possibly within a shared domain, to avoid race conditions like this.