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
[Due for payment 2026-11-05] [$175] Scan expenses - Multiple scan expenses with different recipients all get added to the workspace of whichever one you tap Submit on #104236
Version Number: 9.5.10-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@GCyganek Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Create multiple scan expenses.
Assign different recipients to each scan expense, where each recipient belongs to a different workspace.
Tap Submit on one of the scan expenses.
Check where each expense ends up.
Expected Result:
Each scan expense should be added to the workspace associated with its own assigned recipient — i.e., they should end up in separate workspaces, matching the recipient selected for each one.
Actual Result:
All scan expenses end up added to the same workspace — specifically, the workspace associated with whichever scan expense you happened to tap Submit on, regardless of each expense's individually assigned recipient.
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
On the multi-scan confirmation page, the To picker saves the new recipient to the receipt on screen only. But Submit sends every receipt to that one recipient.
The picker saves the recipient and report for the visible receipt only (activeTransactionID). So each receipt can store a different recipient.
On Submit, the code takes the recipient of the visible receipt (selectedParticipants.at(0)). It then reuses that recipient's report, chat report ID, and policy for every receipt in the loop. It never reads each receipt's own participants or reportID.
This started with feat: remove isNewManualExpenseFlowEnabled beta flag. Before that PR, tapping To opened the participants step, which applies the recipient to every receipt. So all receipts always shared one recipient, and the submit code was correct. That PR made the in-place picker the only path, and the picker changes only one receipt.
What changes do you think we should make in order to solve the problem?
Bring back the old behavior: one recipient per multi-scan batch.
Pass the full transactions list into useParticipantPickerState.
In handleParticipantsAdded, when there is more than one receipt, apply the new recipient and report to every receipt. Use the same loop the old participants step used.
Apply the matching category, tag, and rate resets to every receipt too.
After this change, the To field shows the same recipient on every page, and Submit sends every receipt to that recipient. The submit loop needs no change.
What alternative solutions did you explore? (Optional)
Let each receipt keep its own recipient, as the issue's expected result describes. Submit would group receipts by recipient. Then it would find the report, policy, tags, tax, and rate for each group. The track, split, and distance submit hooks would need the same work. This is a much bigger change, and product should confirm they want it first.
Confidence and verification
High confidence in the mechanism. I traced it in code at 1708370d but didn't reproduce it on a device.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/104236) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
changed the title [-]Scan expenses - Multiple scan expenses with different recipients all get added to the workspace of whichever one you tap Submit on[/-][+][$175] Scan expenses - Multiple scan expenses with different recipients all get added to the workspace of whichever one you tap Submit on[/+]on Oct 16, 2026
Please re-state the problem that we are trying to solve in this issue.
When multiple scan expenses with different recipients (each belonging to a different workspace) are created in a multi-scan flow, tapping "Submit" on one of them adds all scan expenses to the single workspace/recipient of the tapped receipt, rather than routing each expense to its own individually assigned recipient/workspace.
What is the root cause of that problem?
There are two interconnected root causes across the multi-scan picker and submission pipeline:
In-place Participant Picker Scope (useParticipantPickerState.ts):
In src/pages/iou/request/step/IOURequestStepConfirmation/useParticipantPickerState.ts (handleParticipantsAdded / lines 190–202), when selecting a recipient in the confirmation step, the recipient and report are updated only for the currently active visible receipt (activeTransactionID). Consequently, individual receipts in the multi-scan batch hold different recipient and report IDs in memory.
Submission Loop Re-uses a Single Context (useRequestMoneySubmission.ts):
In src/pages/iou/request/step/confirmation/submission/useRequestMoneySubmission.ts (lines 163 and 189–266), the submission handler extracts the recipient from the currently active transaction context:
constparticipant=selectedParticipants.at(0);
During the loop (transactions.forEach((transaction) => { ... })), it passes this single participant, its parent report, reportID, and policy to every transaction in the batch instead of inspecting each transaction's own assigned participant / report. (Note: useTrackExpenseSubmission.ts:155-183 shares the identical single-recipient loop).
What changes do you think we should make in order to solve the problem?
We have two clean approaches depending on product requirements:
Allow multi-scan expenses to route to their respective recipients by grouping transactions by recipient during submission:
In src/pages/iou/request/step/confirmation/submission/useRequestMoneySubmission.ts, group transactions by their respective target reportID or participant.accountID:
If product intends for a multi-scan batch to remain unified under a single recipient (similar to the pre-#100215 flow):
In src/pages/iou/request/step/IOURequestStepConfirmation/useParticipantPickerState.ts:
--- a/src/pages/iou/request/step/IOURequestStepConfirmation/useParticipantPickerState.ts+++ b/src/pages/iou/request/step/IOURequestStepConfirmation/useParticipantPickerState.ts@@ -190,4 +190,8 @@ function useParticipantPickerState({
- setTransactionParticipant(activeTransactionID, selectedParticipant);+ // Synchronize selected recipient across all transactions in the multi-scan batch+ transactions.forEach((tx) => {+ setTransactionParticipant(tx.transactionID, selectedParticipant);+ resetTransactionCategoryAndTags(tx.transactionID);+ });
What alternative solutions did you explore? (Optional)
We explored keeping the submission loop as-is and warning the user with a modal if mixed recipients are detected in the carousel. However, Approach 1 is vastly superior because it respects the user's explicit per-receipt recipient selection without artificial constraints.
Tests
Automated Tests:
Add unit test in tests/unit/IOURequestStepConfirmationTest.ts:
Create 2 mock scan transactions (tx1, tx2).
Assign Workspace A recipient to tx1 and Workspace B recipient to tx2.
Trigger submit and verify tx1 calls requestMoney targeting reportA and tx2 targets reportB.
Manual Verification:
Tap + > Submit expense > Scan.
Scan / upload 2 receipts.
On receipt 1, select recipient belonging to Workspace X.
Swipe / navigate to receipt 2, select recipient belonging to Workspace Y.
Tap Submit.
Verify receipt 1 is submitted to Workspace X report and receipt 2 is submitted to Workspace Y report.
Please re-state the problem that we are trying to solve in this issue.
In a multi-scan confirmation flow, when different recipients (or different workspaces) are assigned to individual scan receipts in the batch, tapping "Submit" attaches all expenses to the workspace/chat of whichever receipt is currently active on screen, instead of respecting each receipt's individually assigned recipient.
What is the root cause of that problem?
In src/pages/iou/request/step/IOURequestStepConfirmation/useParticipantPickerState.ts (lines 191 & 203), when the user selects a recipient in the "To" picker, the selection is intentionally saved per-transaction to the currently visible receipt:
Thus, each transaction in transactions correctly stores its own participants and reportID in Onyx.
However, in src/pages/iou/request/step/confirmation/submission/useRequestMoneySubmission.ts (lines 164–184):
The submission handler extracts only a single participant from selectedParticipants.at(0) (which reflects the currently focused active transaction):
constparticipant=selectedParticipants.at(0);
It computes the optimisticChatReportID once for that single recipient.
Then in lines 190–266, when looping over transactions (for (const item of transactions)), it reuses that same participant and optimisticChatReportID across every expense in the batch, completely ignoring each individual transaction's own assigned item.participants or item.reportID:
The same issue exists in useTrackExpenseSubmission.ts (line 214).
What changes do you think we should make in order to solve the problem?
Depending on Product's intended behavior for multi-scan:
Approach A (Recommended — Satisfies the Expected Result):
Allow multi-scan expenses to submit to their respective recipients:
In src/pages/iou/request/step/confirmation/submission/useRequestMoneySubmission.ts:
Inside for (const item of transactions), use each item's individual participant:
Group transactions by recipient/target report before submitting, so expenses going to the same recipient/workspace batch into the same report, while expenses going to different workspaces create/attach to their respective reports.
Approach B (Alternative — Uniform Batch Recipient):
If Product determines that a multi-scan batch must strictly share a single recipient (matching the legacy participant-step behavior):
In src/pages/iou/request/step/IOURequestStepConfirmation/useParticipantPickerState.ts (handleParticipantsAdded), when transactions.length > 1, iterate over all transactions and update participants and reportID across the entire batch instead of only activeTransactionID:
What alternative solutions did you explore? (Optional)
Looked into whether IOURequestStepConfirmation/index.tsx should group multi-scan transactions by workspace prior to rendering the confirmation step. Resolving the recipient during the submission loop is much cleaner and avoids disrupting the swipeable receipt carousel.
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Precondition:
Account is a member of at least 2 workspaces (Workspace A, Workspace B)
Test:
Test 1: Changing To applies to every receipt
Open the app
Tap + > Create expense > Scan
Turn on multi-scan and capture 3 receipts
Proceed to the confirmation page
On receipt 1, tap To and select Workspace A
Switch to receipt 2 and receipt 3
Verify To shows Workspace A on every receipt
On receipt 3, tap To and select Workspace B
Switch back to receipt 1 and receipt 2
Verify To shows Workspace B on every receipt
Tap Create 3 expenses
Verify all 3 expenses are added to Workspace B
Test 2: Submit from a different receipt
Repeat steps 1-4 of Test 1
On receipt 2, tap To and select Workspace A
Switch to receipt 3 and tap Create 3 expenses
Verify all 3 expenses are added to Workspace A
Test 3: Category and tag reset on workspace change
Repeat steps 1-4 of Test 1
Select Workspace A in To, then set a category on receipt 1 and receipt 2
On receipt 3, change To to Workspace B
Switch through all receipts
Verify the Workspace A categories and tags are cleared on every receipt
Tap Create 3 expenses
Verify all 3 expenses are added to Workspace B without Workspace A categories
Test 4: Individual recipient
Repeat steps 1-4 of Test 1
On receipt 2, tap To and select a user who has no existing chat with you (enter a new email)
Verify To shows that user on every receipt
Tap Create 3 expenses
Verify all 3 expenses are added to one IOU report in the chat with that user
Test 5: Self DM
Repeat steps 1-4 of Test 1
On receipt 1, tap To and select Workspace A
On receipt 3, tap To and select yourself
Verify To shows yourself on every receipt
Tap Create 3 expenses
Verify all 3 expenses are tracked in your self DM and none are added to Workspace A
Test 6: Single scan (regression test)
Tap + > Create expense > Scan with multi-scan off and capture 1 receipt
Activity
MelvinBot commentedon Oct 16, 2026
Proposal
What is the root cause of that problem?
On the multi-scan confirmation page, the To picker saves the new recipient to the receipt on screen only. But Submit sends every receipt to that one recipient.
activeTransactionID). So each receipt can store a different recipient.selectedParticipants.at(0)). It then reuses that recipient'sreport, chat report ID, andpolicyfor every receipt in the loop. It never reads each receipt's ownparticipantsorreportID.This started with feat: remove isNewManualExpenseFlowEnabled beta flag. Before that PR, tapping To opened the participants step, which applies the recipient to every receipt. So all receipts always shared one recipient, and the submit code was correct. That PR made the in-place picker the only path, and the picker changes only one receipt.
Code references
participantsandreportfrom the visible receipt: IOURequestStepConfirmation/index.tsx:266-313What changes do you think we should make in order to solve the problem?
Bring back the old behavior: one recipient per multi-scan batch.
transactionslist intouseParticipantPickerState.handleParticipantsAdded, when there is more than one receipt, apply the new recipient and report to every receipt. Use the same loop the old participants step used.After this change, the To field shows the same recipient on every page, and Submit sends every receipt to that recipient. The submit loop needs no change.
What alternative solutions did you explore? (Optional)
Let each receipt keep its own recipient, as the issue's expected result describes. Submit would group receipts by recipient. Then it would find the report, policy, tags, tax, and rate for each group. The track, split, and distance submit hooks would need the same work. This is a much bigger change, and product should confirm they want it first.
Confidence and verification
High confidence in the mechanism. I traced it in code at
1708370dbut didn't reproduce it on a device.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/104236)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
melvin-bot commentedon Oct 16, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mkhutornyi (
External)[-]Scan expenses - Multiple scan expenses with different recipients all get added to the workspace of whichever one you tap Submit on[/-][+][$175] Scan expenses - Multiple scan expenses with different recipients all get added to the workspace of whichever one you tap Submit on[/+]melvin-bot commentedon Oct 16, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022111105442333625711
camesenin commentedon Oct 16, 2026
melvin-bot commentedon Oct 16, 2026
Details
janiya2 commentedon Oct 16, 2026
Contributor details
Your Expensify account email: janithad2@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/janithad
Proposal
Please re-state the problem that we are trying to solve in this issue.
When multiple scan expenses with different recipients (each belonging to a different workspace) are created in a multi-scan flow, tapping "Submit" on one of them adds all scan expenses to the single workspace/recipient of the tapped receipt, rather than routing each expense to its own individually assigned recipient/workspace.
What is the root cause of that problem?
There are two interconnected root causes across the multi-scan picker and submission pipeline:
In-place Participant Picker Scope (
useParticipantPickerState.ts):In
src/pages/iou/request/step/IOURequestStepConfirmation/useParticipantPickerState.ts(handleParticipantsAdded/ lines 190–202), when selecting a recipient in the confirmation step, the recipient and report are updated only for the currently active visible receipt (activeTransactionID). Consequently, individual receipts in the multi-scan batch hold different recipient and report IDs in memory.Submission Loop Re-uses a Single Context (
useRequestMoneySubmission.ts):In
src/pages/iou/request/step/confirmation/submission/useRequestMoneySubmission.ts(lines 163 and 189–266), the submission handler extracts the recipient from the currently active transaction context:During the loop (
transactions.forEach((transaction) => { ... })), it passes this singleparticipant, its parentreport,reportID, andpolicyto every transaction in the batch instead of inspecting each transaction's own assigned participant / report.(Note:
useTrackExpenseSubmission.ts:155-183shares the identical single-recipient loop).What changes do you think we should make in order to solve the problem?
We have two clean approaches depending on product requirements:
Approach 1 (Recommended — Matches Issue Expected Result):
Allow multi-scan expenses to route to their respective recipients by grouping transactions by recipient during submission:
src/pages/iou/request/step/confirmation/submission/useRequestMoneySubmission.ts, grouptransactionsby their respective targetreportIDorparticipant.accountID:Approach 2 (Batch Synchronization Alternative):
If product intends for a multi-scan batch to remain unified under a single recipient (similar to the pre-#100215 flow):
In
src/pages/iou/request/step/IOURequestStepConfirmation/useParticipantPickerState.ts:What alternative solutions did you explore? (Optional)
We explored keeping the submission loop as-is and warning the user with a modal if mixed recipients are detected in the carousel. However, Approach 1 is vastly superior because it respects the user's explicit per-receipt recipient selection without artificial constraints.
Tests
Automated Tests:
Add unit test in
tests/unit/IOURequestStepConfirmationTest.ts:tx1,tx2).Workspace Arecipient totx1andWorkspace Brecipient totx2.tx1callsrequestMoneytargetingreportAandtx2targetsreportB.Manual Verification:
melvin-bot commentedon Oct 16, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Metarenessans commentedon Oct 17, 2026
Contributor details
Your Expensify account email: metarenessans.job@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0126a1db3ee4419254
Proposal
Please re-state the problem that we are trying to solve in this issue.
In a multi-scan confirmation flow, when different recipients (or different workspaces) are assigned to individual scan receipts in the batch, tapping "Submit" attaches all expenses to the workspace/chat of whichever receipt is currently active on screen, instead of respecting each receipt's individually assigned recipient.
What is the root cause of that problem?
In
src/pages/iou/request/step/IOURequestStepConfirmation/useParticipantPickerState.ts(lines 191 & 203), when the user selects a recipient in the "To" picker, the selection is intentionally saved per-transaction to the currently visible receipt:Thus, each transaction in
transactionscorrectly stores its ownparticipantsandreportIDin Onyx.However, in
src/pages/iou/request/step/confirmation/submission/useRequestMoneySubmission.ts(lines 164–184):selectedParticipants.at(0)(which reflects the currently focused active transaction):optimisticChatReportIDonce for that single recipient.transactions(for (const item of transactions)), it reuses that sameparticipantandoptimisticChatReportIDacross every expense in the batch, completely ignoring each individual transaction's own assigneditem.participantsoritem.reportID:useTrackExpenseSubmission.ts(line 214).What changes do you think we should make in order to solve the problem?
Depending on Product's intended behavior for multi-scan:
Approach A (Recommended — Satisfies the Expected Result):
Allow multi-scan expenses to submit to their respective recipients:
src/pages/iou/request/step/confirmation/submission/useRequestMoneySubmission.ts:Inside
for (const item of transactions), use each item's individual participant:src/pages/iou/request/step/confirmation/submission/useTrackExpenseSubmission.ts:Apply the equivalent per-item participant lookup:
transactionsby recipient/target report before submitting, so expenses going to the same recipient/workspace batch into the same report, while expenses going to different workspaces create/attach to their respective reports.Approach B (Alternative — Uniform Batch Recipient):
If Product determines that a multi-scan batch must strictly share a single recipient (matching the legacy participant-step behavior):
src/pages/iou/request/step/IOURequestStepConfirmation/useParticipantPickerState.ts(handleParticipantsAdded), whentransactions.length > 1, iterate over alltransactionsand updateparticipantsandreportIDacross the entire batch instead of onlyactiveTransactionID:What alternative solutions did you explore? (Optional)
Looked into whether
IOURequestStepConfirmation/index.tsxshould group multi-scan transactions by workspace prior to rendering the confirmation step. Resolving the recipient during the submission loop is much cleaner and avoids disrupting the swipeable receipt carousel.camesenin commentedon Oct 17, 2026
21 remaining items
Kabeer099 commentedon Oct 29, 2026
mkhutornyi commentedon Oct 30, 2026
Contributor+ Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: feat: remove isNewManualExpenseFlowEnabled beta flag #100215 (comment)
Link to the comment on the Issue:
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Precondition:
Test:
Test 1: Changing To applies to every receipt
Test 2: Submit from a different receipt
Test 3: Category and tag reset on workspace change
Test 4: Individual recipient
Test 5: Self DM
Test 6: Single scan (regression test)
Do we agree 👍 or 👎
melvin-bot commentedon Nov 4, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Nov 4, 2026
Payment Summary
Resolving PRs:
Apply the selected recipient to every receipt in a multi-scan batch #105200
Reviewer: @mkhutornyi owed $175 via NewDot
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Nov 6, 2026
Payment Summary
Contributor+: @mkhutornyi due $175 via NewDot