decompose ReportScreen 6c: extract not-found guards#86720
decompose ReportScreen 6c: extract not-found guards#86720rlinoz merged 10 commits intoExpensify:mainfrom
Conversation
…Screen Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
17bf3d1 to
e45e5af
Compare
|
@codex review |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e45e5af046
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…params Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ge state Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@codex review |
…undGuard Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d2f196aaa1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…Guard Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@DylanDylann Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce5ec3f7ea
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@codex review |
|
@MelvinBot review |
🤖 Code Review — ReportScreen 6c: Extract Not-Found GuardsNice decomposition. The extraction is clean, and the new guard components are well-structured with clear separation of concerns. Here's my detailed analysis: What's Good
Items Worth Confirming1.
For a previously loaded report where Onyx synchronously delivers cached values ( In practice, 2. The 3. Removal of the render-time early return ( The old code had: if ((lastRoute !== route || lastReportActionIDFromRoute !== reportActionIDFromRoute)
&& isLinkingToMessage !== !!reportActionIDFromRoute) {
setIsLinkingToMessage(!!reportActionIDFromRoute);
return null;
}This rendered nothing during route transitions to a new linked action. The new code removes this, which should be fine — showing stale content briefly is better UX than a blank screen, and Nit
SummaryThis is a well-executed refactor that fixes a genuine bug in the linked-action not-found logic and simplifies complex state management. The Looks good overall 👍 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0c0dfd215d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Answering Melvin:
The only dangerous scenario would be: stale metadata cached ( For a never-loaded report: no metadata exists → |
|
@adhorodyski I overlooked the PR description in my initial review. Your refactor looks great |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-04-02.at.21.01.35.movAndroid: mWeb ChromeScreen.Recording.2026-04-02.at.20.53.59.moviOS: HybridAppScreen.Recording.2026-04-02.at.20.56.31.moviOS: mWeb SafariScreen.Recording.2026-04-02.at.20.45.59.movMacOS: Chrome / SafariScreen.Recording.2026-04-02.at.20.42.33.mov |
|
🚧 @rlinoz has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/rlinoz in version: 9.3.52-0 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes are required for this PR. This is a code-level refactoring that extracts guard components from |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.3.52-9 🚀
|
Explanation of Change
PR 6c in the ReportScreen decomposition series (6a → 6b → 6c → 6d).
Extracts two guard wrapper components from
ReportScreen.tsxand simplifies them:ReportNotFoundGuard— report-level not-found logic, wraps children inFullPageNotFoundViewwhen the report does not exist or is inaccessible. Uses sharedisLoadingInitialReportActionsSelectorinstead of subscribing to the fullreportMetadataobject. Deduplicates route param extraction.LinkedActionNotFoundGuard— linked action not-found with a cheap outer gate (skips the heavy check when noreportActionIDis in the route) and a heavy inner gate (verifies the linked action actually exists in the report). Simplified with:key={reportActionIDFromRoute}on the inner gate — React-idiomatic remount per linked action, replacing the manualfirstRenderstate +lastReportActionIDFromRoutetrackingisLinkingToMessagestate, itsInteractionManagereffect, and its render-time guard — vestigial since the outer gate already ensures the inner gate only mounts whenreportActionIDFromRouteis truthy, and!isLoadingInitialReportActionsalready suppresses not-found during loadingisNavigatingToDeletedActionstate — replaced withwasEverVisible, a one-way flag set during render (React-supported pattern for adjusting state based on props)usePrevious— replaced bywasEverVisiblewhich tracks the same semantic ("was the action ever loaded and visible during this mount?") without reading refs during renderusePaginatedReportActions(pagination, sorting, continuous-chain computation) with a directuseOnyxselector that looks up the linked action by ID — the guard only needs the action itself, not the full paginated viewsortedAllReportActions.length > 0 && reportActions.length === 0) with a direct!linkedActionnull check — the old check incorrectly showed "comment not found" for existing, visible actions when the filtered paginated window happened to be empty (a pagination artifact, not a linked-action-not-found concern)UX differences from main:
isLoadingInitialReportActions: false, so the delay was unnecessaryFixed Issues
$ #84895
PROPOSAL:
Tests
General regression — report loads normally
Report not-found — invalid report ID
/r/000000000).Report not-found — deleted/inaccessible report
Linked action not-found — deleted comment
/r/<reportID>/<reportActionID>).Linked action not-found — inaccessible whisper
reportActionID.Linked action not-found — no
reportActionIDin route (cheap gate)reportActionIDquery param.Offline behavior
Offline tests
N/A
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari