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
Expense - App redirects to add receipt page after refreshing confirm page with receipt #90025
Version Number: 9.3.69-0 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from BrowserStack:#89313 Email or phone of affected tester (no customers):sjdosjdosjdojnsodj@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.2 / Chrome App Component: Money Requests
Action Performed:
Go to staging.new.expensify.com
Go to workspace chat.
Click + > Create expense > Manual.
Enter amount > Next.
On confirm page, add a receipt.
Refresh confirm page.
Expected Result:
App will redirect to create expense flow after refreshing confirm page with receipt.
Actual Result:
App redirects to add receipt page after refreshing confirm page with receipt.
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Classification: Frontend bug Causing PR: #89313 - "Guard against empty receipt source in ReceiptFileValidator" by @MelvinBot (High confidence) Related Issues: #88975 (the issue PR #89313 was attempting to fix)
Recommendation: REVERT
PR #89313 changed the timing of setMoneyRequestReceipt in ReceiptFileValidator.tsx, which unblocked a navigation path that was previously suppressed by effect cleanup, causing the redirect to the SCAN step instead of the create expense flow on page refresh.
The pre-PR version of the file was retrieved from staging commit history and compared against the current version.
Root Cause
Before PR #89313, setMoneyRequestReceipt was called synchronously inside the onFailure callback (during the Promise.all map). This caused an immediate Onyx state update that triggered a React re-render, which ran the useEffect cleanup and set ignore = true. By the time .then() ran, ignore was already true, so the Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_SCAN...) call was skipped.
PR #89313 deferred setMoneyRequestReceipt to after Promise.all resolves (using the resetInitialTransactionReceipt flag), specifically to prevent the effect from retriggering mid-promise. However, this side effect of the old timing — suppressing the SCAN navigation via ignore = true — was a behavioral dependency that the fix inadvertently removed.
After PR #89313, when a MANUAL expense is created, a receipt is added on the confirm page, and the user refreshes, the onFailure callback fires (blob URL is invalid), isScanFilesCanBeRead is set to false, and the .then() block runs with ignore = false. The code hits if (requestType === CONST.IOU.REQUEST_TYPE.MANUAL) (line 109) and navigates to ROUTES.MONEY_REQUEST_STEP_SCAN — the "add receipt page" — instead of the create expense flow.
The navigation to MONEY_REQUEST_STEP_SCAN for MANUAL was pre-existing and appears intentional for the SCAN-initiated flow (issue #88975). However, it is incorrect for a MANUAL expense where the receipt was added on the confirm page — the user should be redirected to the manual entry step, not the receipt scan step.
PR #89313 fixed a bug where a stale receipt left the "Create Expense" button enabled (#88975), but introduced a regression: refreshing the confirmation page now always redirects SCAN-type expenses to the "add receipt" page and deletes draft transactions.
Solution
The root cause is in ReceiptFileValidator.tsx:98-116. PR #89313 moved setMoneyRequestReceipt from the onFailure callback (line 87) into the .then() block (line 99-101), before the ignore check (line 102). Previously, calling setMoneyRequestReceipt inside onFailure triggered an Onyx update → re-render → effect cleanup set ignore = true → .then() exited early → no redirect. Now, ignore is still false when .then() runs, so the redirect always fires.
The mechanism: blob:// receipt URLs don't survive page refresh. After refresh, validateReceiptFile fails → isScanFilesCanBeRead = false → draft transactions are deleted (line 113) → user is redirected to the scan page (line 115).
The fix should make the validator distinguish between "receipt was never attached" and "receipt was lost due to refresh." When a receipt source exists in Onyx but the blob URL is unreadable, the validator should clear the receipt source (as it does now) but stay on the confirmation page and prompt the user to re-attach the receipt, rather than nuking the entire draft and redirecting.
Concretely, after resetInitialTransactionReceipt clears the receipt in the .then() block, the code should return early instead of falling through to the redirect/delete logic — the user's other expense data (amount, merchant, category) is still valid and shouldn't be lost.
Investigation details
Data flow on refresh:
User creates expense with scanned receipt (blob:// URL stored in Onyx)
Page refresh — browser clears blob store, Onyx restores draft with stale blob:// URL
Related issue:#88975 — the original bug this PR was fixing (receipt disappears but Create button stays enabled).
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
@lanitochka17 my bad this is expected behavior. I gave u only the receipt expense step on the PR. If it is a manual expense with receipt it should indeed redirect to add receipt page because we don't need to reset the flow as it is manual. We can close it @Julesssss BTW this is an already existing feature we only fixed it to work on that pr. We did not change any behavior.
Activity
melvin-bot commentedon May 8, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #89313
melvin-bot commentedon May 8, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon May 8, 2026
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
OSBotify commentedon May 8, 2026
Investigation Summary
Classification: Frontend bug
Causing PR: #89313 - "Guard against empty receipt source in ReceiptFileValidator" by @MelvinBot (High confidence)
Related Issues: #88975 (the issue PR #89313 was attempting to fix)
Recommendation: REVERT
PR #89313 changed the timing of
setMoneyRequestReceiptinReceiptFileValidator.tsx, which unblocked a navigation path that was previously suppressed by effect cleanup, causing the redirect to the SCAN step instead of the create expense flow on page refresh.Assigned: @MelvinBot (PR author), @FitseTLT (approving reviewer), @Julesssss (approving reviewer)
Labels:
DeployBlockerCashkept (frontend App PR caused the regression). No label changes made.Detailed Analysis
Evidence
src/pages/iou/request/step/confirmation/ReceiptFileValidator.tsx, the exact file responsible for the redirect-on-refresh behavior.Verification
src/pages/iou/request/step/confirmation/ReceiptFileValidator.tsxgh pr view 89313 --json files).Root Cause
Before PR #89313,
setMoneyRequestReceiptwas called synchronously inside theonFailurecallback (during thePromise.allmap). This caused an immediate Onyx state update that triggered a React re-render, which ran theuseEffectcleanup and setignore = true. By the time.then()ran,ignorewas alreadytrue, so theNavigation.navigate(ROUTES.MONEY_REQUEST_STEP_SCAN...)call was skipped.PR #89313 deferred
setMoneyRequestReceiptto afterPromise.allresolves (using theresetInitialTransactionReceiptflag), specifically to prevent the effect from retriggering mid-promise. However, this side effect of the old timing — suppressing the SCAN navigation viaignore = true— was a behavioral dependency that the fix inadvertently removed.After PR #89313, when a MANUAL expense is created, a receipt is added on the confirm page, and the user refreshes, the
onFailurecallback fires (blob URL is invalid),isScanFilesCanBeReadis set tofalse, and the.then()block runs withignore = false. The code hitsif (requestType === CONST.IOU.REQUEST_TYPE.MANUAL)(line 109) and navigates toROUTES.MONEY_REQUEST_STEP_SCAN— the "add receipt page" — instead of the create expense flow.The navigation to
MONEY_REQUEST_STEP_SCANfor MANUAL was pre-existing and appears intentional for the SCAN-initiated flow (issue #88975). However, it is incorrect for a MANUAL expense where the receipt was added on the confirm page — the user should be redirected to the manual entry step, not the receipt scan step.MelvinBot commentedon May 8, 2026
Proposal
Problem
PR #89313 fixed a bug where a stale receipt left the "Create Expense" button enabled (#88975), but introduced a regression: refreshing the confirmation page now always redirects SCAN-type expenses to the "add receipt" page and deletes draft transactions.
Solution
The root cause is in
ReceiptFileValidator.tsx:98-116. PR #89313 movedsetMoneyRequestReceiptfrom theonFailurecallback (line 87) into the.then()block (line 99-101), before theignorecheck (line 102). Previously, callingsetMoneyRequestReceiptinsideonFailuretriggered an Onyx update → re-render → effect cleanup setignore = true→.then()exited early → no redirect. Now,ignoreis stillfalsewhen.then()runs, so the redirect always fires.The mechanism:
blob://receipt URLs don't survive page refresh. After refresh,validateReceiptFilefails →isScanFilesCanBeRead = false→ draft transactions are deleted (line 113) → user is redirected to the scan page (line 115).The fix should make the validator distinguish between "receipt was never attached" and "receipt was lost due to refresh." When a receipt source exists in Onyx but the blob URL is unreadable, the validator should clear the receipt source (as it does now) but stay on the confirmation page and prompt the user to re-attach the receipt, rather than nuking the entire draft and redirecting.
Concretely, after
resetInitialTransactionReceiptclears the receipt in the.then()block, the code shouldreturnearly instead of falling through to the redirect/delete logic — the user's other expense data (amount, merchant, category) is still valid and shouldn't be lost.Investigation details
Data flow on refresh:
blob://URL stored in Onyx)blob://URLReceiptFileValidatoreffect runs:isLocalFile('blob://...')→truevalidateReceiptFiletries to fetch blob → failsonFailure: setsresetInitialTransactionReceipt = true,isScanFilesCanBeRead = false.then(): callssetMoneyRequestReceipt(id, '', '', true, '')— clears receiptignoreis stillfalse→ proceeds to delete drafts and redirect to scan pageKey files:
ReceiptFileValidator.tsx:87-116— the changed logicFileUtils.ts:523-528—isLocalFilecheckIOUUtils.ts:18-42—navigateToStartMoneyRequestStepredirect targetsRelated issue: #88975 — the original bug this PR was fixing (receipt disappears but Create button stays enabled).
Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.FitseTLT commentedon May 8, 2026
@lanitochka17 my bad this is expected behavior. I gave u only the receipt expense step on the PR. If it is a manual expense with receipt it should indeed redirect to add receipt page because we don't need to reset the flow as it is manual. We can close it @Julesssss BTW this is an already existing feature we only fixed it to work on that pr. We did not change any behavior.
Julesssss commentedon May 8, 2026
Thanks @FitseTLT. Yeah I agree. Closing