From 907d57af3449d137ed13725c8d9841a7321eedc5 Mon Sep 17 00:00:00 2001 From: daledah Date: Thu, 15 Aug 2024 11:06:50 +0700 Subject: [PATCH 1/7] fix: remove settled transactions from duplicates --- .../MoneyRequestPreview/MoneyRequestPreviewContent.tsx | 10 ++++++---- src/libs/ReportUtils.ts | 5 +++++ src/libs/TransactionUtils/index.ts | 5 +++-- src/pages/TransactionDuplicate/Review.tsx | 4 ++++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx index 8597654576fc..df463acc12c9 100644 --- a/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx @@ -125,9 +125,11 @@ function MoneyRequestPreviewContent({ // Get transaction violations for given transaction id from onyx, find duplicated transactions violations and get duplicates const duplicates = useMemo( () => - transactionViolations?.[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transaction?.transactionID}`]?.find( - (violation) => violation.name === CONST.VIOLATIONS.DUPLICATED_TRANSACTION, - )?.data?.duplicates ?? [], + ReportUtils.removeSettledTransactions( + transactionViolations?.[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transaction?.transactionID}`]?.find( + (violation) => violation.name === CONST.VIOLATIONS.DUPLICATED_TRANSACTION, + )?.data?.duplicates ?? [], + ), [transaction?.transactionID, transactionViolations], ); @@ -438,7 +440,7 @@ function MoneyRequestPreviewContent({ ]} > {childContainer} - {isReviewDuplicateTransactionPage && ( + {isReviewDuplicateTransactionPage && !isSettled && (