Skip to content

Keep the sidebar closed once it has been closed - #556

Merged
doomlab merged 1 commit into
devfrom
fix/545-sidebar-stays-closed
Oct 8, 2026
Merged

doomlab merged 1 commit into
devfrom
fix/545-sidebar-stays-closed

Conversation

@doomlab

@doomlab doomlab commented Oct 8, 2026

Copy link
Copy Markdown
Member

Closes #545

Cause

Every page renders its own <Layout>, so going to another page rebuilds the layout, and useExpanded started from "open" each time. The sidebar therefore reopened on every page change and every reload.

Fix

useExpanded now remembers the choice outside the component: in memory (so moving between pages doesn't flicker) and in the browser's localStorage (so it survives a reload). The saved value is read before the first paint, so a closed sidebar doesn't flash open on load. Default is still open, and if storage is blocked (private mode) it still holds for the visit.

It's per browser, like the theme was before #555. It isn't saved to the account.

Testing

useExpanded.test.tsx (5 tests): starts open, stays closed across pages, stays closed after a reload, reopening is remembered, works with storage blocked. 3 of them fail without the change. Typecheck (apart from the existing getJsonSchema.test.ts errors), lint and the full suite pass. Not yet checked in a browser: please close the sidebar, click through a few pages, and reload.

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@doomlab
doomlab merged commit 21b3cfd into dev Oct 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

see why sidebar keeps reopening

1 participant