Re-send camera states after websocket disconnects and reconnects (#14847)

This commit is contained in:
Josh Hawkins 2024-11-07 08:25:13 -06:00 committed by GitHub
parent bc371acb3e
commit 15bd26c9b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,
});