Skip to content

revert: "fix(desktop): show local diff stats in v1 workspace hover card (#3881)"#3887

Merged
saddlepaddle merged 1 commit intomainfrom
revert-v1-loc-stats
Apr 30, 2026
Merged

revert: "fix(desktop): show local diff stats in v1 workspace hover card (#3881)"#3887
saddlepaddle merged 1 commit intomainfrom
revert-v1-loc-stats

Conversation

@saddlepaddle
Copy link
Copy Markdown
Collaborator

@saddlepaddle saddlepaddle commented Apr 30, 2026

Reverts #3881 — that PR was applied to the v1 sidebar/hover card, but the actual flicker we were chasing is in the v2 dashboard sidebar. Backing it out so v2 can be addressed cleanly on its own.

Test plan

  • v1 workspace hover card LOC reverts to PR-snapshot values (pr.additions / pr.deletions).
  • Workspace list view shows PR-based diff stats again.

Summary by cubic

Reverts the v1 hover card/local diff stats change and restores PR-based additions/deletions. This keeps v1 stable while we handle the v2 sidebar flicker separately.

  • Bug Fixes
    • Hover card shows PR additions/deletions; local diff stats removed.
    • Removed diffStats prop from v1 sidebar components.
    • Workspace list view shows PR diff stats again; loads PR data via useHoverGitHubStatus.

Written for commit 5ed236f. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

  • Bug Fixes

    • Workspace rows now display PR addition and deletion statistics inline when a PR exists.
  • Refactor

    • Removed redundant diff statistics prop passing through hover cards and context menus.
    • PR statistics now sourced directly from loaded PR data instead of passed through component props.
    • Simplified "No PR for this branch" state UI presentation.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

The PR removes diffStats prop propagation from multiple WorkspaceSidebar components and refactors diff statistics display to source directly from PR data instead of component props. The hover card no longer accepts diffStats and renders addition/deletion badges solely from loaded PR information.

Changes

Cohort / File(s) Summary
Props Interface Simplification
CollapsedWorkspaceItem.tsx, WorkspaceContextMenu.tsx, WorkspaceHoverCard.tsx
Removed diffStats optional prop from component interfaces, eliminating prop forwarding through the hierarchy.
WorkspaceListItem Refactoring
WorkspaceListItem.tsx
diffStats now derived locally and used only for inline rendering in expanded items; stopped passing to child components (CollapsedWorkspaceItem, WorkspaceContextMenu).
WorkspaceRow Hover Status
WorkspaceRow.tsx
Added useHoverGitHubStatus hook to fetch and track PR data on mouse enter, enabling inline diff statistics rendering from loaded PR information.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 Props once scattered, now consolidated,
Diff stats flow from PR data, crystallized—
No more forwarding chains to blur the way,
The hover card breathes cleaner today! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change—reverting PR #3881 from the v1 workspace hover card—and is clear and specific.
Description check ✅ Passed The description provides context for the revert, explains the rationale, outlines the test plan, and includes additional notes. However, it does not follow the provided template structure with explicit sections for Type of Change, Testing, Screenshots, and Additional Notes.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch revert-v1-loc-stats

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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 30, 2026

Greptile Summary

This PR reverts #3881 (which added local diff stats to the v1 sidebar hover card) because the underlying flicker issue is in the v2 dashboard sidebar, not v1. On top of the revert it adds net-new functionality to WorkspaceRow: a useHoverGitHubStatus call and a PR-based diff-stats badge in the workspace list view, guarded against the "+0 -0" case.

Confidence Score: 5/5

Safe to merge; the only finding is dead useMemo code that has no user-visible impact.

All substantive changes are a clean revert with a small additive feature in WorkspaceRow. The single remaining finding is P2 style/cleanup (unused localDiffStats and diffStats in WorkspaceListItem), which does not block correctness or user experience.

apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx — the leftover localDiffStats/diffStats computation should be removed in a follow-up.

Important Files Changed

Filename Overview
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx The localDiffStats useMemo and diffStats derivation remain after the prop removal, leaving dead computation; everything else is a clean revert.
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/components/WorkspaceHoverCard/WorkspaceHoverCard.tsx Reverts to rendering pr.additions/pr.deletions directly; removes the diffStats prop and associated badge; the "No PR for this branch" section simplification looks correct.
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/CollapsedWorkspaceItem.tsx Cleanly removes diffStats prop and its forwarding to WorkspaceHoverCardContent.
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceContextMenu.tsx Cleanly removes diffStats prop and its forwarding to WorkspaceHoverCardContent.
apps/desktop/src/renderer/screens/main/components/WorkspacesListView/WorkspaceRow/WorkspaceRow.tsx Adds useHoverGitHubStatus and renders PR-based diff stats in the list view row; zero-guard (`pr.additions > 0

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[WorkspaceListItem] -->|hover| B[CollapsedWorkspaceItem]
    A -->|right-click| C[WorkspaceContextMenu]
    B -->|hover card| D["WorkspaceHoverCardContent\nreads pr.additions/pr.deletions\nvia usePRStatus internally"]
    C -->|hover card| D
    A -.->|diffStats computed\nbut never passed| X["❌ dead code\n(localDiffStats / diffStats)"]

    E["WorkspaceRow (new)"] -->|onMouseEnter| F[useHoverGitHubStatus]
    F -->|githubStatus.pr| G["+{pr.additions} -{pr.deletions}\nguarded: > 0 check"]
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx:176-193
**Dead code: `localDiffStats` and `diffStats` are computed but never consumed**

The `localDiffStats` memo and the `diffStats` derivation are both still present after the revert, but the `diffStats` prop was removed from both `CollapsedWorkspaceItem` and `WorkspaceContextMenu`, so nothing actually reads these values. The `useMemo` will still run on every `localChanges` change, wasting a small amount of compute on a hot render path.

Reviews (1): Last reviewed commit: "Revert "fix(desktop): show local diff st..." | Re-trigger Greptile

Comment on lines 176 to +193
workspaceId: id,
});

const localDiffStats = useMemo(() => {
if (!localChanges) return null;
const allFiles =
localChanges.againstBase.length > 0
? localChanges.againstBase
: [
...localChanges.staged,
...localChanges.unstaged,
...localChanges.untracked,
];
const additions = allFiles.reduce((sum, f) => sum + (f.additions || 0), 0);
const deletions = allFiles.reduce((sum, f) => sum + (f.deletions || 0), 0);
if (additions === 0 && deletions === 0) return null;
return { additions, deletions };
}, [localChanges]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Dead code: localDiffStats and diffStats are computed but never consumed

The localDiffStats memo and the diffStats derivation are both still present after the revert, but the diffStats prop was removed from both CollapsedWorkspaceItem and WorkspaceContextMenu, so nothing actually reads these values. The useMemo will still run on every localChanges change, wasting a small amount of compute on a hot render path.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx
Line: 176-193

Comment:
**Dead code: `localDiffStats` and `diffStats` are computed but never consumed**

The `localDiffStats` memo and the `diffStats` derivation are both still present after the revert, but the `diffStats` prop was removed from both `CollapsedWorkspaceItem` and `WorkspaceContextMenu`, so nothing actually reads these values. The `useMemo` will still run on every `localChanges` change, wasting a small amount of compute on a hot render path.

How can I resolve this? If you propose a fix, please make it concise.

@saddlepaddle saddlepaddle merged commit 6e0e006 into main Apr 30, 2026
6 of 7 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch

Thank you for your contribution! 🎉

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