Repository navigation
fix(diff): load PR tree-selected sections - #11287
xianjianlf2 wants to merge 2 commits into
Conversation
Greptile SummaryThis PR wires file-tree navigation into the existing lazy section-load gate for both the PR page and the GitHub item dialog surfaces, so clicking a file in the tree now triggers a diff load for sections whose content hasn't been fetched yet.
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| src/renderer/src/components/pull-request-page/files/combined-diff-viewer.tsx | Adds ensureCombinedDiffSectionLoaded callback and wires it into handleTreeNavigate; correctly guards against double-load and skips already-loaded/errored sections. |
| src/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-viewer.tsx | Same ensureCombinedDiffSectionLoaded pattern applied to the dialog surface; logic and guard conditions are consistent with the PR page variant. |
Sequence Diagram
sequenceDiagram
participant User
participant handleTreeNavigate
participant handleCombinedDiffFileTreeNavigation
participant toggleSection
participant ensureCombinedDiffSectionLoaded
participant shouldRequestCombinedDiffSectionLoad
participant loadSection
User->>handleTreeNavigate: click file tree entry
handleTreeNavigate->>handleCombinedDiffFileTreeNavigation: "{ entry, sections, sectionIndexByKey, toggleSection, loadSection }"
note over handleCombinedDiffFileTreeNavigation: resolve section index via sectionIndexByKey
alt section is collapsed
handleCombinedDiffFileTreeNavigation->>toggleSection: toggleSection(index)
toggleSection-->>loadSection: rAF → loadSection(index)
end
handleCombinedDiffFileTreeNavigation->>ensureCombinedDiffSectionLoaded: loadSection(index)
ensureCombinedDiffSectionLoaded->>shouldRequestCombinedDiffSectionLoad: (section, isLoading)
alt "diffResult === null && !error && !isLoading"
shouldRequestCombinedDiffSectionLoad-->>ensureCombinedDiffSectionLoaded: true
note over ensureCombinedDiffSectionLoaded: delete from loadedIndicesRef (defensive)
ensureCombinedDiffSectionLoaded-->>loadSection: rAF → loadSection(index)
note over loadSection: checks loadingIndicesRef → no double-load
loadSection-->>handleTreeNavigate: sections state updated with diffResult
else already loaded / loading / errored
shouldRequestCombinedDiffSectionLoad-->>ensureCombinedDiffSectionLoaded: false
note over ensureCombinedDiffSectionLoaded: early return — no-op
end
handleCombinedDiffFileTreeNavigation-->>handleTreeNavigate: navigatedIndex
handleTreeNavigate->>handleTreeNavigate: setActiveTreeSectionKey
Reviews (3): Last reviewed commit: "fix(diff): load PR tree-selected section..." | Re-trigger Greptile
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughBoth combined-diff viewers now guard section loading during file-tree navigation. The guard checks whether loading is required, clears the section's loaded index when needed, and schedules loading on the next animation frame. Both navigation callbacks use the guarded loader and include it in their dependency arrays. Merge Risk: ⚪ Minimal · up to This change only enables lazy loading of missing diff sections after file-tree navigation in two related views, with no actionable merge-blocking risk remaining after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Resolved conflicts against current upstream Validation (Node 24.18.0):
Committed with Current head: 79c54ce5 |
79c54ce to
990d1b4
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Rebuilt this branch on current
The resulting diff remains 30 lines across the current GitHub dialog and PR page viewers. |
ELI5
Clicking a file in a pull request should open its changes, even if Orca has not loaded that file yet. This fixes clicks that previously landed on an empty, collapsed section.
Addresses part of #11208
Summary
AI review summary
requestAnimationFrameuse.Screenshots
N/A - behavior-only change for lazy diff section loading.
Security audit
No new trust boundary, shell access, network endpoint, or credential handling is introduced. The change only schedules an existing combined-diff section loader after file-tree navigation identifies a missing section.
Testing
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/editor/CombinedDiffFileTree.test.ts src/renderer/src/components/editor/combined-diff-section-load-state.test.tspnpm typecheckpnpm lintNotes
X handle: not provided.
Readiness review — 2026-09-08
Reviewable; dialog validation remains. 39 focused tests and web typecheck passed. Hidden Electron PR-page fixture: collapse all, select an unloaded file, fetch once and render its diff. Content service was mocked; full GitHub/dialog execution remains unverified.
Validated head:
cf842081f49a7c131dbee3ab7ecf6b6774e828e8. Updated with main2265fce5912487f6a88ee0827dac14953b6a72c8. Combined branch passed node, CLI, web and mobile typechecks plus 90 focused regression tests. Platform/live checks above remain separate from code checks.Visual proof
After-only component fixture in hidden Electron. Collapsed all files, clicked previously unloaded file-040.ts, observed one content request and inspected the rendered diff. The real PR-page component uses a mocked content service; this does not prove the dialog or a live GitHub request.