Skip to content

Keep sidebar position when deleting active worktree - #16040

Merged
nwparker merged 10 commits into
mainfrom
nwparker/UX-delete-worktree-jump-to-top-no-good
Aug 25, 2026
Merged

nwparker merged 10 commits into
mainfrom
nwparker/UX-delete-worktree-jump-to-top-no-good

Conversation

@nwparker

@nwparker nwparker commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​451 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​445
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​131 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​130

ELI5

Deleting the worktree you are viewing still opens Orca's existing most-recently-used successor, but the sidebar stays where you were instead of jumping to that successor near the top. The surrounding rows smoothly close the deleted row's gap.

What Changed

  • suppress the sidebar reveal only for the existing post-delete successor activation
  • preserve the virtualized sidebar's scroll position and spatial context
  • animate surviving mounted rows into the removed row's space over 180 ms
  • respect reduced motion and preserve lineage-row identity through rekeys
  • add unit coverage for motion planning and Electron coverage for active selection, deletion, stable scroll position, successor activation, multi-frame motion, and reduced motion

Why

Active-worktree deletion previously activated the correct successor but also revealed it in the sidebar. When that MRU successor was far away, the sidebar jumped away from the deleted row and destroyed the user's spatial context. This keeps the existing successor policy and changes only its sidebar navigation side effect.

Linked Issue

No linked issue was provided for this task.

Visual Proof

Active worktree selected → Delete menu → stable animated collapse. The final-head recording holds on the selected row and open Delete menu, then shows the row removed without changing the sidebar scroll position. The active terminal after deletion is expected: Orca keeps the existing MRU-successor behavior.

page@78ef11762e80e1ac0b79c60cdeaff799.webm

Testing

  • I manually tested these changes locally
  • Automated tests added/updated

Final-head evidence:

  • visual-proof workflow: 3/3 recorded Electron runs passed
  • final e2e-mode desktop bundle built successfully
  • 16/16 focused unit tests passed
  • focused oxlint, oxfmt --check, and changed-lines React Doctor passed
  • pnpm run lint, pnpm run typecheck, pnpm run typecheck:web, and pnpm build passed during the final review pass
  • normal motion: 5/5 repeated Electron runs passed
  • reduced motion: 5/5 repeated Electron runs passed
  • full pnpm test: 57,539 passed; 9 failures reproduce independently in three untouched current-main test files (worktree-base-directory-poller.test.ts, filesystem-watcher-real.test.ts, and ssh-connection-host-key-store-wiring.test.ts)

Platform scope: rendered behavior was inspected on macOS Electron. Linux changed-spec E2E and Windows packaging are covered by PR CI. The implementation uses platform-neutral Chromium DOM and Web Animations APIs.

AI Disclosure

Review

Please focus on the post-delete successor reveal suppression, virtual-row motion planning, scroll-anchor interaction, and the bounded frame sampler.

Agent skill upstream boundary

  • Not applicable; this change does not touch agent skills or upstream skill-installer material.

Notes

Renderer-only scope. No dependency, persistence, IPC/RPC, remote-wire, mobile-facing, network, shell, path, Git/provider, or SSH execution-boundary changes. Runtime-owned SSH successor filtering remains unchanged.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after behavior is shown in the attached video
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • Local quality gates are documented above; current-head CI covers the remaining platform matrix

@coderabbitai

coderabbitai Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a186bce4-5441-4980-8a99-d70f4c38f2bc

📥 Commits

Reviewing files that changed from the base of the PR and between 8d5f08c and 216f29c.

📒 Files selected for processing (2)
  • tests/e2e/helpers/orca-app.ts
  • tests/e2e/worktree-active-delete-scroll-position.spec.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The change preserves sidebar context when a successor worktree becomes active after deletion. It adds virtual row removal animation that tracks row identities, layout changes, scroll offsets, and lineage rekeys. The animation skips reduced-motion and sticky-header cases. The row measurement hook invokes the animation logic. Unit tests cover motion calculations. End-to-end tests validate positioning, active-worktree reassignment, removal timing, complete removal, and reduced-motion behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is detailed and covers the required sections, but it does not provide the mandatory linked issue. Add a valid issue reference in the Linked Issue section, such as Fixes #123``. Keep the existing testing and visual-proof details.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
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.
Title check ✅ Passed The title clearly summarizes the primary change: preserving sidebar position after deleting the active worktree.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1027c99a-1096-4ef1-898b-8285ed14a578

📥 Commits

Reviewing files that changed from the base of the PR and between 202d74a and ddcd9d3.

📒 Files selected for processing (6)
  • src/renderer/src/components/sidebar/active-worktree-focus-after-delete.test.ts
  • src/renderer/src/components/sidebar/active-worktree-focus-after-delete.ts
  • src/renderer/src/components/sidebar/worktree-list/viewport/use-row-measurement.ts
  • src/renderer/src/components/sidebar/worktree-list/viewport/use-row-removal-animation.test.ts
  • src/renderer/src/components/sidebar/worktree-list/viewport/use-row-removal-animation.ts
  • tests/e2e/worktree-active-delete-scroll-position.spec.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: af3ea757-ac83-4505-9eed-4e0432547718

📥 Commits

Reviewing files that changed from the base of the PR and between 9804395 and a901dde.

📒 Files selected for processing (2)
  • src/renderer/src/components/sidebar/worktree-list/viewport/use-row-removal-animation.ts
  • tests/e2e/worktree-active-delete-scroll-position.spec.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@nwparker
nwparker merged commit c83499f into main Aug 25, 2026
50 checks passed
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 25, 2026
dallascrilley pushed a commit to dallascrilley/orca that referenced this pull request Aug 27, 2026
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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