-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fix currency selection is saved even though we don't press Save yet #18995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix currency selection is saved even though we don't press Save yet #18995
Conversation
…he previous page instead
|
@arosiclair @Santhosh-Sellavel 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] |
|
Sorry for taking it long. I was trying to make sure to cover edge cases.
When we refresh the page, the navigation stack history will be lost. So, when we go to the currency list, we have this stack: If we refresh the page, the stack becomes When we select a currency, instead of going back, it will push the MoneyRequestModal to the stack. However, I will show first the video of the issue if we get the selected currency on component mount too. Screen.Recording.2023-05-16.at.16.41.55.movNotice that the currency looks like it is "saved" in the amount page. How can that happen?
This can happen because all money request step is in the same screen/page. The selected currency from IOU currency list is "shared" to all steps. One way we can solve this is to separate each step to each stack screen, so all of them has their own path. I have an open PR for that, but currently we are waiting for some confirmation before continuing it. Let me know if there is anything confusing 😄. |
|
Hmm, the lint failed because there is a prettier dif, so I run |
|
prettier diff comes from this PR #18865 |
arosiclair
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good thanks for the changes
|
@bernhardoj App gets crashed while trying to open Currency selection page Screen.Recording.2023-05-19.at.1.57.30.AM.movcc: @arosiclair |
| return _.map(this.props.currencyList, (currencyInfo, currencyCode) => { | ||
| const isSelectedCurrency = currencyCode === this.props.iou.selectedCurrencyCode; | ||
| const isSelectedCurrency = currencyCode === this.state.selectedCurrencyCode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The crash occurs here. This methodgetCurrencyOptions is called while initializing the state and trying to access the state.selectedCurrencyCode while it's not defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, my bad. I didn't retest after moving the selected currency code to a state. So, I guess we have 2 options:
- Take it out from the state and just put it back in a static variable
- Update
getCurrencyOptionsto acceptselectedCurrencyCode.
I personally prefer the first one as it's a static value. What do you think? @Santhosh-Sellavel @arosiclair
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After looking closer I think we should replace selectedCurrencyCode with a getSelectedCurrencyCode function instead. We can use that function in getCurrencyOptions() and render(). That should fix this while keeping everything reactive to prop changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a nice idea. Updated and test well. Thanks for the help!
Reviewer Checklist
Screenshots/VideosWeb & DesktopScreen.Recording.2023-05-20.at.1.13.11.AM.movMobile Web - Chrome & Mobile Web - SafariScreen.Recording.2023-05-20.at.1.07.18.AM.moviOS & AndroidScreen.Recording.2023-05-20.at.1.11.27.AM.mov |
Santhosh-Sellavel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM tests well!
All yours @arosiclair
|
✋ 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/arosiclair in version: 1.3.17-0 🚀
|
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.17-5 🚀
|
|
Came across this PR and had some general feedback. I have some doubts about passing the currency in the route params with the "backTo". And wonder if it's the best way to achieve what we are trying to do. Another way this could work is something like:
I'm not too sure what would go into setting things up to work that way and there are probably even better solutions - just something to think about! |
Details
When we select a currency from the currency list selection, it will immediately saved it to the onyx. We want to change it so the currency is only saved when the user press Save.
Fixed Issues
$ #18667
PROPOSAL: #18667 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)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
Web
Screen.Recording.2023-05-16.at.15.02.34.mov
Mobile Web - Chrome
WhatsApp.Video.2023-05-16.at.15.27.42.mp4
Mobile Web - Safari
Screen.Recording.2023-05-16.at.15.10.33.mov
Desktop
Screen.Recording.2023-05-16.at.15.04.08.mov
iOS
Screen.Recording.2023-05-16.at.15.11.24.mov
Android
Screen.Recording.2023-05-16.at.15.11.24.mov