only start the event loop when the socket is set or we're not stateful
This commit is contained in:
parent
38d2ef721d
commit
4179ec9c49
@ -839,7 +839,7 @@ export const useEventLoop = (
|
||||
socket.current.disconnect();
|
||||
}
|
||||
};
|
||||
}, [isBackendDisabled]);
|
||||
}, []);
|
||||
|
||||
// Main event loop.
|
||||
useEffect(() => {
|
||||
@ -847,13 +847,15 @@ export const useEventLoop = (
|
||||
if (!router.isReady) {
|
||||
return;
|
||||
}
|
||||
(async () => {
|
||||
// Process all outstanding events.
|
||||
while (event_queue.length > 0 && !event_processing) {
|
||||
await processEvent(socket.current);
|
||||
}
|
||||
})();
|
||||
});
|
||||
if (socket.current || !isStateful()) {
|
||||
(async () => {
|
||||
// Process all outstanding events.
|
||||
while (event_queue.length > 0 && !event_processing) {
|
||||
await processEvent(socket.current);
|
||||
}
|
||||
})();
|
||||
}
|
||||
}, [socket]);
|
||||
|
||||
// localStorage event handling
|
||||
useEffect(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user