Repository navigation
fix(source-control): highlight the open file's Committed on Branch row - #35915
simon-caignart wants to merge 1 commit into
Conversation
Opening a file from Committed on Branch left its row unmarked, while uncommitted rows already show the open file with bg-accent and data-current. Resolve the open branch diff's path from the active editor tab and give branch rows the same current-row styling, in list and tree views. Combined and commit diffs still highlight nothing. Fixes stablyai#35905
[Low impact] The PR appears safe to merge. SummaryAdds an open-file highlight to Committed on Branch rows in list and tree views.
No actionable issues found. Tests and visual checks were not run during this review. Acknowledged by Reviews (1) · Last reviewed commit: "fix(source-control): highlight the open ..." · Reviewed by Greptile |
|
No actionable comments were generated in the recent review.
|
ELI5
When you click a file in Source Control's Committed on Branch list, its diff opens but nothing in the list shows which file you're looking at.
Uncommitted files already get a highlighted row for this.
This PR gives committed files the same highlight, so reviewing an agent's work file by file no longer means re-reading the list to find your place.
What Changed
Before: opening a branch diff left every Committed on Branch row unstyled.
After: the row of the branch diff in the active editor tab gets
bg-accentanddata-current="true", the same current-row recipe as uncommitted rows (docs/STYLEGUIDE.md), in both list and tree views.Mechanism:
active-open-file-keys.ts: the signature parsing is extracted intoparseActiveOpenFileSignature, and a newresolveActiveOpenBranchPathreturns the path only for a single-filebranchdiff.use-row-opening.tsderivesactiveOpenBranchPathfrom the existing active-tab signature selector, so no new store subscription. It flows throughuse-file-listingandpanel-contenttoSourceControlBranchSection.BranchEntryRowtakesisOpenFileand gains the samedata-testid/data-source-control-path/data-currentattributes asUncommittedEntryRow.entry.path, tree-mode rows comparenode.entry.path.Unchanged on purpose:
buildActiveOpenRowKeysstill returns nothing for branch tabs, so a branch diff never lights a pending row with the same path.combined-branch("View all"),commitand other combined diffs highlight no branch row.Why
The branch section is where you review committed agent work, and it was the only file list in Source Control without an open-file marker.
Adding a
branch::key toactiveOpenRowKeyswas the other option, but that set is filtered against the visible pending rows and is tested to stay empty for branch tabs.A separate
string | nullkeeps that contract intact and costs one string comparison per rendered row.Linked Issue
Fixes #35905
Visual Proof
Same branch with 3 committed files and
index.tsopen as a branch diff. Before on the left, after on the right.Dark:
Light:
In light theme the current row is
#f5f5f5on the#fafafasidebar, so it's faint. That's the existing recipe shared with uncommitted rows, not something this PR introduces; happy to open a separate issue for it.Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Two cases added to
SourceControl.open-file-highlight.test.tsx, next to the existing branch case: the active branch diff highlights only its Committed on Branch row (not the other branch row, not the unstaged row with the same path), and acombined-branchtab highlights none. The first fails without the fix.pnpm check:changedpasses (format, lint, typecheck, affected tests, ratchets).Verified in the real app on Linux with a Playwright Electron run against a worktree with a committed change: clicking the row opens the branch diff and the row gets
data-current="true". The screenshots above come from that run. I didn't keep that spec since the render test covers the behavior faster.AI Disclosure
Written with Claude Code (Claude Opus 5.5). Reviewed by two separate Claude Fable 5.1 agents (code conventions, integration across surfaces) before opening; their findings are applied.
Review
AI review summary:
entry.pathstring.mobile/src/source-controlshows branch diffs in a drawer over the list, with no persistent open-file row to mirror, so no change there.===.Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)