fix(mobile): show PR file diff when tapping row on single-repo tasks#907
fix(mobile): show PR file diff when tapping row on single-repo tasks#907luancm wants to merge 3 commits into
Conversation
PR file rows stamp `repository_name=""` (single-repo sentinel) on the timeline, but `useReviewSources` tags PR files in `allFiles` with `pr.repo` (e.g. "kandev"). The previous code passed the empty stamp straight into `DiffSheetMode`, so `filterVisibleFiles` matched `(file.repository_name ?? "") === ""` and dropped every PR file — "No changes". Convert empty string to `undefined` so the repo filter is skipped, matching desktop behavior.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds a non-deduplicated ChangesPR file source and diff plumbing
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
|
| Filename | Overview |
|---|---|
| apps/web/components/task/mobile/mobile-changes-panel.tsx | Core fix: converts empty-string repositoryName to undefined so the repo filter is skipped for single-repo PR file rows |
| apps/web/components/task/task-changes-panel.tsx | Adds rawPRFiles bypass in filterVisibleFiles and threads rawPRFiles through useChangesView and useVisibleDiffState; refactors filterVisibleFiles to accept an opts object |
| apps/web/hooks/domains/session/use-review-sources.ts | Exposes rawPRFiles (non-deduplicated PR entries built via addPRFiles with empty uncommittedPaths) on UseReviewSourcesResult |
| apps/web/components/task/dockview-desktop-layout.tsx | Forwards options.source through addFileDiffPanel and reads it back as sourceFilter in DiffViewerContent, aligning desktop with mobile behavior |
| apps/web/components/task/task-changes-panel.test.ts | Updates call sites for refactored filterVisibleFiles signature and adds a new test covering the deduplication-bypass scenario |
| apps/web/e2e/tests/task/mobile-changes-panel.spec.ts | Adds e2e test seeding a mock PR with patch content, tapping the file row, and asserting diff text is visible |
| apps/web/lib/state/dockview-panel-actions.ts | Widens addFileDiffPanel opts type to include source and stores it in panel params |
| apps/web/lib/state/dockview-store.ts | Type signature update only to match dockview-panel-actions.ts change |
Reviews (3): Last reviewed commit: "fix: PR file row click shows PR diff ins..." | Re-trigger Greptile
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/web/components/task/mobile/mobile-changes-panel.tsx">
<violation number="1" location="apps/web/components/task/mobile/mobile-changes-panel.tsx:70">
P2: Hardcoding `sourceFilter: "all"` discards the `source: "pr"` passed by `PRFileRow`, so PR file taps will show changes from all sources instead of just the PR diff. The `repositoryName` fix alone addresses the "No changes" bug described in the PR — consider preserving the source filter: `sourceFilter: options?.source ?? "all"`.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
|
@cubic-dev-ai The Desktop never passes a source filter at all ( |
@luancm Makes sense — thanks for the explanation. The Desktop already skips the source filter entirely (no prop forwarded), so |
|
I've just realized that the PR changes is not working correctly (not even for desktop) In my example, I have a task with a PR opened that changes a file, and unstaged changes to that same file. I'll see if it is worth to fix in this PR. |
|
I'll open another PR with a more appropriate fix that also fixes the Desktop version |
Tapping a PR Changes file on mobile single-repo tasks rendered "No changes" because
PRFileRowstampedrepository_name=""(single-repo sentinel) intoOpenDiffOptions, whileuseReviewSourcestags PR entries inallFileswithpr.repo(e.g."kandev") —filterVisibleFilesthen dropped every row. Convert the empty stamp toundefinedinmobile-changes-panel.tsxso the repo filter is skipped, matching the desktop path which never forwardsrepositoryName.Validation
pnpm vitest run components/task/task-changes-panel.test.ts— 18/18 passpnpm linton changed files — cleanapps/web/e2e/tests/task/mobile-changes-panel.spec.ts:159seeds a mock PR with patch content, taps the file row, asserts diff text renders (would fail before fix)Possible Improvements
Low risk. Pre-existing gap (out of scope): multi-repo PR file taps still mismatch because
useReviewSourcesonly fetches the primary PR viausePRDiffand stamps withpr.repo, while the timeline stamps with the workspacerepoName. File a separate issue if needed.Checklist
apps/web/), I have added or updated Playwright e2e tests inapps/web/e2e/and verified them withmake test-e2e.