Skip to content

Add inline pane rename from the sidebar - #573

Open
zordhalo wants to merge 1 commit into
dcouple:mainfrom
zordhalo:rename-pane
Open

Add inline pane rename from the sidebar#573
zordhalo wants to merge 1 commit into
dcouple:mainfrom
zordhalo:rename-pane

Conversation

@zordhalo

@zordhalo zordhalo commented Sep 1, 2026

Copy link
Copy Markdown

Description

Panes can now be renamed inline from the sidebar: double-click a pane's row, type a new name, press Enter. Escape cancels, 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 of handleStartEditName / handleSaveEditName / handleCancelEditName handlers in useSessionView.ts that 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:

  1. Commit is driven by pointer, not blur. PanelTabStrip commits its tab rename on onBlur, 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-phase pointerdown listener commits on a real outside click, and the first (programmatic) blur reclaims focus once.

  2. sessionStore.updateSession had a pre-existing bug. A main repo session is stored twice — in the sessions array the sidebar renders, and in activeMainRepoSession. updateSession returned early after updating the active copy, so the sessions copy went stale. This affected any session:updated for the active main-repo pane (status, favorite, git metadata), not just renames; renaming simply made it visible. Both copies now update together, matching what updateSessionGitStatus in the same file already did.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation update

Checklist

  • I have read the CONTRIBUTING.md guidelines
  • My code follows the code style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have run pnpm typecheck and pnpm lint locally
  • I have tested the Electron app locally

Critical Areas Modified

  • State management/IPC events — sessionStore.updateSession (see note 2 above)

Testing

New tests/sidebar-rename-pane.spec.ts covers four cases: Enter commits, Escape cancels, an empty name is discarded, and renaming the active main repo pane updates the sidebar label. tests/electronApiMock.ts gains a sessions.rename handler that records calls and emits session: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 passed
  • pnpm lint — clean
  • pnpm typecheck — clean
  • Manually verified in the Electron dev app against an isolated PANE_DIR

Documentation

  • CHANGELOG.md — Added + Fixed entries under Unreleased
  • README.md — new Usage step for renaming a pane
  • docs/STATE_MANAGEMENT.md — new "Main Repo Sessions Are Stored Twice" section, so the dual-storage trap is written down rather than rediscovered

https://claude.ai/code/session_019yor34qu8TA9jTkkHtvu59

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