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
Scan - User directed to create expense page after capturing multiple receipt via scan icon #84377
👋 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: #83470 - "Scan Receipt UX/perf improvements" by @marcaaron (High confidence) Related Issues: #83469 (the issue that PR #83470 was fixing)
Recommendation: REVERT
PR #83470 introduced significant changes to the receipt scanning camera flow, including freezing the camera on capture and refactoring the capture state management. The changes are extensive and affect critical timing-sensitive code paths in the multi-scan receipt flow. A revert is the safest approach to unblock the deploy while the issue is investigated and fixed properly.
Labels: Keeping DeployBlockerCash label (App deploy is blocked due to frontend bug)
Detailed Analysis
Evidence
PR #83470 was merged on March 3, 2026 and modified the scan receipt camera implementation (src/pages/iou/request/step/IOURequestStepScan/index.native.tsx). The PR made several changes:
Added camera freezing on capture (forceInactive={isAttachmentPickerActive || didCapturePhoto})
Refactored capture state from didCapturePhoto to isCapturingPhoto.current ref for double-tap protection
Removed image cropping from the native capture path
Pre-created upload directory during initialization
The issue affects the multi-scan receipt flow specifically on Android native, which is the primary platform modified by this PR.
Is included in staging (commit 245e40a is on staging branch)
Affects the scan receipt camera behavior on Android native (the reported platform)
Root Cause
The PR changed how camera state is managed during photo capture. Specifically:
Line 375: setDidCapturePhoto(true) is called after photo capture
Line 505: Camera becomes inactive when didCapturePhoto is true via forceInactive prop
Lines 407-410: In multi-scan mode, state is reset with setDidCapturePhoto(false) and isCapturingPhoto.current = false
There appears to be a timing issue or state synchronization problem in the multi-scan flow where the camera state changes and navigation logic may not work correctly after capturing multiple receipts. The refactoring from state to ref for capture protection and the addition of camera freezing likely introduced an edge case in the multi-scan user flow.
Please re-state the problem that we are trying to solve in this issue.
When using the multi-scan receipt flow (tap scan icon → multi-scan → capture images → tap arrow → select participant), the user is redirected back to the "Create expense" page instead of proceeding to the confirmation page. This is reproducible on staging (V9.3.32-0) but not production.
What is the root cause of that problem?
Causing PR: #84317 ("[No QA] Sentry logs for Scan shortcut")
This is the same root cause as deploy blocker #84363 (QAB returns to Create expense after entering amount). PR #84317 added iouRequestType to the transaction draft inside startMoneyRequest at src/libs/actions/IOU/index.ts:1378-1381:
Onyx.set(`...TRANSACTION_DRAFT...`,{
isFromFloatingActionButton,
...(requestType&&{iouRequestType: requestType}),// NEW in #84317});
This triggers a chain reaction in the multi-scan flow:
User taps the floating camera button, which calls startMoneyRequest(CREATE, reportID, SCAN, ..., isFromFloatingActionButton=true). The Onyx.set above pre-sets iouRequestType: 'scan' on the draft — but does not set transactionID.
IOURequestStartPage renders and resetIOUTypeIfChanged at src/pages/iou/request/IOURequestStartPage.tsx:181 checks transaction?.iouRequestType === newIOUType. Both are 'scan', so it returns early and skipsinitMoneyRequest.
initMoneyRequest is the only function that sets transactionID on the draft. Since it was skipped, the draft remains {isFromFloatingActionButton: true, iouRequestType: 'scan'} — missing transactionID, isFromGlobalCreate, reportID, etc.
User captures multiple receipts, taps the arrow, and selects a participant. The app navigates to the confirmation page.
The guard useEffect in IOURequestStepConfirmation at src/pages/iou/request/step/IOURequestStepConfirmation.tsx:402-415 checks transaction?.transactionID — finds it undefined — and calls startMoneyRequest(), which navigates the user back to the "Create expense" page.
Before PR #84317, iouRequestType was never pre-set in startMoneyRequest, so resetIOUTypeIfChanged would always find a mismatch and call initMoneyRequest (which properly initializes transactionID and all other fields). This is why the bug only appears on staging.
What changes do you think we should make in order to solve the problem?
In startMoneyRequest at src/libs/actions/IOU/index.ts:1378, add transactionID: CONST.IOU.OPTIMISTIC_TRANSACTION_ID to the Onyx.set call so the draft is always initialized with a valid transactionID:
Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`,{
isFromFloatingActionButton,transactionID: CONST.IOU.OPTIMISTIC_TRANSACTION_ID,// add this
...(requestType&&{iouRequestType: requestType}),});
This ensures the confirmation page's guard useEffect sees a valid transactionID and does not redirect back, regardless of whether initMoneyRequest runs later.
What alternative solutions did you explore? (Optional)
Modify resetIOUTypeIfChanged to also check for transactionID existence — e.g., skip the early return if transactionID is missing. This is more defensive but changes the semantics of the function and could have broader side effects.
The recommended fix (adding transactionID to Onyx.set) is the most targeted — it ensures the draft is properly initialized without changing any other behavior. This same fix resolves both this issue and #84363.
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.
Activity
melvin-bot commentedon Mar 6, 2026
Triggered auto assignment to @trjExpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.melvin-bot commentedon Mar 6, 2026
Triggered auto assignment to @neil-marcellini (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.melvin-bot commentedon Mar 6, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Mar 6, 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 Mar 6, 2026
Investigation Summary
Classification: Frontend bug
Causing PR: #83470 - "Scan Receipt UX/perf improvements" by @marcaaron (High confidence)
Related Issues: #83469 (the issue that PR #83470 was fixing)
Recommendation: REVERT
PR #83470 introduced significant changes to the receipt scanning camera flow, including freezing the camera on capture and refactoring the capture state management. The changes are extensive and affect critical timing-sensitive code paths in the multi-scan receipt flow. A revert is the safest approach to unblock the deploy while the issue is investigated and fixed properly.
Labels: Keeping
DeployBlockerCashlabel (App deploy is blocked due to frontend bug)Detailed Analysis
Evidence
PR #83470 was merged on March 3, 2026 and modified the scan receipt camera implementation (
src/pages/iou/request/step/IOURequestStepScan/index.native.tsx). The PR made several changes:forceInactive={isAttachmentPickerActive || didCapturePhoto})didCapturePhototoisCapturingPhoto.currentref for double-tap protectionThe issue affects the multi-scan receipt flow specifically on Android native, which is the primary platform modified by this PR.
Verification
Confirmed that PR #83470:
src/pages/iou/request/step/IOURequestStepScan/index.native.tsx(85 additions, 83 deletions)Root Cause
The PR changed how camera state is managed during photo capture. Specifically:
setDidCapturePhoto(true)is called after photo capturedidCapturePhotois true viaforceInactivepropsetDidCapturePhoto(false)andisCapturingPhoto.current = falseThere appears to be a timing issue or state synchronization problem in the multi-scan flow where the camera state changes and navigation logic may not work correctly after capturing multiple receipts. The refactoring from state to ref for capture protection and the addition of camera freezing likely introduced an edge case in the multi-scan user flow.
MelvinBot commentedon Mar 6, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When using the multi-scan receipt flow (tap scan icon → multi-scan → capture images → tap arrow → select participant), the user is redirected back to the "Create expense" page instead of proceeding to the confirmation page. This is reproducible on staging (V9.3.32-0) but not production.
What is the root cause of that problem?
Causing PR: #84317 ("[No QA] Sentry logs for Scan shortcut")
This is the same root cause as deploy blocker #84363 (QAB returns to Create expense after entering amount). PR #84317 added
iouRequestTypeto the transaction draft insidestartMoneyRequestatsrc/libs/actions/IOU/index.ts:1378-1381:This triggers a chain reaction in the multi-scan flow:
startMoneyRequest(CREATE, reportID, SCAN, ..., isFromFloatingActionButton=true). TheOnyx.setabove pre-setsiouRequestType: 'scan'on the draft — but does not settransactionID.IOURequestStartPagerenders andresetIOUTypeIfChangedatsrc/pages/iou/request/IOURequestStartPage.tsx:181checkstransaction?.iouRequestType === newIOUType. Both are'scan', so it returns early and skipsinitMoneyRequest.initMoneyRequestis the only function that setstransactionIDon the draft. Since it was skipped, the draft remains{isFromFloatingActionButton: true, iouRequestType: 'scan'}— missingtransactionID,isFromGlobalCreate,reportID, etc.useEffectinIOURequestStepConfirmationatsrc/pages/iou/request/step/IOURequestStepConfirmation.tsx:402-415checkstransaction?.transactionID— finds itundefined— and callsstartMoneyRequest(), which navigates the user back to the "Create expense" page.Before PR #84317,
iouRequestTypewas never pre-set instartMoneyRequest, soresetIOUTypeIfChangedwould always find a mismatch and callinitMoneyRequest(which properly initializestransactionIDand all other fields). This is why the bug only appears on staging.What changes do you think we should make in order to solve the problem?
In
startMoneyRequestatsrc/libs/actions/IOU/index.ts:1378, addtransactionID: CONST.IOU.OPTIMISTIC_TRANSACTION_IDto theOnyx.setcall so the draft is always initialized with a validtransactionID:This ensures the confirmation page's guard
useEffectsees a validtransactionIDand does not redirect back, regardless of whetherinitMoneyRequestruns later.What alternative solutions did you explore? (Optional)
resetIOUTypeIfChangedto also check fortransactionIDexistence — e.g., skip the early return iftransactionIDis missing. This is more defensive but changes the semantics of the function and could have broader side effects.The recommended fix (adding
transactionIDtoOnyx.set) is the most targeted — it ensures the draft is properly initialized without changing any other behavior. This same fix resolves both this issue and #84363.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.rlinoz commentedon Mar 6, 2026
CP requested here https://expensify.slack.com/archives/C07J32337/p1772799057976099
m-natarajan commentedon Mar 6, 2026
Not Repro, Galaxy A55/ Android 16, v9.3.32-2
repro.-.issue.84377.mp4
Fix DB #84377
IuliiaHerets commentedon Mar 9, 2026
Xiaomi Redmi Note 10 / Android 12
App 9.3.33-1 PR: 84552 Ad-Hoc
Passed
Screenrecorder-2026-03-09-18-29-30-429.mp4