mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-11 13:45:25 +03:00
Make sure state is updated
This commit is contained in:
parent
aea4e77d69
commit
b1d656255e
@ -8,7 +8,8 @@ export function useOverlayState<S>(
|
|||||||
): [S | undefined, (value: S, replace?: boolean) => void] {
|
): [S | undefined, (value: S, replace?: boolean) => void] {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const currentLocationState = location.state;
|
|
||||||
|
const currentLocationState = useMemo(() => location.state, [location]);
|
||||||
|
|
||||||
const setOverlayStateValue = useCallback(
|
const setOverlayStateValue = useCallback(
|
||||||
(value: S, replace: boolean = false) => {
|
(value: S, replace: boolean = false) => {
|
||||||
@ -18,7 +19,7 @@ export function useOverlayState<S>(
|
|||||||
},
|
},
|
||||||
// we know that these deps are correct
|
// we know that these deps are correct
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
[key, navigate],
|
[key, currentLocationState, navigate],
|
||||||
);
|
);
|
||||||
|
|
||||||
const overlayStateValue = useMemo<S | undefined>(
|
const overlayStateValue = useMemo<S | undefined>(
|
||||||
@ -39,7 +40,8 @@ export function usePersistedOverlayState<S extends string>(
|
|||||||
);
|
);
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const currentLocationState = location.state;
|
|
||||||
|
const currentLocationState = useMemo(() => location.state, [location]);
|
||||||
|
|
||||||
const setOverlayStateValue = useCallback(
|
const setOverlayStateValue = useCallback(
|
||||||
(value: S | undefined, replace: boolean = false) => {
|
(value: S | undefined, replace: boolean = false) => {
|
||||||
@ -50,7 +52,7 @@ export function usePersistedOverlayState<S extends string>(
|
|||||||
},
|
},
|
||||||
// we know that these deps are correct
|
// we know that these deps are correct
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
[key, navigate],
|
[key, currentLocationState, navigate],
|
||||||
);
|
);
|
||||||
|
|
||||||
const overlayStateValue = useMemo<S | undefined>(
|
const overlayStateValue = useMemo<S | undefined>(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user