Skip to content

fix(desktop): hide v2 sidebar LOC badge when workspace has no changes - #3399

Merged
saddlepaddle merged 1 commit into
mainfrom
desktop/v2-sidebar-hide-empty-diff-stats
Apr 13, 2026
Merged

saddlepaddle merged 1 commit into
mainfrom
desktop/v2-sidebar-hide-empty-diff-stats

Conversation

@saddlepaddle

@saddlepaddle saddlepaddle commented Apr 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • In the v2 dashboard sidebar, suppress the +0 −0 diff-stats badge when a workspace has no additions and no deletions.

Test plan

  • Open a clean v2 workspace — badge should not render.
  • Make edits — badge appears with correct counts.

Summary by cubic

Hide the +0 −0 diff-stats badge in the v2 dashboard sidebar when a workspace has no additions or deletions. The badge now appears only when there are actual changes to reduce visual noise.

Written for commit c4babb1. Summary will update on new commits.

Summary by CodeRabbit

  • Bug Fixes
    • Improved diff statistics display in the workspace sidebar by preventing empty statistics (with no additions or deletions) from appearing.

@coderabbitai

coderabbitai Bot commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7222717c-d008-4cdc-be1c-ce0a09f1210e

📥 Commits

Reviewing files that changed from the base of the PR and between 8f4480b and c4babb1.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/DashboardSidebarExpandedWorkspaceRow.tsx

📝 Walkthrough

Walkthrough

Updated the conditional rendering logic in DashboardSidebarExpandedWorkspaceRow to prevent displaying diff stats when both additions and deletions are zero, adding an explicit check beyond null-checking diffStats.

Changes

Cohort / File(s) Summary
Diff Stats Rendering Logic
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/DashboardSidebarExpandedWorkspaceRow.tsx
Enhanced conditional to render DashboardSidebarWorkspaceDiffStats only when diffStats exists AND either additions or deletions is greater than 0, preventing unnecessary display of empty stats.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A rabbit hops through stats with care,
Only showing changes when they're there,
Zero additions? Zero deletions too?
Hide the diff—there's nothing new to view! 📊

✨ 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 desktop/v2-sidebar-hide-empty-diff-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

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

@saddlepaddle
saddlepaddle merged commit 83c27a8 into main Apr 13, 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
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

@greptile-apps

greptile-apps Bot commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR suppresses the +0 −0 diff-stats badge in the v2 dashboard sidebar when a workspace has no additions and no deletions, by adding a (diffStats.additions > 0 || diffStats.deletions > 0) guard alongside the existing diffStats && null-check.

  • The fix is minimal, correctly scoped, and aligns with the DiffStats type (additions: number, deletions: number — never undefined), so the arithmetic comparisons are safe.
  • useDiffStats initialises its state to null (badge hidden during loading) and only sets a { additions, deletions } object once the git status is fetched, so the extra guard only fires in steady-state when the counts are actually zero — the right moment.
  • The DashboardSidebarWorkspaceDiffStats component already hides itself on hover (group-hover:opacity-0 group-hover:invisible), so this change only removes the residual visible +0 −0 text when idle.
  • No regressions are expected; when any file is modified the counts will be > 0 and the badge will appear as before.

Confidence Score: 5/5

Safe to merge — the change is a one-condition guard on a purely presentational badge with no side effects.

The fix is minimal (7 lines changed), the types are sound (additions and deletions are always number), the null-check for diffStats itself is preserved, and no other call-sites or data flows are affected.

No files require special attention.

Important Files Changed

Filename Overview
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarExpandedWorkspaceRow/DashboardSidebarExpandedWorkspaceRow.tsx Adds a zero-count guard (`additions > 0

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[useDiffStats hook] -->|null while loading| B{diffStats === null?}
    A -->|DiffStats object| B
    B -->|Yes - null| C[Badge hidden]
    B -->|No - has object| D{additions > 0 OR deletions > 0?}
    D -->|No - both zero| E[Badge hidden — PR fix]
    D -->|Yes - has changes| F[DashboardSidebarWorkspaceDiffStats rendered]
    F --> G[Shows +N −M badge]
    G --> H[Fades on hover]
Loading

Reviews (1): Last reviewed commit: "fix(desktop): hide v2 sidebar LOC badge ..." | Re-trigger Greptile

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