From 15bd26c9b19008eaa7b6202c793cd1f2f7229720 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Thu, 7 Nov 2024 08:25:13 -0600 Subject: [PATCH] Re-send camera states after websocket disconnects and reconnects (#14847) --- web/src/api/ws.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/src/api/ws.tsx b/web/src/api/ws.tsx index b0c89d5dd..c7bb74095 100644 --- a/web/src/api/ws.tsx +++ b/web/src/api/ws.tsx @@ -69,7 +69,10 @@ function useValue(): useValueReturn { ...prevState, ...cameraStates, })); - setHasCameraState(true); + + 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]); @@ -93,6 +96,9 @@ function useValue(): useValueReturn { retain: false, }); }, + onClose: () => { + setHasCameraState(false); + }, shouldReconnect: () => true, retryOnError: true, });