Persistent sidebar collapse using middleware and async-provider#170
Merged
brookslybrand merged 4 commits intomainfrom Jun 17, 2025
Merged
Persistent sidebar collapse using middleware and async-provider#170brookslybrand merged 4 commits intomainfrom
brookslybrand merged 4 commits intomainfrom
Conversation
e7aa035 to
661f028
Compare
brophdawg11
reviewed
Mar 6, 2025
ccf9f6a to
9a01a8e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Persistent Sidebar Collapse
This features retains each user's open/collapse preferences for the sidebar using:
Collapse states work with SSR (no flash of collapse/expand). Persisting the collapse state only works once JS has been loaded (progressively enhanced)
How does it work
middlewarereads the value from the cookie (if it exists) and loads it into contextdocs-layoutroute reads the context in theloaderand passes it down as loaderDataopenif there's no value setaction. Theactionupdates the contextmiddleware, after processing the request from theaction, sets the new context to the cookieDemo
persistent-collapse.mov
What else does this PR change
I got a little carried away and refactored the color scheme changer, just to match the structure of the code I added.