Show loading spinner instead of not-found page for draft transaction receipt preview#84291
Show loading spinner instead of not-found page for draft transaction receipt preview#84291
Conversation
…rge for draft transactions When uploading an odometer photo and navigating to the receipt preview, Onyx.merge is async and useOnyx returns undefined while the merge is pending, causing shouldShowNotFoundPage to evaluate to true. This change checks the useOnyx fetch status for the transaction draft and shows a loading spinner during the pending merge instead of the "not here" page. Co-authored-by: Eugene Voloshchak <eVoloshchak@users.noreply.github.com>
|
I created this PR from an upstream branch since I don't have push access to your fork. To take ownership of this branch and be able to push updates, run: Then you can close this PR and open a new one from your fork. |
Replace || with ?? for isLoadingInitialReportActions fallback to satisfy @typescript-eslint/prefer-nullish-coalescing rule. Co-authored-by: Eugene Voloshchak <eVoloshchak@users.noreply.github.com>
|
Fixed the failing |
|
The failing check ( Analysis: The failure is in Evidence:
Re-running the test job should resolve this. You can re-trigger it from the Actions tab. |
|
@MelvinBot, is this issue not reproducible anymore after #82305 has been merged? |
|
The specific reproduction steps in issue #82661 (which involve opening an existing expense, clicking Distance, then clicking the image thumbnail) are indeed no longer reproducible after #82305 merged. That PR hides the image thumbnails entirely when However, the underlying race condition bug still exists and can be triggered through the create flow:
So this PR's fix is still needed — it makes |
Explanation of Change
When uploading an odometer photo and navigating back to the receipt preview screen,
Onyx.merge(used bysetMoneyRequestOdometerImage) is async. While the merge is pending,useOnyxreturnsundefinedfor the transaction draft withfetchStatus = 'loading'. This causesshouldShowNotFoundPageto evaluate totrue(since!undefined === true), displaying a "not here" page instead of the receipt.This PR updates the
isLoadingcalculation inTransactionReceiptModalContentto also check theuseOnyxfetch status for the draft transaction. When the draft transaction is still loading (pending Onyx merge), the component now shows a loading spinner instead of the "not here" page.Changes:
ResultMetadatafromuseOnyxfor the transaction draftisLoadingOnyxValueutility (same pattern aswithFullTransactionOrNotFound) to check if the draft is in a'loading'stateisLoadingprop so the UI shows a spinner during the Onyx merge windowFixed Issues
$ #82661
Tests
odometerExpensesbeta flag)Offline tests
This fix addresses a race condition during an async Onyx merge. Offline behavior is unchanged — the loading spinner will display until the merge completes or the user navigates away.
QA Steps
odometerExpensesbeta flagPR 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