From 3c3e11ecaf6d67c502c49f4ba3666ea0164d9772 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Mon, 13 Oct 2025 17:24:35 -0500 Subject: [PATCH] Change camera_activity effect to run only when config updates (#20468) --- web/src/api/ws.tsx | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/web/src/api/ws.tsx b/web/src/api/ws.tsx index 8ebc01727..302f3f263 100644 --- a/web/src/api/ws.tsx +++ b/web/src/api/ws.tsx @@ -33,14 +33,9 @@ function useValue(): useValueReturn { // main state - const [hasCameraState, setHasCameraState] = useState(false); const [wsState, setWsState] = useState({}); useEffect(() => { - if (hasCameraState) { - return; - } - const activityValue: string = wsState["camera_activity"] as string; if (!activityValue) { @@ -105,12 +100,9 @@ function useValue(): useValueReturn { ...cameraStates, })); - if (Object.keys(cameraStates).length > 0) { - setHasCameraState(true); - } // we only want this to run initially when the config is loaded // eslint-disable-next-line react-hooks/exhaustive-deps - }, [wsState]); + }, [wsState["camera_activity"]]); // ws handler const { sendJsonMessage, readyState } = useWebSocket(wsUrl, { @@ -131,9 +123,7 @@ function useValue(): useValueReturn { retain: false, }); }, - onClose: () => { - setHasCameraState(false); - }, + onClose: () => {}, shouldReconnect: () => true, retryOnError: true, });