You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Odometer] Reloading app during creation flow with preview open lands on not-found page #81901
When the app is reloaded while a preview is open during the expense creation flow (before a recipient has been chosen), the user lands on a not-found page.
Root cause: On reload the app attempts to rebuild the URL. When it lacks the fullscreen screen it falls back to adding a screen based on the reportID. During the creation flow, before a recipient is selected, the reportID is a temporary/fake value. This causes navigation to resolve to a non-existent report, resulting in the not-found page.
Expected behavior: Close the preview and navigate to the home page. The preview data is a draft with no persisted state, so there is nothing to restore. This is consistent with how every other expense type already behaves on reload.
Proposed fix: Detect the temporary reportID case during URL reconstruction and, instead of attempting to navigate to the report, dismiss the preview and land on the home page.
Please re-state the problem that we are trying to solve in this issue.
When the app is reloaded while a receipt/odometer preview is open during the expense creation flow (before a recipient has been chosen), the user lands on a not-found page instead of being gracefully returned to the home page.
What is the root cause of that problem?
The root cause is that TransactionReceiptModalContent shows a not-found page when the draft transaction is unavailable after reload, combined with the navigation layer not having special handling for creation-flow URLs with temporary reportIDs.
Here is the specific chain of events:
Temporary reportID in URL: When the user starts an expense from the global FAB, FloatingActionButtonAndPopover generates a random reportID via generateReportID() (src/pages/inbox/sidebar/FloatingActionButtonAndPopover.tsx:196). This reportID is embedded in the navigation URL but never persisted to Onyx as a real report.
Navigation state reconstruction: On reload, getAdaptedStateFromPath (src/libs/Navigation/helpers/getAdaptedStateFromPath.ts:217-262) finds no fullscreen route in the parsed state. It calls getMatchingFullScreenRoute, but RECEIPT_PREVIEW has no RHP_TO_* mapping. It falls back to getDefaultFullScreenRoute (line 179-199), which checks the reportID against Onyx -- the temporary ID has no entry, so it returns a generic REPORTS_SPLIT_NAVIGATOR.
Component-level not-found:TransactionReceiptModalContent (src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx:55,208-209) determines isDraftTransaction = !!action (which is true since action = "create" from the URL). For draft transactions, shouldShowNotFoundPage simplifies to !transaction. The transaction is read from TRANSACTION_DRAFT Onyx key. If the draft is unavailable or has invalid blob:// receipt URLs after reload, the not-found page is shown.
Why other expense types handle this correctly: The IOURequestStartPage uses AccessOrNotFoundWrapper which explicitly detects the global-create case via isFromGlobalCreate = isEmptyObject(report?.reportID) (src/pages/workspace/AccessOrNotFoundWrapper.tsx:156) and bypasses the not-found guard. The receipt preview screen has no equivalent bypass.
What changes do you think we should make in order to solve the problem?
In TransactionReceiptModalContent, when isDraftTransaction is true and the transaction draft is not available (i.e., transactionDraft is null/undefined after reload), instead of showing the not-found page, dismiss the preview and navigate to the home page. This can be done by adding an effect that checks for this condition and calls Navigation.dismissModal() followed by Navigation.navigateHome() (or equivalent), similar to how other creation-flow screens handle the reload case.
Specifically, in src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx, add a check early in the component: if isDraftTransaction is true and transactionDraft is null/undefined, navigate away instead of rendering the not-found view. This is consistent with the issue's expected behavior ("close the preview and navigate to the home page") and aligns with how every other expense type already behaves on reload -- the preview data is a draft with no persisted state, so there is nothing to restore.
What alternative solutions did you explore? (Optional)
An alternative would be to handle this at the navigation layer in getAdaptedStateFromPath by detecting that the URL corresponds to a creation-flow receipt preview (checking action === 'create' in the route params) and redirecting to the home screen. However, this would be more invasive and the component-level fix is simpler, more targeted, and consistent with the existing pattern where individual screens handle their own reload recovery.
Another alternative would be to add an isFromGlobalCreate bypass to withWritableReportOrNotFound (similar to what AccessOrNotFoundWrapper does), but this wouldn't help for RECEIPT_PREVIEW since it doesn't use that HOC -- it renders via TransactionReceiptModalContent directly.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
changed the title [-][Odometer] Reloading app during creation flow with preview open lands on not-found page[/-][+][HOLD][Odometer] Reloading app during creation flow with preview open lands on not-found page[/+]on Mar 5, 2026
changed the title [-][HOLD][Odometer] Reloading app during creation flow with preview open lands on not-found page[/-][+][Odometer] Reloading app during creation flow with preview open lands on not-found page[/+]on Mar 16, 2026
But I did come back to this issue yesterday and today to investigate if there is some better fix than the one left on this older draft PR #82407. What's pretty confusing/interesting to me is that the issue seems to disappear completely 😅. There were some significant changes made to the state restoration logic which I am now looking into in parallel to answering review on those PRs above. I want to make sure that the issue is definitely fixed and properly test that.
specifically this change below is crucial as it defaults to NAVIGATORS.REPORTS_SPLIT_NAVIGATOR when reportID cannot be found in ONYX, which is our case during creation flow before we choose the recipient.
Video proof from current main with comparison to the Scan receipt preview:main.mov
Issue 1
As you can see in the video above the only issue left is that we don't yet detect faulty blob URLs so when we reload on image preview open our rebuild state lands on the TransactionReceiptModalContent with infinite loading indicator. But this issue will be solved in our next PR:
Also you could see on the video that when we reload on Scan image preview then the RHP stays open and for odometer that doesn't happen but that's actually caused by the blob URL loss detection mechanism, not the state restoration. When faulty blob URL is detected then navigateToStartMoneyRequestStep is called and thus we once again land on the open RHP with Scan screen visible.
Video showing that when we reload on Scan receipt preview on mobile then blob URL loss detection doesn't bring us back to RHP Scan screen as there are bo blob URLs(proof that the RHP Scan we see on mobile after reload is owed to blob URL loss detection):proof-of-no-RHP-scan-recovery.mp4
Good news once again! This will also be solved here:
Video showing how it works after we introduce blob URL loss detection to odometer (with comparison to Scan)blob-url-verification.movTLDR
Two small differences between Odometer and Scan are caused by the lack of blob URL loss detection for Odometer so this will be taken care off in our next PR:
Activity
MelvinBot commentedon Feb 13, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When the app is reloaded while a receipt/odometer preview is open during the expense creation flow (before a recipient has been chosen), the user lands on a not-found page instead of being gracefully returned to the home page.
What is the root cause of that problem?
The root cause is that
TransactionReceiptModalContentshows a not-found page when the draft transaction is unavailable after reload, combined with the navigation layer not having special handling for creation-flow URLs with temporary reportIDs.Here is the specific chain of events:
Temporary reportID in URL: When the user starts an expense from the global FAB,
FloatingActionButtonAndPopovergenerates a random reportID viagenerateReportID()(src/pages/inbox/sidebar/FloatingActionButtonAndPopover.tsx:196). This reportID is embedded in the navigation URL but never persisted to Onyx as a real report.RECEIPT_PREVIEW is a root-level screen: The
MONEY_REQUEST.RECEIPT_PREVIEWscreen is registered at the root level of the navigation stack (src/libs/Navigation/AppNavigator/AuthScreens.tsx:636-641andsrc/libs/Navigation/linkingConfig/config.ts:36), not inside the RHP. Its route pattern is:action/:iouType/receipt/:transactionID/:reportID/:imageType?.Navigation state reconstruction: On reload,
getAdaptedStateFromPath(src/libs/Navigation/helpers/getAdaptedStateFromPath.ts:217-262) finds no fullscreen route in the parsed state. It callsgetMatchingFullScreenRoute, but RECEIPT_PREVIEW has noRHP_TO_*mapping. It falls back togetDefaultFullScreenRoute(line 179-199), which checks the reportID against Onyx -- the temporary ID has no entry, so it returns a genericREPORTS_SPLIT_NAVIGATOR.Component-level not-found:
TransactionReceiptModalContent(src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx:55,208-209) determinesisDraftTransaction = !!action(which istruesinceaction="create"from the URL). For draft transactions,shouldShowNotFoundPagesimplifies to!transaction. The transaction is read fromTRANSACTION_DRAFTOnyx key. If the draft is unavailable or has invalid blob:// receipt URLs after reload, the not-found page is shown.Why other expense types handle this correctly: The
IOURequestStartPageusesAccessOrNotFoundWrapperwhich explicitly detects the global-create case viaisFromGlobalCreate = isEmptyObject(report?.reportID)(src/pages/workspace/AccessOrNotFoundWrapper.tsx:156) and bypasses the not-found guard. The receipt preview screen has no equivalent bypass.What changes do you think we should make in order to solve the problem?
In
TransactionReceiptModalContent, whenisDraftTransactionistrueand the transaction draft is not available (i.e.,transactionDraftis null/undefined after reload), instead of showing the not-found page, dismiss the preview and navigate to the home page. This can be done by adding an effect that checks for this condition and callsNavigation.dismissModal()followed byNavigation.navigateHome()(or equivalent), similar to how other creation-flow screens handle the reload case.Specifically, in
src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx, add a check early in the component: ifisDraftTransactionistrueandtransactionDraftis null/undefined, navigate away instead of rendering the not-found view. This is consistent with the issue's expected behavior ("close the preview and navigate to the home page") and aligns with how every other expense type already behaves on reload -- the preview data is a draft with no persisted state, so there is nothing to restore.What alternative solutions did you explore? (Optional)
An alternative would be to handle this at the navigation layer in
getAdaptedStateFromPathby detecting that the URL corresponds to a creation-flow receipt preview (checkingaction === 'create'in the route params) and redirecting to the home screen. However, this would be more invasive and the component-level fix is simpler, more targeted, and consistent with the existing pattern where individual screens handle their own reload recovery.Another alternative would be to add an
isFromGlobalCreatebypass towithWritableReportOrNotFound(similar to whatAccessOrNotFoundWrapperdoes), but this wouldn't help forRECEIPT_PREVIEWsince it doesn't use that HOC -- it renders viaTransactionReceiptModalContentdirectly.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.3 remaining items
MelvinBot commentedon Mar 3, 2026
🤖 Draft PR created: #84001
Please mark it as "Ready for review" when it is ready for review.
DylanDylann commentedon Mar 5, 2026
This should be held as discussed on Slack thread
[-][Odometer] Reloading app during creation flow with preview open lands on not-found page[/-][+][HOLD][Odometer] Reloading app during creation flow with preview open lands on not-found page[/+]jakubkalinski0 commentedon Mar 10, 2026
I will be taking care of this issue next
[-][HOLD][Odometer] Reloading app during creation flow with preview open lands on not-found page[/-][+][Odometer] Reloading app during creation flow with preview open lands on not-found page[/+]DylanDylann commentedon Mar 19, 2026
@jakubkalinski0 Any update here?
Julesssss commentedon Mar 19, 2026
This is lower priority than the currently in progress bugs. But would be a good bug to pickup next week.
jakubkalinski0 commentedon Mar 26, 2026
Sorry for missing that message, I was focused on those three PRs:
But I did come back to this issue yesterday and today to investigate if there is some better fix than the one left on this older draft PR #82407. What's pretty confusing/interesting to me is that the issue seems to disappear completely 😅. There were some significant changes made to the state restoration logic which I am now looking into in parallel to answering review on those PRs above. I want to make sure that the issue is definitely fixed and properly test that.
jakubkalinski0 commentedon Mar 27, 2026
@Julesssss @DylanDylann Some good news here!
This bug is no more 🎉 It's all due to this change made in
getDefaultFullScreenRoute:Detailed explanation
getDefaultFullScreenRoute:
App/src/libs/Navigation/helpers/getAdaptedStateFromPath.ts
Lines 209 to 234 in 2cc616e
specifically this change below is crucial as it defaults to
NAVIGATORS.REPORTS_SPLIT_NAVIGATORwhenreportIDcannot be found inONYX, which is our case during creation flow before we choose the recipient.crucial change:
App/src/libs/Navigation/helpers/getAdaptedStateFromPath.ts
Lines 218 to 220 in 2cc616e
Video proof from current main with comparison to the Scan receipt preview:
main.mov
Issue 1
As you can see in the video above the only issue left is that we don't yet detect faulty blob URLs so when we reload on image preview open our rebuild state lands on the TransactionReceiptModalContent with infinite loading indicator. But this issue will be solved in our next PR:
Issue 2
Also you could see on the video that when we reload on Scan image preview then the RHP stays open and for odometer that doesn't happen but that's actually caused by the blob URL loss detection mechanism, not the state restoration. When faulty blob URL is detected then
navigateToStartMoneyRequestStepis called and thus we once again land on the open RHP with Scan screen visible.Video showing that when we reload on Scan receipt preview on mobile then blob URL loss detection doesn't bring us back to RHP Scan screen as there are bo blob URLs(proof that the RHP Scan we see on mobile after reload is owed to blob URL loss detection):
proof-of-no-RHP-scan-recovery.mp4
Good news once again! This will also be solved here:
Video showing how it works after we introduce blob URL loss detection to odometer (with comparison to Scan)
blob-url-verification.mov
TLDR
Two small differences between Odometer and Scan are caused by the lack of blob URL loss detection for Odometer so this will be taken care off in our next PR:
Besides that we are good!
Due to that I would like to close this old PR
and I think we can also close this issue. What do you think about that? Also feel free to give any feedback or ask questions!
Julesssss commentedon Mar 28, 2026
Nice! That's great news.
DylanDylann commentedon Apr 3, 2026
@Julesssss Could you close this issue?