Skip duplicate rule warning when editing the priority rule#84224
Skip duplicate rule warning when editing the priority rule#84224
Conversation
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 <luacmartins@users.noreply.github.com>
|
@linhvovan29546 @luacmartins One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@luacmartins This PR already has |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-03-05.at.11.31.41.AM.movoffline: Screen.Recording.2026-03-05.at.11.30.19.AM.mov |
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
🚧 @JS00001 has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/JS00001 in version: 9.3.32-0 🚀
|
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.3.32-3 🚀
|
Explanation of Change
When editing a merchant rule that was created before another rule with the same merchant name, the
checkForDuplicateRulefunction inMerchantRulePageBase.tsxwould incorrectly trigger the "Similar merchant rule already exists" warning. The warning says "Your existing rule will take priority over this one", but when editing the original/first rule, that rule IS the one with priority — making the message confusing and incorrect.This PR makes
checkForDuplicateRulepriority-aware by comparing thecreatedtimestamps. If the rule being edited was created before (or at the same time as) the duplicate, the warning is skipped since the edited rule already has priority. The warning still correctly appears when editing or creating a newer/lower-priority rule.Fixed Issues
$ #84210
PROPOSAL: #84210 (comment)
Tests
Offline tests
This change is in the duplicate-detection logic which runs client-side before any API call. No network dependency.
QA Steps
Same as tests above.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/A — logic-only change, no UI modifications
Android: mWeb Chrome
N/A — logic-only change, no UI modifications
iOS: Native
N/A — logic-only change, no UI modifications
iOS: mWeb Safari
N/A — logic-only change, no UI modifications
MacOS: Chrome / Safari
Tested via Playwright browser automation on Chrome. Verified: