fix: After clearing merchant and saving it, Merchant field reverts to previous value #63587#64761
fix: After clearing merchant and saving it, Merchant field reverts to previous value #63587#64761pecanoro merged 3 commits intoExpensify:mainfrom
Conversation
|
@mananjadhav Please 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] |
|
I noticed there is a bug in my solution: if the merchant is not empty when created, the I have a few ideas on how to fix this issue, specifically to distinguish between an initially empty merchant and one that was intentionally cleared. I plan to write and implement these improvements tomorrow morning. |
|
I've updated the implementation to address both core issues:
Solution SummaryTo solve both, I introduced a
Key Changes
Result
The implementation is complete and ready for review. Let me know if you want me to walk through the logic or decisions — happy to explain. |
|
I'll review this today/tomorrow. |
| inserted?: string; | ||
|
|
||
| /** Whether the merchant field was intentionally cleared by the user */ | ||
| wasMerchantCleared?: boolean; |
There was a problem hiding this comment.
I am still not sure if this is the right approach to add a flag. I'll check if this is an acceptable pattern.
There was a problem hiding this comment.
I agree it's worth checking. I considered alternatives:
- Using null/undefined distinction - but since the API always returns empty strings "", we lose the ability to distinguish between "never touched" and "intentionally cleared" after the first API response
- Storing meta-information within the field itself - but this would pollute the actual data
The flag seems like the cleanest solution given the API constraints. But if there's an established pattern in the codebase for similar cases, I'm happy to use that approach instead.
There was a problem hiding this comment.
@mananjadhav I pinged you here. If no one has any other suggestions, we should move forward with the solution
There was a problem hiding this comment.
I agree this is not the right solution. It's caused a few bugs now and we'd also need to keep search data in sync
|
Sorry for the delay! I was on vacation! |
mananjadhav
left a comment
There was a problem hiding this comment.
Reviewed the code changes. Testing it out.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb Chromemweb-chrome-merchant-clear.moviOS: HybridAppios-merchant-clear.moviOS: mWeb Safarimweb-safari-merchant-clear.movMacOS: Chrome / Safariweb-merchant-clear.movMacOS: Desktopdesktop-merchant-clear.mov |
mananjadhav
left a comment
There was a problem hiding this comment.
Spent a few hours to fix my android build but it didn't work. But I've tested in all platforms. Approving this one.
|
✋ 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/pecanoro in version: 9.1.80-0 🚀
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.1.80-8 🚀
|
Explanation of Change
Fixed Issues
$ #63587
PROPOSAL: #63587 (comment)
Tests
Offline tests
Same
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))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.mp4
iOS: Native
ios_native.mp4
iOS: mWeb Safari
ios_mweb.mp4
MacOS: Chrome / Safari
macos_safari.mp4
MacOS: Desktop
macos_desktop.mp4