Skip to content

Commit ddf9e7a

Browse files
authored
Merge pull request Expensify#84224 from Expensify/claude-fixDuplicateRuleWarningForOriginalRule
Skip duplicate rule warning when editing the priority rule
2 parents 8575dc0 + f0404e4 commit ddf9e7a

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/pages/workspace/rules/MerchantRules/MerchantRulePageBase.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,17 @@ function MerchantRulePageBase({policyID, ruleID, titleKey, testID}: MerchantRule
210210
const existingMerchant = rule.filters.right.toLowerCase();
211211
const existingMatchType = rule.filters.operator ?? defaultMatchType;
212212

213-
return existingMerchant === normalizedMerchant && existingMatchType === currentMatchType;
213+
if (existingMerchant !== normalizedMerchant || existingMatchType !== currentMatchType) {
214+
return false;
215+
}
216+
217+
// When editing, if the rule being edited was created before the duplicate,
218+
// the edited rule already has priority — no warning needed
219+
if (isEditing && existingRule?.created && rule.created && existingRule.created <= rule.created) {
220+
return false;
221+
}
222+
223+
return true;
214224
});
215225
};
216226

0 commit comments

Comments
 (0)