Add inline pane rename from the sidebar - #573
Open
zordhalo wants to merge 1 commit into
Open
Conversation
Double-click a pane's sidebar row to edit its name: Enter saves, Escape cancels, an empty or unchanged name is discarded, and a click outside commits. The rename reuses the existing sessions:rename IPC, whose frontend handlers were already written but never rendered. Committing on blur (the pattern PanelTabStrip uses for tabs) does not work here: double-clicking also activates the pane, and activation pulls focus to the terminal, so the input committed itself one tick after mounting. Instead a capture-phase pointerdown listener commits on a real outside click, and the first programmatic blur reclaims focus once. Also fixes a pre-existing sessionStore bug this surfaced. A main repo session is held both in the sessions array and in activeMainRepoSession, but updateSession returned early after updating the active copy, so the sidebar kept rendering stale data for that pane. Both copies now update together, matching updateSessionGitStatus. Claude-Session: https://claude.ai/code/session_019yor34qu8TA9jTkkHtvu59
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.
Description
Panes can now be renamed inline from the sidebar: double-click a pane's row, type a new name, press
Enter.Escapecancels, an empty or unchanged name is discarded rather than saved, and clicking outside the field commits the edit.The backend for this already existed —
sessions:rename(main/src/ipc/session.ts),API.sessions.rename, and a full set ofhandleStartEditName/handleSaveEditName/handleCancelEditNamehandlers inuseSessionView.tsthat were exported but never rendered by any component. This PR is the missing UI, plus one store fix it surfaced.Two implementation notes worth a reviewer's attention:
Commit is driven by pointer, not blur.
PanelTabStripcommits its tab rename ononBlur, but that pattern breaks here: double-clicking a row also activates the pane, and activation pulls focus to the terminal. The input received a blur one tick after mounting and committed itself instantly. Instead, a capture-phasepointerdownlistener commits on a real outside click, and the first (programmatic) blur reclaims focus once.sessionStore.updateSessionhad a pre-existing bug. A main repo session is stored twice — in thesessionsarray the sidebar renders, and inactiveMainRepoSession.updateSessionreturned early after updating the active copy, so thesessionscopy went stale. This affected anysession:updatedfor the active main-repo pane (status, favorite, git metadata), not just renames; renaming simply made it visible. Both copies now update together, matching whatupdateSessionGitStatusin the same file already did.Type of Change
Checklist
pnpm typecheckandpnpm lintlocallyCritical Areas Modified
sessionStore.updateSession(see note 2 above)Testing
New
tests/sidebar-rename-pane.spec.tscovers four cases: Enter commits, Escape cancels, an empty name is discarded, and renaming the active main repo pane updates the sidebar label.tests/electronApiMock.tsgains asessions.renamehandler that records calls and emitssession:updated.The main-repo test is the regression guard for note 2 — I stashed the store fix and confirmed that test fails without it and passes with it, so it is load-bearing rather than decorative. Note that the other three tests pass either way: they exercise a non-main-repo pane, which takes the other branch. The bug lived entirely in the branch no test covered.
pnpm exec playwright test tests/sidebar-rename-pane.spec.ts tests/sidebar-compact.spec.ts tests/accessibility.spec.ts tests/smoke.spec.ts— 38 passedpnpm lint— cleanpnpm typecheck— cleanPANE_DIRDocumentation
CHANGELOG.md— Added + Fixed entries under UnreleasedREADME.md— new Usage step for renaming a panedocs/STATE_MANAGEMENT.md— new "Main Repo Sessions Are Stored Twice" section, so the dual-storage trap is written down rather than rediscoveredhttps://claude.ai/code/session_019yor34qu8TA9jTkkHtvu59