Skip to content

fix(app): scope the sidebar to one project and open on the last one - #300

Merged
quickbeard merged 2 commits into
mainfrom
fix/sidebar-project-scope
Aug 22, 2026
Merged

quickbeard merged 2 commits into
mainfrom
fix/sidebar-project-scope

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

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 projectDirectories fell back to the union of every project:

if (!project) return projects().flatMap(directories)

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

  • No project selected → no sessions. The union is gone. Deselecting a project (clicking the selected one) is a real state, and it now shows nothing, as you asked.
  • A fresh window opens on the last project. New homeSelectionSeed helper + a once-per-model effect seeds the selection from the server's projects.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:

  1. Fresh window, two projects, sessions in both → only the last project's session is listed.
  2. Deselecting the selected project → the list goes empty rather than falling back to every project.

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:browser 120 pass, test:unit 690 pass, typecheck clean.

Mock-server change: a projects config 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

quickbeard and others added 2 commits August 22, 2026 17:20
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>
@quickbeard
quickbeard merged commit 98fedd6 into main Aug 22, 2026
0 of 5 checks passed
@quickbeard
quickbeard deleted the fix/sidebar-project-scope branch August 22, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant