Fix: System message incorrectly shows changed instead of set when adding merchant to expense#81929
Conversation
…ing merchant to expense
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2322731d27
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| const isNewCategoryMissing = isCategoryField && isCategoryMissing(newValue); | ||
|
|
||
| if (!oldValue || isOldValuePartialMerchant || isOldCategoryMissing) { | ||
| if (!oldValue || isOldMerchantInvalid || isOldCategoryMissing) { |
There was a problem hiding this comment.
Handle invalid-to-invalid merchant edits correctly
This change makes any edit with oldMerchant === DEFAULT_MERCHANT enter the set branch before we evaluate removals, so an update like oldMerchant: "Expense" to merchant: "(none)" (or empty) now renders as set the merchant to "(none)" instead of a removal/no-op. That path is reachable when an expense starts with the default merchant and the edited merchant value is saved as an invalid placeholder, and it produces an inverted system message for users. Consider requiring a valid new merchant before using the set branch (or handling invalid→invalid transitions separately).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I think we want to prevent saving Expense or (none) in the merchant input field for a DM expense, the same way we do for WS expenses
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppCleanShot.2026-02-13.at.13.07.16.4.mp4Android: mWeb ChromeCleanShot.2026-02-13.at.13.05.35.3.mp4iOS: HybridAppCleanShot.2026-02-13.at.13.08.50.6.mp4iOS: mWeb SafariCleanShot.2026-02-13.at.13.08.07.5.mp4MacOS: Chrome / SafariCleanShot.2026-02-13.at.13.04.23.2.mp4CleanShot.2026-02-13.at.13.03.03.1.mp4 |
JmillsExpensify
left a comment
There was a problem hiding this comment.
QA steps align with product spec.
|
@srikarparsi All yours. The bug report has been created as issue #82522. |
|
🚧 @srikarparsi 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! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/srikarparsi in version: 9.3.21-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.3.21-4 🚀
|
Explanation of Change
Use
isInvalidMerchantValueto check if the old merchant is invalid, ensuring the system message correctly displays "set" instead of "changed" when adding a merchant to an expense that had the default merchant value.Fixed Issues
$ #81616
PROPOSAL: #81616 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand 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
Android-Native.mp4
Android: mWeb Chrome
Android-mWeb.Chrome.mp4
iOS: Native
iOS-Native.mp4
iOS: mWeb Safari
iOS-mWeb.Safari.mp4
MacOS: Chrome / Safari
MacOS-Chrome.mp4