Repository navigation
Fix false "not here" page for reports not in the sidebar (ReportNotFoundGuard/ReportFetchHandler race) - #93415
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…test Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@abdulrahuman5196 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] |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 56c9ef9634
ℹ️ 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".
JmillsExpensify
left a comment
There was a problem hiding this comment.
No product review required.
|
Hi, @abdulrahuman5196 can you review it ? |
|
Hi, Checking now |
any news ? :) |
|
Hi, Checking the PR still, will provide update before EOD |
|
Checking now again |
|
@elirangoshen How do we get a report which is not in sidebar, i tried different cases of this, but still the report have a LHN entry. Could you provide more information on how to create this kind of report?
|
It was hard for me to reproduce it manually , thats why I tried to prove the solution in the automated tests |
|
Checking now again |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-06-23.at.2.44.48.PM.movAndroid: mWeb ChromeScreen.Recording.2026-06-23.at.2.48.05.PM.moviOS: HybridAppScreen.Recording.2026-06-23.at.2.31.18.PM.moviOS: mWeb SafariScreen.Recording.2026-06-23.at.2.33.26.PM.movMacOS: Chrome / SafariScreen.Recording.2026-06-23.at.1.32.41.PM.mov |
I verified it in the similar way and checked related usecases for regressions. All looks good. |
There was a problem hiding this comment.
Changes looks good and works well. Reviewers checklist is also complete.
All yours. @mountiny
🎀 👀 🎀
C+ Reviewed
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #92920 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
all for @MonilBhavsar |
|
🚧 MonilBhavsar has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 9.4.19-1 🚀
Bundle Size Analysis (Sentry): |
|
🤖 Help site review: no changes required. I reviewed the changes in this PR against the help site articles under This is an internal bug fix for a loading-state race condition — There is no documentable change here:
Because nothing in |
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.4.19-5 🚀
|
Explanation of Change
ReportScreenwas decomposed intoReportNotFoundGuard+ReportFetchHandleras separate components. The guard decides "not here" from!isLoading && !reportExists, while the handler is what firesopenReport. BecauseisLoadingInitialReportActionslives in a memory-only Onyx key (RAM_ONLY_REPORT_LOADING_STATE) that is not reset between in-app navigations, a stalefalseleaked from a previously-viewed report can makeisLoadingevaluate tofalseon the guard's first render — before the handler fetches the report. For a report not in the sidebar (opened via direct URL / deep link / bookmark), this produced a false "Hmm… it's not here" page even though the report is fully accessible.This PR closes the race from both sides:
ReportNotFoundGuardnow only infers not-found after it has observed a real loading phase for the currentreportID(hasSeenLoadingForCurrentReportID), using the documented "adjust state during render" pattern to stay render-synchronous. It no longer trusts a leaked flag on the first render.ReportFetchHandlermarks a report whose actions were never successfully loaded (!hasOnceLoadedReportActions) as loading again on mount, neutralizing the stalefalseso the guard waits for the real fetch result.updateLoadingInitialReportActionis parameterized to accept the loading value (defaults tofalse, preserving all existing callers).Genuinely inaccessible reports are unaffected:
openReport's optimistic update sets the loading flagtrue(observed phase), and its success/failure both resolve it tofalse, so the not-found page still shows correctly once the fetch completes.Fixed Issues
$ #92920
PROPOSAL:
Automated Tests
Added
tests/unit/ReportNotFoundGuardTest.tsx(describe('ReportNotFoundGuard')) covering:isLoadingInitialReportActions: falsewith the report absent must not render the not-found page (fails onmain, passes with this fix).Verified the test fails on
main's guard logic and passes with this change.Tests
/r/<reportID>) — a deep link / bookmark style cold navigation, not by clicking it in-app.Offline tests
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
Screen.Recording.2026-06-12.at.13.10.13.mov
Screen.Recording.2026-06-12.at.13.10.53.mov