Merge pull request #1035 from JoeMakuta/fix/derive-has-changes-and-use-functional-setstate

fix : derive has changes and use functional setstate
This commit is contained in:
Rohan Verma 2026-03-30 15:22:01 -07:00 committed by GitHub
commit d836eea554
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 46 additions and 52 deletions

View file

@ -37,8 +37,14 @@ export function useSidebarState(defaultCollapsed = false): UseSidebarStateReturn
}, []);
const toggleCollapsed = useCallback(() => {
setIsCollapsed(!isCollapsed);
}, [isCollapsed, setIsCollapsed]);
setIsCollapsedState(prev => {
const next = !prev;
try {
document.cookie = `${SIDEBAR_COOKIE_NAME}=${next}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
} catch {}
return next;
});
}, []);
// Keyboard shortcut: Cmd/Ctrl + \
useEffect(() => {