Compare commits
No commits in common. "9d10556a4eafe5f39e396b4ab3a31ad0beaf87cd" and "8b8acb3ee71797a8da775603dbdaae4f6c99f861" have entirely different histories.
9d10556a4e
...
8b8acb3ee7
@ -80,13 +80,10 @@ export const UIStateProvider = ({ children }: { children: ReactNode }) => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const setScrollPosition = useCallback((key: string, position: number) => {
|
const setScrollPosition = useCallback((key: string, position: number) => {
|
||||||
setScrollPositions((prev) => {
|
setScrollPositions((prev) => ({
|
||||||
if (prev[key] === position) return prev;
|
|
||||||
return {
|
|
||||||
...prev,
|
...prev,
|
||||||
[key]: position,
|
[key]: position,
|
||||||
};
|
}));
|
||||||
});
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const value = useMemo(
|
const value = useMemo(
|
||||||
|
|||||||
@ -15,6 +15,5 @@ export const useScrollPersistence = (key: string) => {
|
|||||||
return () => {
|
return () => {
|
||||||
setScrollPosition(key, window.scrollY);
|
setScrollPosition(key, window.scrollY);
|
||||||
};
|
};
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
}, [key, setScrollPosition, scrollPositions]); // eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [key, setScrollPosition]);
|
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user