Skip to content

Commit

Permalink
Merge pull request #48422 from daledah/fix/47974
Browse files Browse the repository at this point in the history
fix: Description review appears when distance expenses are created without description
  • Loading branch information
pecanoro committed Sep 23, 2024
2 parents a5ca9b8 + 28a27ef commit 321e4bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/libs/TransactionUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ function compareDuplicateTransactionFields(transactionID: string): {keep: Partia

// Helper function to check if all comments are equal
function areAllCommentsEqual(items: Array<OnyxEntry<Transaction>>, firstTransaction: OnyxEntry<Transaction>) {
return items.every((item) => lodashIsEqual(item?.comment, firstTransaction?.comment));
return items.every((item) => lodashIsEqual(getDescription(item), getDescription(firstTransaction)));
}

// Helper function to check if all fields are equal for a given key
Expand All @@ -1007,8 +1007,7 @@ function compareDuplicateTransactionFields(transactionID: string): {keep: Partia

if (fieldName === 'description') {
const allCommentsAreEqual = areAllCommentsEqual(transactions, firstTransaction);
const allCommentsAreEmpty = isFirstTransactionCommentEmptyObject && transactions.every((item) => item?.comment === undefined);

const allCommentsAreEmpty = isFirstTransactionCommentEmptyObject && transactions.every((item) => getDescription(item) === '');
if (allCommentsAreEqual || allCommentsAreEmpty) {
keep[fieldName] = firstTransaction?.comment?.comment ?? firstTransaction?.comment;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/TransactionDuplicate/Confirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function Confirmation() {
ReportUtils.isReportNotFound(report) ||
(reviewDuplicatesResult.status === 'loaded' && (!transaction?.transactionID || !doesTransactionBelongToReport));

if (isLoadingOnyxValue(reviewDuplicatesResult, reportResult)) {
if (isLoadingOnyxValue(reviewDuplicatesResult, reportResult) || !transaction?.transactionID) {
return <FullScreenLoadingIndicator />;
}

Expand Down

0 comments on commit 321e4bb

Please sign in to comment.