From 528d544a0b7f886c5c96269567b971298ed9e22b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Ch=C3=A1vez?= Date: Wed, 30 Oct 2024 16:04:46 -0600 Subject: [PATCH 1/2] Update transaction violations when the money request is paid --- src/libs/actions/IOU.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 7ce9b9dfb272..27bce6a61a7e 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -6956,6 +6956,26 @@ function getPayMoneyRequestParams( }, }); } + + const optimisticTransactionViolations: OnyxUpdate[] = reportTransactions.map(({transactionID}) => { + const violations = allTransactionViolations[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`] ?? []; + return { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`, + value: null, + }; + }); + optimisticData.push(...optimisticTransactionViolations); + + const failureTransactionViolations: OnyxUpdate[] = reportTransactions.map(({transactionID}) => { + const violations = allTransactionViolations[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`] ?? []; + return { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`, + value: violations, + }; + }); + failureData.push(...failureTransactionViolations); } let optimisticHoldReportID; From 234327d88fddb3801addf036ce02c52eb3527192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Ch=C3=A1vez?= Date: Wed, 30 Oct 2024 21:45:23 -0600 Subject: [PATCH 2/2] Remove unused value --- src/libs/actions/IOU.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 27bce6a61a7e..1f8464c47748 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -6958,7 +6958,6 @@ function getPayMoneyRequestParams( } const optimisticTransactionViolations: OnyxUpdate[] = reportTransactions.map(({transactionID}) => { - const violations = allTransactionViolations[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`] ?? []; return { onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`,