You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(desktop): scroll expanded diffs to the first change - #10014
Opening a long file from Changes can leave the diff at the file header when Show all lines is enabled. The first changed row can be far below the viewport.
A file click now targets the first changed row once its patch loads. A deletion-only hunk uses its deleted line. An explicit line target still takes precedence, and the folded view continues to start at the file header.
Refs #7978, which also reproduces in the current workspace Changes pane.
How I tested it
Automated CDP mouse input in an isolated macOS dev desktop with two 1,500-line files. With Show all lines enabled, clicking late-change.txt stayed on line 1 before the fix. After the fix, the same click showed the first change at line 1400.
Before
After
The dev run also verified a deletion-only file, wheel scrolling followed by a second click on the same file, and the folded view. No renderer console errors were recorded during the measured interactions. Deletion-only diff at line 1300
The new late-load and deletion regressions failed before the fix. All 69 DiffPane tests passed after the fix, including explicit line navigation.
bun run lint:fix, clean bun run lint, and bun run typecheck passed. Typecheck completed 42/42 tasks.
TERM=xterm-256color bun run test --continue=always completed 29/32 tasks, including all 9,109 desktop tests. The six host-service failures passed in a serial rerun. The shared BYHOUR timezone test and two agent-setup system-CLI fallback tests still fail locally.
Codex assisted with implementation and automated verification.
Checklist
PR title follows conventional commits (type(scope): subject)
bun run lint and bun run typecheck pass (CI fails on lint warnings too)
"Allow edits from maintainers" is checked on fork PRs
I have signed the CLA (the bot asks on your first PR)
Summary by cubic
Fixes diff scrolling so clicking a file with Show all lines enabled scrolls to the first changed row once its patch loads. Deletion-only hunks target the deleted line, explicit line targets keep precedence, and the folded view still starts at the file header. Refs #7978.
Written for commit 971e845. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
Diff views with expanded unchanged sections now scroll to the first changed line when no specific line is selected.
Explicit line focus remains the priority, and scrolling waits until the relevant diff content is available.
File-level positioning is applied before scrolling to a specific line.
Review was skipped as selected files did not have any reviewable changes.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 46f412a2-4d5d-4e7f-b083-1be63155a573
Commits
Reviewing files that changed from the base of the PR and between c8fbbdf and 971e845.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The diff scroll hook now supports deriving a line target from the first changed line when unchanged regions are expanded. It queues the file target before the line target. Tests cover explicit focus, pending diff loading, deletion-only hunks, and folded unchanged lines.
Changes: Diff scroll targeting
Layer / File(s)
Summary
Resolve and queue diff scroll targets apps/desktop/src/renderer/routes/_authenticated/_dashboard/workspace/$workspaceId/hooks/usePaneRegistry/components/DiffPane/DiffPane.tsx, apps/desktop/src/renderer/routes/_authenticated/_dashboard/workspace/$workspaceId/hooks/usePaneRegistry/components/DiffPane/hooks/useDiffCodeViewScroll/*
The hook accepts expandUnchanged, derives a line target from the first hunk when applicable, and queues the file target before the line target. DiffPane passes the theme setting. Tests cover explicit focus, pending diff loading, deletion-only hunks, and folded unchanged lines.
Clicking a file in Changes with Show all lines enabled now scrolls to its first changed row. The change is small and localized to the diff scroll hook, and no merge-blocking issue was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(desktop): scroll expanded diffs to the first change" follows conventional commit format and matches the main change. With Show all lines enabled, clicking a file now scrolls to its firs…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description follows the repository template closely. It has the 'What & why' section, which explains the bug (diff stays at file header with Show all lines enabled), the fix (first changed row tar…
Full details: Title check
Explanation
The title "fix(desktop): scroll expanded diffs to the first change" follows conventional commit format and matches the main change. With Show all lines enabled, clicking a file now scrolls to its first changed row once the patch loads, and the diff hook and DiffPane changes implement this.
Full details: Description check
Explanation
The description follows the repository template closely. It has the 'What & why' section, which explains the bug (diff stays at file header with Show all lines enabled), the fix (first changed row targeted after patch loads, deletion-only hunks use deleted line, explicit line target precedence, folded view unchanged), and links issue #7978. It has the 'How I tested it' section with concrete steps (CDP mouse input on macOS dev desktop, two 1,500-line files), before/after screenshots, regression test results, lint/typecheck results, and full test-suite results with known local failures explained. The checklist is filled in. Minor gaps: the PR title is not shown in the description, and the checklist marks lint and typecheck as passing even though the author states the full test run had known local failures. These gaps are not critical.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Opening a long file from Changes can leave the diff at the file header when Show all lines is enabled. The first changed row can be far below the viewport.
A file click now targets the first changed row once its patch loads. A deletion-only hunk uses its deleted line. An explicit line target still takes precedence, and the folded view continues to start at the file header.
Refs #7978, which also reproduces in the current workspace Changes pane.
How I tested it
Automated CDP mouse input in an isolated macOS dev desktop with two 1,500-line files. With Show all lines enabled, clicking
late-change.txtstayed on line 1 before the fix. After the fix, the same click showed the first change at line 1400.The dev run also verified a deletion-only file, wheel scrolling followed by a second click on the same file, and the folded view. No renderer console errors were recorded during the measured interactions. Deletion-only diff at line 1300
bun run lint:fix, cleanbun run lint, andbun run typecheckpassed. Typecheck completed 42/42 tasks.TERM=xterm-256color bun run test --continue=alwayscompleted 29/32 tasks, including all 9,109 desktop tests. The six host-service failures passed in a serial rerun. The shared BYHOUR timezone test and two agent-setup system-CLI fallback tests still fail locally.Codex assisted with implementation and automated verification.
Checklist
type(scope): subject)bun run lintandbun run typecheckpass (CI fails on lint warnings too)Summary by cubic
Fixes diff scrolling so clicking a file with Show all lines enabled scrolls to the first changed row once its patch loads. Deletion-only hunks target the deleted line, explicit line targets keep precedence, and the folded view still starts at the file header. Refs #7978.
Written for commit 971e845. Summary will update on new commits.
Summary by CodeRabbit