Repository navigation
Conversation
The Files panel unmounts with its right-panel tab and on thread switch or reload, and its expansion lived only in memory, so every remount collapsed the tree. Persist the expanded folders per environment and workspace in localStorage and restore them parent-before-child as each folder is listed. Refs pingdotgg#12041 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2 tasks done
Contributor
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds automatic workspace-scoped persistence and restoration of Files-tree expansion state, including potentially triggering directory loads when the panel reopens. The behavior is localized and tested but changes the existing user path and is enabled automatically, warranting human review. Notes:
You can add or adjust custom eligibility rules. Learn more. |
This branch has not been deployed
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.
Problem
The Files tree forgets which folders were open whenever its panel remounts: switching to another right-panel tab and back, switching threads, hiding the explorer, or reloading. Expansion lives only in the Pierre model and a ref, and the panel is unmounted whenever it is not the active surface. Established in #12041 and confirmed in the maintainer triage (accepted bug). This follows the triage's suggested fix: persist the expanded path set per
environmentId+cwdinlocalStorage(not inrightPanelStore) and do not keep inactive surfaces mounted.Fix
fileTreeExpansionStorage.ts: reads and writes the expanded folders undert3code.fileTreeExpanded:<environmentId>:<cwd>, bounded to 500 paths (shallowest kept, so restore still reaches them). Unreadable or malformed storage restores nothing.syncPersistedExpansionruns from the existingmodel.subscribeinFileBrowserPanel. Remembered folders are expanded as their rows appear, which happens only after the parent is listed, so restore is parent-before-child. The existing expand handler thenload()s each one. Expanding or collapsing a folder updates storage on toggle. A remembered folder is dropped only when its parent was listed successfully and no longer contains it, so a failed listing never erases saved state.useDirectoryEntriesalso returns the set of successfully listed directories, which the prune rule needs.expandAllis not stored separately; the folders it opens are stored like any others.Scope
Web and desktop only. The triage also lists mobile (
FileTreeBrowser), which needs its own async per-workspace persistence in mobile preferences and native verification I could not do here, so I left it for a separate PR rather than ship it unchecked. For that reason this isRefs, notCloses.Verification
vp test run src/components/files/fileTreeExpansionStorage.test.ts(apps/web): 6 passed. Covers round-trip and malformed storage, the 500-path bound, parent-before-child restore, not forgetting unlisted folders, pruning folders the parent no longer lists, and remembering user expansion. The neighboringfileTreeExpansionandfileTreePathReconciliationtests still pass (12 total).tsc --noEmitinapps/web: clean.vp fmt --checkclean.vp lintonsrc/components/filesreports only warnings on code this PR does not touch.Manual, web dev server on an isolated worktree
.t3seeded withmigrate-dev-db, Files surface onapps/server:src,src/orchestration-v2,src/orchestration-v2/Adapters.Before (unpatched
maincode): everything is collapsed after step 2. After: the same three folders are open after steps 2, 3 and 4, with a brief row spinner while each is re-listed after reload.localStorageheld["src","src/orchestration-v2","src/orchestration-v2/Adapters"]for the workspace key.Recordings: before, after: tab switch, thread switch, reload. Cropped to the right panel.
Not checked
Prior attempts #12083 and #15256 were closed for the orchestrator V2 rebase and a missing model/harness note, respectively. This is rebuilt on current
main, with the author's tooling stated below, and is smaller (no mobile, no per-restore queue state).Refs #12041
Written by Claude Sonnet 5.5 via Claude Code in T3 Code.
🤖 Generated with Claude Code