Re-send camera states after websocket disconnects and reconnects

This commit is contained in:
Josh Hawkins 2024-11-07 08:06:17 -06:00
parent bc371acb3e
commit c2488525d3

View File

@ -69,7 +69,10 @@ function useValue(): useValueReturn {
...prevState, ...prevState,
...cameraStates, ...cameraStates,
})); }));
setHasCameraState(true);
if (Object.keys(cameraStates).length > 0) {
setHasCameraState(true);
}
// we only want this to run initially when the config is loaded // we only want this to run initially when the config is loaded
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [wsState]); }, [wsState]);
@ -93,6 +96,9 @@ function useValue(): useValueReturn {
retain: false, retain: false,
}); });
}, },
onClose: () => {
setHasCameraState(false);
},
shouldReconnect: () => true, shouldReconnect: () => true,
retryOnError: true, retryOnError: true,
}); });