Skip to content

fix(sidebar): stop a worktree drag preview from closing the Agent Dashboard - #10531

Merged
brennanb2025 merged 1 commit into
mainfrom
brennanb2025/p2-dashboard-drag-close
Jul 25, 2026
Merged

brennanb2025 merged 1 commit into
mainfrom
brennanb2025/p2-dashboard-drag-close

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

Problem

Dragging any worktree card closed the Agent Dashboard drawer, and cancelling the drag never restored it.

The companion-board mutual-exclusion Effect in src/renderer/src/components/sidebar/index.tsx keyed on workspaceBoardRenderedOpen. That flag is not "the workspace board is open" — per useWorkspaceBoardPanel.ts:149 it is:

workspaceBoardRenderedOpen: workspaceBoardOpen || workspaceBoardDragPreviewOpen

and WorktreeList.tsx:2791-2799 sets the drag preview as soon as any card drag becomes active:

// Why: show the board preview as soon as a card drag begins so the drop target is visible up front...
if (!drag.workspaceBoardDragPreviewRequested && !workspaceBoardOpen && !hasWorkspaceKanbanSidebarDropBoard()) {
  drag.workspaceBoardDragPreviewRequested = true
  onWorkspaceBoardDragPreviewStart()
}

That gate is not conditioned on the pointer being over the board, so even a pure reorder within a group — which never opens the board — flipped workspaceBoardRenderedOpen and evicted the dashboard.

Fix

Key the Effect on workspaceBoardOpen. A transient drag preview is not the user opening the board, so it should not dismiss the other companion board. The reciprocal Effect (agentDashboardDrawerOpen => closeWorkspaceBoard) was already correct and is untouched.

Tests

Three tests in Sidebar.test.tsx, each proven non-vacuous by its own targeted mutation:

Test Mutation that kills it Result
drag preview alone must not close the dashboard restore workspaceBoardRenderedOpen (the bug) ✗ fails
opening the board still closes the dashboard delete the board→dashboard Effect ✗ fails
opening the dashboard still closes the board delete the dashboard→board Effect ✗ fails

All three pass with the fix (7 passed). Gates: npm run typecheck and npm run lint both exit 0.

Known trade-off (not papered over)

Both sheets render at identical geometry (side="left", same left/top/bottom/width, both non-modal). With this fix, dragging a card while the dashboard is open now renders the board drag preview over the dashboard for the duration of the drag, where previously the dashboard was destroyed outright. Both terminal states are correct — drop into the board solidifies it and the mutual-exclusion Effect closes the dashboard; cancel clears the preview and the dashboard is still there. Suppressing the preview entirely while the dashboard is open would need a flag threaded into WorktreeList, which is out of scope for this one-line fix.

Verification scope

Static + unit only. The real pointer-drag interaction was not exercised in a running Electron app; the drag-preview call path was verified by reading flushWorktreePointerDrag and handleWorktreeRowPointerDown, not by driving a live drag.

…hboard

The companion-board mutual-exclusion Effect keyed on
`workspaceBoardRenderedOpen`, which is `workspaceBoardOpen ||
workspaceBoardDragPreviewOpen`. WorktreeList sets the drag preview at the
start of every card drag — including a pure reorder within a group that
never opens the board — so dragging any card closed the Agent Dashboard
drawer, and cancelling the drag never restored it.

Key the Effect on `workspaceBoardOpen` so only the user actually opening
the board evicts the dashboard. The reciprocal Effect is unchanged.
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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: 5539732d-3cc9-4a23-acc2-958bb4ee1b42

📥 Commits

Reviewing files that changed from the base of the PR and between d8e0f11 and 5b61c97.

📒 Files selected for processing (2)
  • src/renderer/src/components/sidebar/Sidebar.test.tsx
  • src/renderer/src/components/sidebar/index.tsx

📝 Walkthrough

Walkthrough

The sidebar now dismisses the agent dashboard only when the workspace board is actively open, rather than during drag-preview rendering. Tests add shared workspace-board mocks, reset them between cases, and verify dashboard retention during previews, dashboard dismissal when the board opens, and workspace-board dismissal when the dashboard opens.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description lacks critical required sections: Screenshots, Testing checklist completion status, AI Review Report with cross-platform verification, Security Audit, and Notes sections are all missing or incomplete. Add missing sections: provide Screenshots (or explicitly state 'No visual change'), complete the Testing checklist with pass/fail status for each command, add AI Review Report with explicit cross-platform compatibility checks, provide Security Audit summary, and include Notes on platform-specific behavior if applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(sidebar): stop a worktree drag preview from closing the Agent Dashboard' is clear, concise, and directly summarizes the main bug fix—preventing drag previews from incorrectly dismissing the dashboard.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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.

@brennanb2025
brennanb2025 merged commit ba434a4 into main Jul 25, 2026
2 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…hboard (stablyai#10531)

The companion-board mutual-exclusion Effect keyed on
`workspaceBoardRenderedOpen`, which is `workspaceBoardOpen ||
workspaceBoardDragPreviewOpen`. WorktreeList sets the drag preview at the
start of every card drag — including a pure reorder within a group that
never opens the board — so dragging any card closed the Agent Dashboard
drawer, and cancelling the drag never restored it.

Key the Effect on `workspaceBoardOpen` so only the user actually opening
the board evicts the dashboard. The reciprocal Effect is unchanged.
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