From f0404e49fec787c6c9ceb33c7e0f125c6846b6da Mon Sep 17 00:00:00 2001 From: "Carlos Martins (via MelvinBot)" Date: Thu, 5 Mar 2026 00:55:06 +0000 Subject: [PATCH] Skip duplicate rule warning when editing the priority rule When editing a merchant rule that was created before another rule with the same merchant, the duplicate warning is no longer shown since the rule being edited already has priority. Co-authored-by: Carlos Martins --- .../rules/MerchantRules/MerchantRulePageBase.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/rules/MerchantRules/MerchantRulePageBase.tsx b/src/pages/workspace/rules/MerchantRules/MerchantRulePageBase.tsx index d7697f59d149..638aeac33a1f 100644 --- a/src/pages/workspace/rules/MerchantRules/MerchantRulePageBase.tsx +++ b/src/pages/workspace/rules/MerchantRules/MerchantRulePageBase.tsx @@ -210,7 +210,17 @@ function MerchantRulePageBase({policyID, ruleID, titleKey, testID}: MerchantRule const existingMerchant = rule.filters.right.toLowerCase(); const existingMatchType = rule.filters.operator ?? defaultMatchType; - return existingMerchant === normalizedMerchant && existingMatchType === currentMatchType; + if (existingMerchant !== normalizedMerchant || existingMatchType !== currentMatchType) { + return false; + } + + // When editing, if the rule being edited was created before the duplicate, + // the edited rule already has priority — no warning needed + if (isEditing && existingRule?.created && rule.created && existingRule.created <= rule.created) { + return false; + } + + return true; }); };