Skip to content

feat(source-control): full-row hover, tooltips, and staged discard-all - #1407

Merged
brennanb2025 merged 4 commits into
mainfrom
brennanb2025/stage-all-button
May 4, 2026
Merged

brennanb2025 merged 4 commits into
mainfrom
brennanb2025/stage-all-button

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Section-header hover background now spans the entire row (label + action icons) instead of clipping around the label.
  • The + / - / undo bulk-action buttons use the Radix Tooltip component instead of native title, matching the rest of the sidebar chrome. Tooltips read "Stage all", "Unstage all", "Discard all" — and "Delete all untracked" for the untracked variant since that path actually deletes files.
  • Added Discard all to the Staged Changes section. For staged, it bulk-unstages first, then runs the existing per-file discard — without the unstage, git restore --worktree --source=HEAD would leave the staged delta in the index and the file would instantly reappear under "Changes" as the inverse modification. If the bulk unstage fails, the discard loop is skipped so we never end up in that stale-index state.

Review feedback applied

  • Guard bulkUnstage rejection in handleRevertAllInArea so a failed unstage bails before the per-file discard loop.
  • ActionButton uses aria-disabled + opacity + an onClick guard instead of the native disabled prop — Radix TooltipTrigger on a DOM-disabled button gets pointer-events blocked in Chromium and suppresses the tooltip entirely, a regression vs. the native title attribute it replaced.

Test plan

  • tsc -p config/tsconfig.tc.web.json passes.
  • Unit tests (19 new cases across 2 files):
    • discard-all-sequence.test.ts (11): staged/unstaged/untracked sequencing, bulk-unstage failure aborts the discard loop, conflict filtering (unresolved / resolved_locally skipped), and the staged-bulk-unstage-before-discard ordering invariant.
    • ActionButton.test.tsx (8): aria-disabled swap, click guard preventDefault, Radix tooltip content, visual-disabled class toggling.
  • pnpm test src/renderer/src/components/right-sidebar/ → 55/55 pass (46 existing + 9 new).
  • Electron end-to-end (dev build, CDP-attached):
    • All three section headers render the correct buttons with area-specific Radix tooltips (DOM verified via role="tooltip").
    • Populated a worktree with 1 staged + 1 unstaged + 2 untracked entries, clicked Discard all on the Staged section:
      • git status → orca.yaml fully gone from both index and working tree (no phantom inverse row in Changes — the exact bug Fix 1 was designed to prevent).
      • git diff HEAD -- orca.yaml → empty.
      • Store state updated; UI reflects the reset.
image image

Made with Orca 🐋

brennanb2025 and others added 4 commits May 4, 2026 14:14
- Section header hover background now spans the entire row instead of
  clipping around the label.
- +/-/undo buttons use the Radix Tooltip component instead of native
  'title', matching the rest of the sidebar chrome.
- Discard-all (undo) now appears on Staged Changes too; it bulk-unstages
  before running per-file discard so the index doesn't retain the staged
  delta after the working tree is reset to HEAD.

Co-authored-by: Orca <[email protected]>
…tons

Review feedback:
- handleRevertAllInArea: wrap bulk unstage in its own try/catch and bail
  before the per-file discard loop on failure. Otherwise a failed unstage
  would leave the index carrying the staged delta while the working tree
  got reset to HEAD, producing phantom inverse 'Changes' rows the user
  thought they just discarded.
- Area-specific undo tooltip: 'Delete all untracked' for the untracked
  section (since git.discard rm -rf's untracked paths), 'Discard all'
  elsewhere. The generic label hid how destructive the untracked variant
  actually is.
- ActionButton: drop the native disabled prop. Radix TooltipTrigger on a
  disabled button gets pointer-events blocked in Chromium, so the Radix
  tooltip never fires — a regression vs. the native title attribute it
  replaced. Use aria-disabled + opacity + an onClick guard; the handlers
  already early-return on isExecutingBulk.

Co-authored-by: Orca <[email protected]>
Extract the discard-all filter + sequencing into discard-all-sequence.ts
so it can be unit-tested without spinning up the full SourceControl
component tree.

- getDiscardAllPaths: conflict-filter rules (skips unresolved and
  resolved_locally entries, mirrors per-row suppression).
- runDiscardAllForArea: staged path bulk-unstages before discard; a
  failed unstage aborts the discard loop so we never leave a stale
  index + clean worktree (the specific bug the iteration-1 review
  caught).

Also export ActionButton to cover the aria-disabled click guard — the
native-disabled -> aria-disabled switch that was needed so Radix
tooltips still fire on 'busy' buttons in Chromium.

Co-authored-by: Orca <[email protected]>
- Extract throwing `discardSingle` so bulk flows can observe per-file
  failures; `handleDiscard` stays fire-and-forget for per-row UI.
- Aggregate bulk-discard failures into a single toast with the first
  error message and a sample of failed paths (was console.error only).
- Share stage/unstage/discard path filters between visibility checks
  and handlers via `getStageAllPaths`/`getUnstageAllPaths` so they
  can't drift silently.
- Drop nested `TooltipProvider` in `ActionButton`; rely on the
  app-root provider so adjacent tooltips skip the open delay.
- Hoist the three bulk-action buttons under one reveal wrapper so
  keyboard focus reveals the whole group (and add
  `[@media(hover:none)]:opacity-100` for touch/SSH per AGENTS.md).
- Narrow `area` inline at call sites to remove `as StageAllArea` +
  `as unknown as React.MouseEvent` casts.

Co-authored-by: Orca <[email protected]>
@brennanb2025
brennanb2025 merged commit 9b3b2a5 into main May 4, 2026
2 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/stage-all-button branch May 4, 2026 22:43
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