Skip to content

Commit 46278af

Browse files
authored
Merge pull request Expensify#65624 from nkdengineer/fix/64980
Multi scan send button doesn't register the first tap
2 parents 15e4323 + 2d492ca commit 46278af

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

src/libs/actions/IOU.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11225,6 +11225,18 @@ function updateLastLocationPermissionPrompt() {
1122511225
Onyx.set(ONYXKEYS.NVP_LAST_LOCATION_PERMISSION_PROMPT, new Date().toISOString());
1122611226
}
1122711227

11228+
function setMultipleMoneyRequestParticipantsFromReport(transactionIDs: string[], reportValue: OnyxEntry<OnyxTypes.Report>) {
11229+
const participants = getMoneyRequestParticipantsFromReport(reportValue);
11230+
const updatedTransactions: Record<`${typeof ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${string}`, NullishDeep<OnyxTypes.Transaction>> = {};
11231+
transactionIDs.forEach((transactionID) => {
11232+
updatedTransactions[`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`] = {
11233+
participants,
11234+
participantsAutoAssigned: true,
11235+
};
11236+
});
11237+
return Onyx.mergeCollection(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, updatedTransactions);
11238+
}
11239+
1122811240
/** Instead of merging the duplicates, it updates the transaction we want to keep and puts the others on hold without deleting them */
1122911241
function resolveDuplicates(params: MergeDuplicatesParams) {
1123011242
if (!params.transactionID) {
@@ -11925,6 +11937,7 @@ export {
1192511937
setMoneyRequestParticipantsFromReport,
1192611938
getMoneyRequestParticipantsFromReport,
1192711939
setMoneyRequestPendingFields,
11940+
setMultipleMoneyRequestParticipantsFromReport,
1192811941
setMoneyRequestReceipt,
1192911942
setMoneyRequestTag,
1193011943
setMoneyRequestTaxAmount,

src/pages/iou/request/step/IOURequestStepScan/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import {
6161
setMoneyRequestParticipants,
6262
setMoneyRequestParticipantsFromReport,
6363
setMoneyRequestReceipt,
64+
setMultipleMoneyRequestParticipantsFromReport,
6465
startSplitBill,
6566
trackExpense,
6667
updateLastLocationPermissionPrompt,
@@ -499,9 +500,8 @@ function IOURequestStepScan({
499500
createTransaction(files, participant);
500501
return;
501502
}
502-
503-
const setParticipantsPromises = files.map((receiptFile) => setMoneyRequestParticipantsFromReport(receiptFile.transactionID, report));
504-
Promise.all(setParticipantsPromises).then(() => navigateToConfirmationPage());
503+
const transactionIDs = files.map((receiptFile) => receiptFile.transactionID);
504+
setMultipleMoneyRequestParticipantsFromReport(transactionIDs, report).then(() => navigateToConfirmationPage());
505505
return;
506506
}
507507

0 commit comments

Comments
 (0)