Default diffs to working changes#3974
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ed774d7. Configure here.
ApprovabilityVerdict: Approved Minor UI default change - diff panel now defaults to showing working (unstaged) changes when uncommitted changes exist, instead of always defaulting to branch changes. The logic is simple, well-tested, and users can still manually switch views. You can customize Macroscope's approvability policy. Learn more. |

Summary
Why
Opening the diff sidebar previously defaulted to Branch changes even when staged, unstaged, or untracked work existed. Using the existing VCS status result makes the initial scope reflect the changes a user is most likely trying to inspect without overriding a scope they selected themselves.
Validation
pnpm exec vp test apps/web/src/diffPanelStore.test.tspnpm exec vp checkpnpm exec vp run typecheckNote
Default the diff panel to unstaged changes when the working tree is dirty
unstagedscope when the working tree has changes, andbranchscope otherwise, instead of always defaulting to branch.selectThreadDiffPanelSelectionin diffPanelStore.ts accepts a new optionalhasWorkingTreeChangesboolean to drive this defaulting logic.initialGitScopetoDiffPanel.Macroscope summarized 9b87512.
Note
Low Risk
UI-only defaulting on existing VCS status with tests; explicit per-thread scope and persisted selections are unchanged.
Overview
The diff sidebar now opens on Working tree when VCS status reports local changes, and on Branch when the working tree is clean—only for threads without a saved scope in
diffPanelStore.ChatView derives
initialGitScopefromgitStatusQuery.data?.hasWorkingTreeChanges, prefers the thread worktree for git status (gitStatusCwd), and remounts DiffPanel when the thread or status finishes loading so the default applies once status is known.DiffPanel takes
initialGitScopeand freezes it on mount; selectThreadDiffPanelSelection uses a dirty-tree default when there is no per-thread persisted selection, without overriding an explicit branch/unstaged choice.Reviewed by Cursor Bugbot for commit 9b87512. Bugbot is set up for automated code reviews on this repo. Configure here.