fix(desktop): show local diff stats in v1 workspace hover card
Merged
SA
6mo ago+45+45+01234567890123456789-48-48-01234567890123456789
Summary
- v1 workspace hover modal was reading
pr.additions/pr.deletionsfrom the GitHub PR snapshot while the sidebar row showed local working-tree stats — the two surfaces disagreed and the modal LOC appeared to flicker as PR data refetched. - Centralize the additions/deletions math into a new
useLocalDiffStatshook (wrapsuseGitChangesStatus) and use it in both the sidebar row and the hover modal. - Drop the PR-stats fallback in the sidebar row so the value is the same before and after hover (no flicker).
getWorktreeInfonow also returnsworktreePathso the hover card can drive the local git query without prop-drilling.
Workspace list view (WorkspaceRow) is intentionally left alone — it shows closed worktrees too, so any change there needs a separate think-through.
Test plan
- Hover a workspace in the v1 sidebar — modal
+/-matches the inline+/-on the row and stays stable across refetches. - Make local edits → both surfaces update via
git:changedinvalidation. - Workspace with no PR still shows local diff stats in the modal.
- Branch (non-worktree) workspace shows correct local diff stats.
Summary by cubic
Show local working‑tree diff stats in the v1 workspace hover card to match the sidebar and eliminate LOC flicker. Compute the stats once in WorkspaceListItem and pass them into the hover card; remove PR-based LOC from the workspace list view.
-
Bug Fixes
- Hover card shows local
+/-counts, matching the sidebar. - LOC badge appears without a PR or remote and stays stable across refetches.
- Removed PR-based LOC from workspace list rows to stop flicker.
- Hover card shows local
-
Refactors
- Inlined diff math in
WorkspaceListItem(removeduseLocalDiffStats) and passeddiffStatsto the hover card, collapsed item, and context menu. - Dropped PR-stats fallback and reverted the prior
worktreePathaddition togetWorktreeInfo.
- Inlined diff math in
Summary by CodeRabbit
- Refactor
- Unified diff statistics (additions/deletions) calculation and display across workspace components, now relying on locally computed data for consistent rendering in hover cards and context menus.