mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-01 08:32:18 +03:00
Camera group url fixes (#20295)
* Fix group url param where a camera group was not always loaded Need to use the loading state from the usePersistence hook because values are loaded from indexed db asynchronously * ensure group icon changes when using url param * clean up
This commit is contained in:
@@ -24,17 +24,21 @@ function Live() {
|
||||
// selection
|
||||
|
||||
const [selectedCameraName, setSelectedCameraName] = useHashState();
|
||||
const [cameraGroup, setCameraGroup] = usePersistedOverlayState(
|
||||
const [cameraGroup, setCameraGroup, loaded, ,] = usePersistedOverlayState(
|
||||
"cameraGroup",
|
||||
"default" as string,
|
||||
);
|
||||
|
||||
useSearchEffect("group", (cameraGroup) => {
|
||||
if (config && cameraGroup) {
|
||||
if (config && cameraGroup && loaded) {
|
||||
const group = config.camera_groups[cameraGroup];
|
||||
|
||||
if (group) {
|
||||
setCameraGroup(cameraGroup);
|
||||
// return false so that url cleanup doesn't occur here.
|
||||
// will be cleaned up by usePersistedOverlayState in the
|
||||
// camera group selector so that the icon switches correctly
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user