Skip to content

Commit 61eb7d4

Browse files
committed
fix: return early if violation is smart scan failed
1 parent ca308ca commit 61eb7d4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/libs/Violations/ViolationsUtils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,11 @@ const ViolationsUtils = {
242242
const shouldShowSmartScanFailedError = !isScanning && isScanRequest && isPartialTransaction;
243243
const hasSmartScanFailedError = transactionViolations.some((violation) => violation.name === CONST.VIOLATIONS.SMARTSCAN_FAILED);
244244
if (shouldShowSmartScanFailedError && !hasSmartScanFailedError) {
245-
newTransactionViolations.push({name: CONST.VIOLATIONS.SMARTSCAN_FAILED, type: CONST.VIOLATION_TYPES.WARNING, showInReview: true});
245+
return {
246+
onyxMethod: Onyx.METHOD.SET,
247+
key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${updatedTransaction.transactionID}`,
248+
value: {name: CONST.VIOLATIONS.SMARTSCAN_FAILED, type: CONST.VIOLATION_TYPES.WARNING, showInReview: true},
249+
};
246250
}
247251
if (!shouldShowSmartScanFailedError && hasSmartScanFailedError) {
248252
newTransactionViolations = reject(newTransactionViolations, {name: CONST.VIOLATIONS.SMARTSCAN_FAILED});

0 commit comments

Comments
 (0)