diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index e16ab39daf5c..2660ae9ca8f6 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -8348,9 +8348,30 @@ function resolveDuplicates(params: TransactionMergeParams) { const optimisticHoldActions: OnyxUpdate[] = []; const failureHoldActions: OnyxUpdate[] = []; const reportActionIDList: string[] = []; + const optimisticHoldTransactionActions: OnyxUpdate[] = []; + const failureHoldTransactionActions: OnyxUpdate[] = []; transactionThreadReportIDList.forEach((transactionThreadReportID) => { const createdReportAction = ReportUtils.buildOptimisticHoldReportAction(); reportActionIDList.push(createdReportAction.reportActionID); + const transactionID = TransactionUtils.getTransactionID(transactionThreadReportID ?? '-1'); + optimisticHoldTransactionActions.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, + value: { + comment: { + hold: createdReportAction.reportActionID, + }, + }, + }); + failureHoldTransactionActions.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, + value: { + comment: { + hold: null, + }, + }, + }); optimisticHoldActions.push({ onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`, @@ -8394,8 +8415,8 @@ function resolveDuplicates(params: TransactionMergeParams) { const optimisticData: OnyxUpdate[] = []; const failureData: OnyxUpdate[] = []; - optimisticData.push(optimisticTransactionData, ...optimisticTransactionViolations, ...optimisticHoldActions, optimisticReportActionData); - failureData.push(failureTransactionData, ...failureTransactionViolations, ...failureHoldActions, failureReportActionData); + optimisticData.push(optimisticTransactionData, ...optimisticTransactionViolations, ...optimisticHoldActions, ...optimisticHoldTransactionActions, optimisticReportActionData); + failureData.push(failureTransactionData, ...failureTransactionViolations, ...failureHoldActions, ...failureHoldTransactionActions, failureReportActionData); const {reportID, transactionIDList, receiptID, ...otherParams} = params; const parameters: ResolveDuplicatesParams = {