mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-06 13:34:13 +03:00
Change camera_activity effect to run only when config updates (#20468)
This commit is contained in:
parent
6caa2050ff
commit
3c3e11ecaf
@ -33,14 +33,9 @@ function useValue(): useValueReturn {
|
||||
|
||||
// main state
|
||||
|
||||
const [hasCameraState, setHasCameraState] = useState(false);
|
||||
const [wsState, setWsState] = useState<WsState>({});
|
||||
|
||||
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,
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user