Repository navigation
fix(desktop): keep sidebar width + tree collapse state across icon toggle - #4769
Merged
Merged
Conversation
Collapsing the sidebar to its icon strip by clicking the active left-column icon overwrote the persisted width with the clamped 220px minimum: it read finalSideBarWidth AFTER setting rightColumn to '', when that computed already evaluates to the 45px icon strip. Re-expanding then restored 220px, losing a widened sidebar. Capture the expanded width before collapsing. Refs #2421 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The "Opened files" / "Directories" collapse state lived in local refs in tree.vue, which is rendered under a v-if and destroyed when the sidebar collapses to its icon strip — so the sections reset to expanded on re-open. Back the state with localStorage (like the sidebar width) so it survives the re-mount and app restart (also requested in the issue comments). Fixes #2421 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
1 task done
1 task done
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.
Summary
Toggling the sidebar via its left-column icons lost UI state (#2421). Two distinct bugs, one atomic commit each:
handleLeftIconClickreadfinalSideBarWidthafter settingrightColumn='', when that computed already returns the 45px icon-strip width →CHANGE_SIDE_BAR_WIDTH(45)clamps to 220. Re-expanding then restored 220, shrinking a widened sidebar. Fix: capture the expanded width before collapsing.tree.vue, which is rendered underv-ifand destroyed when the sidebar collapses, so the sections reset to expanded on re-open (Ctrl+J usesv-show, so it didn't). Fix: back the state withlocalStorage(same convention as the sidebar width), so it survives the re-mount and app restart (also requested in the issue comments).Reproduction & verification (real app)
Added
issue-2421-sidebar-state.spec.ts, a Playwright/Electron e2e against the built app. Both tests were RED on the current code and GREEN after the fixes:The existing
layout-toggles.spec.ts(4 tests, incl. the editor-fills-width-after-collapse case) still passes; lint +vue-tscclean.Fixes #2421