-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 changes after refresh although URL has currency params #23636
Conversation
@rushatgabhane 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] |
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
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.
@makiour please add the checklist again, and complete it.
All PRs should have the checklist and screenshots for all platforms.
For native, you can use a command like
npx uri-scheme open new-expensify://request/new/123?currency=MDL --android
npx uri-scheme open new-expensify://request/new/123?currency=MDL --ios
@makiour please add the checklist in the PR body. Or it'll fail a checklist workflow. |
@rushatgabhane Thank you for your feedback! I have added video tests for all platforms, added the checklist to the body as well! |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-08-02.at.03.31.36.movMobile Web - ChromeWhatsApp.Video.2023-08-02.at.03.29.01.mp4Mobile Web - SafariScreen.Recording.2023-08-02.at.03.25.48.movDesktopScreen.Recording.2023-08-02.at.03.35.03.moviOSScreen.Recording.2023-08-02.at.03.21.57.movAndroidScreen.Recording.2023-08-02.at.03.22.30.mov |
Hey @rushatgabhane, is everything looking okay for you? If yes, can we proceed to merge the branch within the 3 days if that is possible? Also, I have updated the PR Author checklist as I have added the wrong one before. Now, everything is as intended. Thank you so much for your cooperation! |
yes all is good, i just need to complete the checklist after I reach home :) |
Amazing, thank you @rushatgabhane! The 3 days limit is 29th July at 1 PM(GMT+1), I will be very thankful if you manage to finish them before that! |
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.
@makiour i found a bug - app crash when navigating to /request/new
- Run iOS app
- Run
npx uri-scheme open new-expensify://request/new --ios
Platform iOS
@rushatgabhane Thank you for the review and comments. It seems that the issue you found has nothing to do with my branch. It is actually happening even in the main branch. Here is an illustration: Main branch: Untitled.mp4Concerning my fix, it works all fine for the correct URL with a selected currency. |
It also happens with normal request money process through the simulator on the main branch. |
@makiour okay, thanks for confirming |
@rushatgabhane Amazing, let me know of anything else |
@makiour i know that it's an unrelated bug, but it's preventing testing on iOS. Can we fix this? Screen.Recording.2023-08-01.at.15.52.34.mov |
@rushatgabhane |
@rushatgabhane It is completely a new bug. Here is what I found: IssueBasically, the app crashes when we try to open the IOU Request route in the app. It is spotted first on IOS and then I found that it also happens at the level of all other platforms. CauseAfter investigating, the bug only happens when we Sign-in. Basically, the currency set for the profile isn't fetched yet or isn't ready to use through the "request/new" URL immediately. Thus, whenever we open it the first time, we get it as undefined. However, if we go through the normal flow, of clicking on Request Money, the currency then is fetched as ONYX has correctly subscribed and set the IOU.currency from profile details that are fetched: Untitled.1.mp4What causing the issue is that the following hook executes and changes the selectedCurrency to undefined: App/src/pages/iou/steps/MoneyRequestAmountPage.js Lines 286 to 288 in 5034433
Thus, these functions, which are called from the child component: "TextInputWithCurrencySymbol", throw an exception: Lines 51 to 73 in 5034433
SolutionThe fix to this bug, including my current solution, is just to add a small checking here. Basically, a constant USD is already set initially in the props: App/src/pages/iou/steps/MoneyRequestAmountPage.js Lines 59 to 72 in 5034433
However we need to make sure to not assign directly to props.IOU.currency in the useEffect as it is undefined at the first time. To handle this we can just add a condition statement here in my changes: App/src/pages/iou/steps/MoneyRequestAmountPage.js Lines 278 to 284 in 0176b1f
to:
The following commit includes this fix! |
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! 🚀
@MariaHCD because it was preventing testing, we fixed an additional bug in this PR too - #23636 (comment)
Thank you so much @rushatgabhane for your cooperation! The new bug did not allow us to land our changes quickly as we wanted to add all the issues, and so happy to work on both of them! |
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.
Nice work, thanks!
✋ 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/MariaHCD in version: 1.3.50-0 🚀
|
okayy, the url has changed. we added manual and scan request |
@makiour wanna investigate what happened here?
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.50-3 🚀
|
@rushatgabhane @puneetlath I tried to check the new flow, but creating an account, and testing request money in staging hasn't changed. Here is a video showing the changes working all fine in staging! Screencast.from.07.2023.+01.07.38.27.webm |
🚀 Deployed to staging by https://github.com/MariaHCD in version: 1.3.51-0 🚀
|
@makiour oh you must not be on the beta. Thanks for looking into this, I'll investigate it further |
Alright, i found the PR := While adding scan receipt feature, we refactored money request page and didn't take into account the query params. cc: @s77rt (c+) |
I'm not sure about the bug here (I can set the currency in url w/wo beta). Regardless, I think we should not worry about the currency for now. The currency selection should not have its own route (and no query params). Instead we'd render the currency modal in the amount form and just pass the currency selection through a callback (same way done for year picker, state picker and country picker). However I don't know if we have an issue for that or when we are going to work on that. |
@s77rt Thank you for your comment. You are not seeing the bug now as it is fixed without beta in staging and production. Refer to the following issue and video to check it before the fix: #23436 (comment) |
Also, this is not happening now: after refactoring and adding scan feature, the currency selection is now under the new flow for no beta users as well. You can pull the branch before this one and check the video for the previous bug. A small comment here, I am not sure if it is a bug but I might consider it as UI/UX inconsistency. If we set a currency through the URL: It shows that the currency is already selected, so going back should not remove the selection, however, it does and goes back to the previous currency. What do you think @s77rt @rushatgabhane? |
🚀 Deployed to production by https://github.com/Julesssss in version: 1.3.51-2 🚀
|
Details
Changing the MoneyRequestAmountPage to check currency URL param. Thus, after refresh, the currency selected will not change.
Fixed Issues
$ #23436
PROPOSAL: #23436 (comment)
Tests
QA Steps
Same as test.
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
fixCurrencyBug.webm
Mobile Web - Chrome
WhatsApp.Video.2023-07-27.at.12.01.45.mp4
Mobile Web - Safari
WhatsApp.Video.2023-07-27.at.12.01.44.mp4
Desktop
desktopFix.webm
iOS
Screen.Recording.2023-07-27.at.9.48.42.PM.mov
Android
androidFix.webm