Skip to content

Commit 08cb899

Browse files
committed
Fix - Double violation briefly visible when removing a disabled category from report
1 parent f34c0e3 commit 08cb899

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/libs/actions/IOU.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4660,10 +4660,15 @@ function getUpdateMoneyRequestParams(params: GetUpdateMoneyRequestParamsType): U
46604660
) {
46614661
const currentTransactionViolations = allTransactionViolations[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`] ?? [];
46624662
// If the amount, currency or date have been modified, we remove the duplicate violations since they would be out of date as the transaction has changed
4663-
const optimisticViolations =
4663+
let optimisticViolations =
46644664
hasModifiedAmount || hasModifiedDate || hasModifiedCurrency
46654665
? currentTransactionViolations.filter((violation) => violation.name !== CONST.VIOLATIONS.DUPLICATED_TRANSACTION)
46664666
: currentTransactionViolations;
4667+
optimisticViolations =
4668+
hasModifiedCategory && transactionChanges.category === ''
4669+
? optimisticViolations.filter((violation) => violation.name !== CONST.VIOLATIONS.CATEGORY_OUT_OF_POLICY)
4670+
: optimisticViolations;
4671+
46674672
const violationsOnyxData = ViolationsUtils.getViolationsOnyxData(
46684673
updatedTransaction,
46694674
optimisticViolations,

0 commit comments

Comments
 (0)