Skip to content

Commit 80655b9

Browse files
committed
fully drain the queue on socket connect event
1 parent 82d80cd commit 80655b9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

reflex/.templates/web/utils/state.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,9 @@ export const connect = async (
582582
window.addEventListener("beforeunload", disconnectTrigger);
583583
window.addEventListener("unload", disconnectTrigger);
584584
// Drain any initial events from the queue.
585-
await processEvent(socket.current, navigate, () => params.current);
585+
while (event_queue.length > 0 && !event_processing) {
586+
await processEvent(socket.current, navigate, () => params.current);
587+
}
586588
});
587589

588590
socket.current.on("connect_error", (error) => {

0 commit comments

Comments
 (0)