socket connect/disconnect depends on new isBackendDisabled state

This commit is contained in:
Masen Furer 2025-01-31 15:33:34 -08:00
parent 0edb6b9be8
commit 38d2ef721d
No known key found for this signature in database
GPG Key ID: 2AE2BD5531FF94F4

View File

@ -819,7 +819,7 @@ export const useEventLoop = (
// Handle socket connect/disconnect.
useEffect(() => {
// only use websockets if state is present
// only use websockets if state is present and backend is not disabled (reflex cloud).
if (Object.keys(initialState).length > 1 && !isBackendDisabled()) {
// Initialize the websocket connection.
if (!socket.current) {
@ -839,7 +839,7 @@ export const useEventLoop = (
socket.current.disconnect();
}
};
}, []);
}, [isBackendDisabled]);
// Main event loop.
useEffect(() => {