fix(desktop): reveal next session after closing one
What & why
When you close the session you are viewing, the app moves you to the next session in sidebar order. If that session is inside a collapsed project or a collapsed folder, its row stays hidden. The new session is open, but nothing in the sidebar shows which one it is.
This change opens the next session's project and folder before moving to it, the same way the ⌘1–9 and next/previous session shortcuts already do.
useDashboardSidebarState: newrevealWorkspaceInSidebar(workspaceId). It opens the session's project and its folder if either is collapsed. It finds the folder with the same resolver the sidebar uses, so tag folders and Sessions folders work too. It only opens things and never toggles, so running it twice is safe.useNavigateAwayFromWorkspace: calls it before moving to the next session. Every way of closing goes through this hook: the delete dialog, bulk delete, remove from sidebar, and cloud archive.
How I tested it
- Tested in the desktop app: closed the active session when the next one was inside a collapsed project and inside a collapsed folder. The project or folder opened and the new session showed as highlighted.
bun testfor the DashboardSidebar, useDashboardSidebarState and commandPalette folders inapps/desktop: 265 pass, 0 fail.biome checkon both changed files passes.tscshows no errors in the changed files or the hooks that call them.
Checklist
- PR title follows conventional commits (
type(scope): subject) -
bun run lintandbun run typecheckpass (CI fails on lint warnings too) - "Allow edits from maintainers" is checked on fork PRs
- I have signed the CLA (the bot asks on your first PR)
Summary by cubic
Fixes the sidebar so that closing a session reveals the next session's project and folder when they are collapsed. Previously the next session opened but its row stayed hidden, leaving nothing highlighted in the sidebar.
Adds revealWorkspaceInSidebar to useDashboardSidebarState, which expands the target session's project and folder sections without ever toggling closed. useNavigateAwayFromWorkspace calls it before moving, so every close path benefits: the delete dialog, bulk delete, remove from sidebar, and cloud archive.
Summary by CodeRabbit
- New Features
- Navigating to a workspace now reveals it in the dashboard sidebar, expanding its collapsed project or section when needed.