fix(sessionizer): focus existing workspace instead of duplicating - #27
fix(sessionizer): focus existing workspace instead of duplicating#27pperanich wants to merge 2 commits into
Conversation
Picking a project through the Esc path created a second workspace even when one with the same cwd was already open. Reuse the workspace list fetched for the first picker and focus the match; worktree workspaces are excluded so a plain project workspace can still be created next to them, matching the worktree flow's findRepoWorkspaceId.
|
Converting to draft after deeper verification: this guard cannot fire on current herdr. I stood up a headless Two consequences:
The clean fix is upstream: herdr serializing Happy to either park this until herdr exposes the field, or rework it if you'd prefer a different matching key. |
herdr is proposed to expose the workspace creation directory as workspace.path; match on that first and keep cwd as a legacy fallback. the display helper prefers path for the same reason.
Summary
In the sessionizer flow, dismissing the workspace picker (Esc) and then selecting a project that already has an open workspace created a second workspace for the same cwd. The worktree flow already guards against this via
findRepoWorkspaceId; this brings the project flow in line.Change
herdr workspace listcall)normalizePath), focus it and log, instead ofcreate+ layoutLayout is intentionally not reapplied on focus, consistent with the existing "existing workspaces are only focused" behavior documented in the README.
Testing
bun run typecheckandbun test(135 pass; 2 new cases: focus-instead-of-create, and worktree-only match still creates)