Skip to content

fix: prevent sidebar width flash on route navigation#276

Merged
butschster merged 1 commit intomasterfrom
fix/sidebar-width-flash-on-navigate
Mar 31, 2026
Merged

fix: prevent sidebar width flash on route navigation#276
butschster merged 1 commit intomasterfrom
fix/sidebar-width-flash-on-navigate

Conversation

@butschster
Copy link
Copy Markdown
Member

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 onUnmounted hook in LayoutSidebar unconditionally removed the sidebar-collapsed class 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

  • onUnmounted cleanup now only runs in Storybook (import.meta.env.STORYBOOK), where it prevents class leaks between stories
  • In production the sidebar is always present across pages, so the class persists correctly through navigation

Testing

  • Set sidebar to collapsed state
  • Navigate between pages (e.g. click an SMTP event to go to detail view)
  • Verify sidebar stays collapsed at 4rem width, no flash to 14rem

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.
@butschster butschster added the bug Something isn't working label Mar 31, 2026
@github-actions
Copy link
Copy Markdown

📸 Storybook Screenshots

Screenshots for 2 changed components in this PR.

Widgets/LayoutSidebar

Collapsed

Widgets/LayoutSidebar / Collapsed

Expanded

Widgets/LayoutSidebar / Expanded


Auto-generated from Storybook stories of changed .vue files

@butschster butschster merged commit c2b15d5 into master Mar 31, 2026
2 checks passed
@butschster butschster self-assigned this Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant