NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
fix websocket from spreading stale state (#14466)
Josh Hawkins8fcb8e54f718
diff --git a/web/src/api/ws.tsx b/web/src/api/ws.tsxindex 2e083cf833..b0c89d5ddf 100644--- a/web/src/api/ws.tsx+++ b/web/src/api/ws.tsx@@ -65,7 +65,10 @@ function useValue(): useValueReturn {: "OFF";});- setWsState({ ...wsState, ...cameraStates });+ setWsState((prevState) => ({+ ...prevState,+ ...cameraStates,+ }));setHasCameraState(true);// we only want this to run initially when the config is loaded// eslint-disable-next-line react-hooks/exhaustive-deps@@ -77,7 +80,10 @@ function useValue(): useValueReturn {const data: Update = JSON.parse(event.data);if (data) {- setWsState({ ...wsState, [data.topic]: data.payload });+ setWsState((prevState) => ({+ ...prevState,+ [data.topic]: data.payload,+ }));}},onOpen: () => {