mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-11 13:45:25 +03:00
check if persistent options are loaded
This commit is contained in:
parent
9f015816af
commit
da9a2fa043
@ -64,7 +64,7 @@ export default function ObjectSettings({
|
||||
},
|
||||
];
|
||||
|
||||
const [options, setOptions] = usePersistence<Options>(
|
||||
const [options, setOptions, optionsLoaded] = usePersistence<Options>(
|
||||
`${selectedCamera}-feed`,
|
||||
emptyObject,
|
||||
);
|
||||
@ -87,17 +87,20 @@ export default function ObjectSettings({
|
||||
|
||||
const memoizedObjects = useDeepMemo(objects);
|
||||
|
||||
const searchParams = useMemo(
|
||||
() =>
|
||||
new URLSearchParams(
|
||||
Object.keys(options || {}).reduce((memo, key) => {
|
||||
//@ts-expect-error we know this is correct
|
||||
memo.push([key, options[key] === true ? "1" : "0"]);
|
||||
return memo;
|
||||
}, []),
|
||||
),
|
||||
[options],
|
||||
);
|
||||
const searchParams = useMemo(() => {
|
||||
if (!optionsLoaded) {
|
||||
return new URLSearchParams();
|
||||
}
|
||||
|
||||
const params = new URLSearchParams(
|
||||
Object.keys(options || {}).reduce((memo, key) => {
|
||||
//@ts-expect-error we know this is correct
|
||||
memo.push([key, options[key] === true ? "1" : "0"]);
|
||||
return memo;
|
||||
}, []),
|
||||
);
|
||||
return params;
|
||||
}, [options, optionsLoaded]);
|
||||
|
||||
useEffect(() => {
|
||||
document.title = "Object Settings - Frigate";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user