fix: prevent sidebar width flash on route navigation#276
Merged
butschster merged 1 commit intomasterfrom Mar 31, 2026
Merged
Conversation
onUnmounted was removing the sidebar-collapsed class from <html> during page transitions, causing the sidebar to briefly expand to 14rem before the new sidebar instance re-added it. Now only cleans up in Storybook.
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.


What
Fixes the sidebar expanding to 14rem (full width) when navigating to a detail page, even though it should remain collapsed at 4rem.
Why
The
onUnmountedhook inLayoutSidebarunconditionally removed thesidebar-collapsedclass from<html>. During route transitions, the old sidebar unmounts (removes class) before the new one mounts (re-adds it), causing the expanded width CSS (xl:w-56) to apply permanently.How
onUnmountedcleanup now only runs in Storybook (import.meta.env.STORYBOOK), where it prevents class leaks between storiesTesting