Skip to content

Add inline pane rename from the sidebar - #597

Closed
zordhalo wants to merge 1 commit into
dcouple:mainfrom
zordhalo:feat/sidebar-pane-rename
Closed

zordhalo wants to merge 1 commit into
dcouple:mainfrom
zordhalo:feat/sidebar-pane-rename

Conversation

@zordhalo

@zordhalo zordhalo commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

What

Double-click a pane's row in the sidebar to rename it inline.

  • Enter saves, Escape cancels
  • An empty or unchanged name is discarded rather than saved
  • Clicking outside the field commits

The rename reuses the existing sessions:rename IPC. The frontend handlers for
it were already written but never rendered, so this wires up the missing
interaction rather than adding a new path:

API.sessions.rename (frontend/src/utils/api.ts) ->
window.electronAPI.sessions.rename (main/src/preload.ts) ->
sessions:rename (main/src/ipc/session.ts)

Why commit-on-blur does not work here

PanelTabStrip commits tab renames on blur, and that pattern was the obvious
one to copy, but it fails for this row: double-clicking also activates the
pane, and activation pulls focus to the terminal. The input committed itself one
tick after mounting, before the user could type.

Instead the commit is driven by the user's pointer rather than by whichever
element grabs focus next:

  • a capture-phase pointerdown listener commits on a real outside click
  • the first programmatic blur reclaims focus once, then subsequent blurs commit

The draft also seeds from the stored pane name rather than the row label, so a
pane displaying a PR title is still edited against its own name.

Drive-by fix: main repo sessions are stored twice

Building this surfaced a pre-existing sessionStore bug.

A repository's main repo session lives in two places: the sessions array that
the sidebar renders, and activeMainRepoSession that the project view reads.
updateSession returned early after updating the active copy, so the sidebar
kept rendering stale data for that pane.

This is not specific to rename — any update to that pane (name, status, favorite,
git metadata) was affected. Both copies now move together, matching what
updateSessionGitStatus already did.

docs/STATE_MANAGEMENT.md gains a section on the dual-storage trap so the next
writer does not reintroduce it.

Tests

tests/sidebar-rename-pane.spec.ts, 4 cases, running against the existing
electronApiMock:

  • double-click renames the pane and Enter commits the new name
  • Escape cancels without calling the backend
  • an empty name is discarded instead of clearing the pane title
  • renaming the active main repo pane updates the sidebar label (covers the
    store fix above)

All 4 pass. Frontend unit suite: 334/334. Typecheck and oxlint clean.

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
@zordhalo

zordhalo commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Duplicate of #573, which covers the same change. I've rebased #573 onto current main instead, so the work continues there.

@zordhalo zordhalo closed this Sep 9, 2026
@zordhalo
zordhalo deleted the feat/sidebar-pane-rename branch September 9, 2026 17:50
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