-
Notifications
You must be signed in to change notification settings - Fork 3k
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
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 |
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
getCurrencyOptions
to 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 |
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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