Repository navigation
fix(app): select the session's project when switching sides - #303
Merged
Merged
Conversation
enter() set a selection carrying a server only, then returned as soon as it resumed the side's last session — so switching Code/Work restored the session and its tabs while the sidebar sat on no project, with Projects unhighlighted and Recents empty. Select the project that owns the resumed session's directory, and record it as that server's last. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Follow-up to #300. That PR made an unselected project list nothing — correct, and what you observed — but switching Code/Work is a path that leaves the project unselected while restoring a session, so the two combined into a sidebar with an open session and an empty Recents.
Problem
useWorkspaceSwitch'senter()sets a selection carrying a server only, then returns the moment it resumes the side's last session:So the session and its tabs came back while the sidebar sat on no project: Projects unhighlighted, Pinned and Recents empty. The fallback path below it does not have this problem — it ends in
enterFolder, which selects a folder.Fix
When resuming, also select the project that session lives in — the folder of the server's project list that owns the session's directory, since a session can sit in a subdirectory of one. That folder is also recorded as the server's last project, so a later launch seeds the same one #300 would pick.
The rule is extracted as a pure
sessionProjectSelectioninworkspace/side.ts, besidefolderEntryand for the reason that file already documents: the Work side has no sandbox platform in the web e2e harness, so this decision cannot be driven from a browser.Verification
Three unit tests: the plain case, a session nested inside its project, and selecting nothing rather than guessing when the directory has not loaded or belongs to no listed project.
test:browser130 pass,test:unit690 pass, #300's two e2e specs still pass, typecheck clean.Not verified in the running app. Code↔Work needs a real sandbox platform, which neither the browser harness nor my environment can drive — the same limitation
side.tsalready calls out. Worth one switch each way before merging.DIVERGENCES: the Code/Work split row extended with this behaviour. CHANGELOG entry under Desktop / Web UI.
🤖 Generated with Claude Code