Skip to content

Commit 29d8bc8

Browse files
committed
handle transactionViolations updated to undefined
1 parent 70701ef commit 29d8bc8

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/libs/actions/OnyxDerived/configs/reportTransactionsAndViolations.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,13 @@ export default createOnyxDerivedValueConfig({
6161
const violationKey = `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`;
6262
const previousTransactionViolations = previousViolations?.[violationKey];
6363

64+
const violationInSourceValues = transactionViolationsUpdates?.[violationKey];
65+
6466
// If violations exist and have length > 0, add them to the structure
6567
if (transactionViolations && transactionViolations.length > 0) {
6668
reportTransactionsAndViolations[reportID].violations[violationKey] = transactionViolations;
67-
} else if (previousTransactionViolations && previousTransactionViolations.length > 0) {
68-
// If violations were removed (previous had violations but current doesn't), remove them from the structure
69+
} else if (violationInSourceValues === undefined || (previousTransactionViolations && previousTransactionViolations.length > 0)) {
70+
// If violations were removed (previous had violations but current doesn't) or explicitly set to undefined, remove them from the structure
6971
delete reportTransactionsAndViolations[reportID].violations[violationKey];
7072
}
7173

0 commit comments

Comments
 (0)