Skip to content

fix(sidebar): double-click rename opens on new-style and compact cards - #46816

Merged
AmoabaKelvin merged 3 commits into
mainfrom
fix/card-title-stable-rename
Nov 22, 2026
Merged

AmoabaKelvin merged 3 commits into
mainfrom
fix/card-title-stable-rename

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

On the new and compact workspace card styles, double-clicking a workspace's name in the sidebar did nothing: the rename box flashed and vanished, and whatever you typed went nowhere. Now the rename box opens and stays open, as it does on classic cards.

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​39 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​39
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​34 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​28

What Changed

  • Before: two things rebuilt the card's title right after a rename started, which threw the rename away.
    • The card template showed the title inside its details hover card normally, but outside it while renaming. Moving the title to a different place in the tree remounted it. In the new style almost every card has hover details, so double-click rename was broken for nearly every card there.
    • The first click of a double-click wakes a sleeping workspace. In the new style that removed the sleep-dim wrapper around the card content, which remounted the title too.
  • After:
    • The template keeps the title inside DetailsHover whenever the card has hover details. A new closed prop (renaming) keeps the hover card from opening, instead of dropping the wrapper.
    • Starting a rename closes the hover card at the card controller. That way a rename started with the keyboard shortcut while the card was showing doesn't make it reappear afterwards.
    • The sleep-dim wrapper is always mounted for new-style cards, with its attribute toggled. Sleeping cards already rendered this same block wrapper, so layout doesn't change.

Why

Element identity in React depends on where a component sits in the tree. Any wrapper added or dropped around the title when renaming starts, or when the workspace wakes, ends the edit. Keeping the title's position stable fixes it for every way a rename starts (double-click, context menu, shortcut) without special-casing focus. The dead WorktreeCardParentContent (no importers) still has the old pattern. It's left alone.

Linked Issue

Found while fixing inline rename saves (#46766). No issue filed.

Visual Proof

New-style card, double-click the title, then type renamed:

Before After
card-rename-before.png card-rename-after.png

Sidebar screenshots in the classic, new and compact styles, plus an opened hovercard, look the same as on main.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

tests/e2e/workspaces/sidebar/card-title-rename.spec.ts drives a hidden Electron build on macOS with new-style cards:

  • double-click rename of the active card: fails with the old template;
  • double-click rename of a sleeping card (it asserts the card is dimmed first): fails with the old template, and also with the old dim wrapper alone.

pnpm check:changed passed.

Performance

None worth noting. New-style cards get one wrapper div. While renaming, the details hover stays mounted instead of unmounting and remounting. There's no work per keystroke.

Risk

Low. The riskiest part is the always-mounted dim wrapper. Other code measures the card surface's first child (visible-card PR refresh), so it has to stay a real block box. It is one, the same as sleeping cards already used. Only the built-in card template uses DetailsHover. A plain revert restores the old behaviour.

Level: Low

AI Disclosure

Review

Codex plus a Claude reviewer, four rounds.

  • Round 1 found that a display: contents dim wrapper broke visible-card PR refresh measurement. It's now a block box.
  • Round 2 found that a keyboard-started rename only masked an open hover card, so it reopened afterwards. It now closes at the controller.
  • Round 3 raised hover details changing mid-rename. Round 4 showed that can't happen: for non-classic cards either the hover title or hover branch is always set, so vars.hoverDetails only changes with card style or placement. The guard added for it was dropped.
  • I declined round 4's Codex P2, which said a hover timer started during a rename opens the card once the rename ends. That only happens when the pointer is resting on the title, which is normal rest-to-hover behaviour.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Classic cards without a compact line have no hover details, so they never hit this. The hovercard's own title rename keeps its own editing state and wasn't affected.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Double-click rename never opened on new-style and compact cards with hover
details: the template swapped the details hover for a bare title when
renaming began, and a sleeping card's first click woke it and dropped the
dim wrapper. Both remounted the title and ended the rename. The details hover
now stays and is held shut while renaming, and the dim wrapper stays mounted
with its attribute toggled.
Visible-card PR refresh measures the card surface's first child, and a
display:contents wrapper has no box, so new-style cards dropped out of it.
Sleeping cards already render this block wrapper, so awake cards now match.
A rename started from the keyboard while the details hover was open only
masked it, so it reopened when the rename ended. Starting a rename now closes
the hover at the card controller; the hover only refuses to reopen meanwhile.
@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The worktree card keeps its details hover rendered during title renaming and prevents it from opening while renaming is active. The controller closes the details hover when renaming starts. New-style cards retain their content wrapper, with sleeping dimming applied only when the card is sleeping and not deleting. End-to-end tests cover title renaming on active and sleeping cards.

Merge Risk: Minimal · up to b845b

Double-click rename on new-style and compact workspace cards now keeps the title editor open, and the added E2E tests cover active and sleeping cards. No concrete merge-blocking risk remains, and the change is small and easy to revert.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a fix so double-click rename stays open on new-style and compact workspace cards. The changeset keeps the title mounted in DetailsHover, adds a closed prop, closes the…
Description check Passed The description follows the repository template. It has ELI5, What Changed (before/after and mechanism), Why (React element identity and alternatives), Linked Issue, Visual Proof (before/after images)…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: a fix so double-click rename stays open on new-style and compact workspace cards. The changeset keeps the title mounted in DetailsHover, adds a closed prop, closes the hover at the controller, and keeps the dim wrapper mounted for new-style cards, all of which support this title. The title is concise and specific, and it follows the fix(scope) convention.

Full details: Description check

Explanation

The description follows the repository template. It has ELI5, What Changed (before/after and mechanism), Why (React element identity and alternatives), Linked Issue, Visual Proof (before/after images), Testing with checkboxes and E2E test details, Performance, Risk with level, Review, Agent skill boundary, Notes, and Checklist. The AI Disclosure section is empty, which is acceptable because the template says to skip it for internal contributors. The Linked Issue section does not reference an issue number (it says 'No issue filed' and mentions #46766 as the context), which is a minor gap against the template's expectation that outside contributors link an actual issue. The author appears to be an internal contributor, so this is not a blocker.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 23f11757-3202-4dee-8826-ebf79a2a3865
Commits

Reviewing files that changed from the base of the PR and between 8cd3b7d and b845b88.

Files selected for processing: 6

  • src/renderer/src/components/sidebar/workspace-card/controller/use-worktree-card-controller.ts
  • src/renderer/src/components/sidebar/workspace-card/details/worktree-card-details-items.tsx
  • src/renderer/src/components/sidebar/workspace-card/surface/worktree-card-surface.tsx
  • src/renderer/src/components/sidebar/workspace-card/template/card-activity-parts.tsx
  • src/renderer/src/components/sidebar/workspace-card/template/default-workspace-card.json
  • tests/e2e/workspaces/sidebar/card-title-rename.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@AmoabaKelvin
AmoabaKelvin merged commit c677801 into main Nov 22, 2026
53 of 54 checks passed
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