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) => {
|
||||
setScrollPositions((prev) => {
|
||||
if (prev[key] === position) return prev;
|
||||
return {
|
||||
...prev,
|
||||
[key]: position,
|
||||
};
|
||||
});
|
||||
setScrollPositions((prev) => ({
|
||||
...prev,
|
||||
[key]: position,
|
||||
}));
|
||||
}, []);
|
||||
|
||||
const value = useMemo(
|
||||
|
||||
@ -15,6 +15,5 @@ export const useScrollPersistence = (key: string) => {
|
||||
return () => {
|
||||
setScrollPosition(key, window.scrollY);
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [key, setScrollPosition]);
|
||||
}, [key, setScrollPosition, scrollPositions]); // eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user