Fix RHP dismissal during report navigation with key-based wrapper#87773
Fix RHP dismissal during report navigation with key-based wrapper#87773leshniak wants to merge 3 commits intoExpensify:mainfrom
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
a0e8b65 to
06561b0
Compare
When navigating between expense reports using prev/next arrows, the RHP
would close because the dismissal effect detected report as undefined
during Onyx key transition and incorrectly triggered dismissModal.
Split SearchMoneyRequestReportPage into outer wrapper with
key={reportIDFromRoute} and inner content component. Each arrow click
remounts with clean state. A mount-scoped hasEverHadReportRef ensures
dismissal only fires after report has loaded then disappeared (deletion),
not during initial hydration gap. Hydration guard in shouldShowAccessErrorPage
suppresses the not-found page while Onyx resolves.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
I was reviewing #88113 since I am assigned as reviewer. Not found page briefly shows when report is deleted from another device. Can we fix that? bug.mov |
06561b0 to
24c4ab4
Compare
@aimane-chnaif I made a potential fix, but it's not tested yet - let's leave this PR as a draft until Monday. |
c81343f to
a7b6c92
Compare
a7b6c92 to
b51ad6c
Compare
|
@aimane-chnaif It's fixed. |
|
🚧 @Julesssss has triggered a test Expensify/App build. You can view the workflow run here. |
|
@aimane-chnaif thanks for looking, I assigned you to the issue. Please re-review when you have a moment |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
@Julesssss 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] |
|
PR doesn’t need product input as a refactor PR. Unassigning and unsubscribing myself. |
|
Hi @aimane-chnaif, the feedback fix was resolved. I think that's the last thing to check |
|
@leshniak please merge main as the branch is very behind |
|
@aimane-chnaif merged |
Explanation of Change
Split
SearchMoneyRequestReportPageinto an outer wrapper that passeskey={reportIDFromRoute}and an innerSearchMoneyRequestReportPageContent. Each arrow click remounts the inner component with a clean slate — all hooks and refs reset naturally without manual tracking.The dismissal effect uses a mount-scoped
hasEverHadReportRef— it startsfalseon each remount, so the transientundefinedduring Onyx hydration cannot trigger dismissal. Once the report loads, the ref becomestrue. If the report is later deleted (becomesundefined), we dismiss — preserving the existing behavior. TheisMoneyRequestReportcheck from the original code was dropped since this page only renders money request reports.Also adds a hydration guard in
shouldShowAccessErrorPage: whenreportIDFromRouteis set butreportIDhasn't resolved from Onyx yet and report actions haven't loaded, the error page is suppressed — showing the skeleton loader instead of "Hmm... it's not there". The guard is bounded byhasLoadedReportActionsForAccessErrorso genuinely non-existent reports still show the error once loading completes.This also removes both
usePreviouscalls from the component, making it React Compiler compliant.Fixed Issues
$ #87784
PROPOSAL:
Tests
Offline tests
QA Steps
Same as Tests above.
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.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
bez.nazwy.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
test.mp4