Repository navigation
fix(app): scope the sidebar to one project and open on the last one - #300
Merged
Merged
Conversation
A fresh window's selection carries a server but no directory, and projectDirectories fell back to the union of every project's directories — so Recents listed sessions from every project, and rows in two different projects could look open at once (a row is marked open when its session has a tab anywhere, while tab strips are per-project). Return no directories when nothing is selected, and seed the selection once per model from the server's last project so a fresh window is not blank. A deliberate deselection still shows nothing. 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.
Issue 1 of two; the auto-opening New session tab is a separate PR.
Problem
A fresh window's stored selection carries a server but no directory, and
projectDirectoriesfell back to the union of every project:So Pinned and Recents listed every project on the server at once — sessions from folders you were not in, exactly as in the screenshot. The two rows that looked selected are the same bug: a row is marked open when its session has a tab anywhere, and tab strips are per-project, so a tab belonging to the other project lit up its row here.
Fix
homeSelectionSeedhelper + a once-per-model effect seeds the selection from the server'sprojects.last(), but only while that server still lists it — a folder closed between runs would otherwise select a directory that is gone, which shows nothing and looks like the original bug.The two go together: seeding alone changes nothing, and the empty return alone would open every window on a blank sidebar.
Verification
Two e2e specs, both confirmed to fail without the change:
Test 2 selects a project and waits for its session first, so the empty assertion afterwards means "scoped out", not "not fetched yet". My first attempt asserted the empty state immediately after boot and passed no matter what — a false positive I caught and rewrote before shipping.
Three unit tests cover
homeSelectionSeed(last project, one the server no longer lists, none at all).test:browser120 pass,test:unit690 pass, typecheck clean.Mock-server change: a
projectsconfig field (defaulting to today's single project) so a spec can serve more than one.DIVERGENCES row added; CHANGELOG entry under Desktop / Web UI.
🤖 Generated with Claude Code