-
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
[HOLD for payment 2023-08-14] [$1000] Currency changes after refresh although URL has currency params #23436
Comments
Triggered auto assignment to @sophiepintoraetz ( |
Bug0 Triage Checklist (Main S/O)
|
ProposalPlease re-state the problem that we are trying to solve in this issue.The issue here is that we are not keeping the currency selected although we have it in the link parameters What is the root cause of that problem?After investigating, there are two main parameters that we need to know when opening money request page:
What changes do you think we should make in order to solve the problem?Option 1:We can just add a condition inside the useEffect to check if we have currency params within the URL, if this is the case, we return: App/src/pages/iou/steps/MoneyRequestAmountPage.js Lines 286 to 288 in b7d17e0
We can add if (props.route.params.currency) { return; } before setSelectedCurrencyCode(props.iou.currency); To be like that: useEffect(() => { if (props.route.params.currency) { return; } setSelectedCurrencyCode(props.iou.currency); }, [props.iou.currency]); Option 2: Simpler and PreferredSince we understand the logic in which the currency changes, and since we know that useEffect hooks are run according to the order they have been put within the React component, the simplest solution here is to just switch the useEffects and put the second one first in the following way:
|
It is the one shared by kavimuru, but with result and better format. Thank you! ProposalPlease re-state the problem that we are trying to solve in this issue.The issue here is that we are not keeping the currency selected although we have it in the link parameters What is the root cause of that problem?After investigating, there are two main parameters that we need to know when opening money request page:
App/src/pages/iou/steps/MoneyRequestAmountPage.js Lines 41 to 45 in b7d17e0
App/src/pages/iou/steps/MoneyRequestAmountPage.js Lines 494 to 495 in b7d17e0
The root cause here is that we are handling selected currency change when it occurs to IOU.currency. So, we are keeping track of the selected currency if it has changed. That's good. However, it always changes the selectedCurrency whenever it has changed even after receiving it through data. To be more clear here,The following useEffect are handling the logic of setting the currency: App/src/pages/iou/steps/MoneyRequestAmountPage.js Lines 277 to 289 in b7d17e0
As we can see the first useEffect is handling it correctly and changing the currency when we send it through URL params. What changes do you think we should make in order to solve the problem?Option 1:We can just add a condition inside the useEffect to check if we have currency params within the URL, if this is the case, we return: App/src/pages/iou/steps/MoneyRequestAmountPage.js Lines 286 to 288 in b7d17e0
We can add
before To be like that:
Option 2: Simpler and PreferredSince we understand the logic in which the currency changes, and since we know that useEffect hooks are run according to the order they have been put within the React component, the simplest solution here is to just switch the useEffects and put the second one first in the following way:
ResultbugCurrency.webm |
Job added to Upwork: https://www.upwork.com/jobs/~01b122db1f8bca0f1d |
Current assignee @sophiepintoraetz is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane ( |
I like @makiour's proposal - option 1 because it's more clear. I don't like option 2 to change the order of useEffects because it's really easy to forget the fact that order of useEffect matters and someone can cause this bug if they are refactoring the component. Further, I think we can combine both the useEffect(() => {
if (props.route.params.currency) {
setSelectedCurrencyCode(props.route.params.currency);
return;
}
setSelectedCurrencyCode(props.iou.currency);
}, [props.route.params.currency, props.iou.currency]); P.S. I'm a noob in hooks. Please let me know if combining hooks will cause any bugs, thanks 🙇 |
C+ reviewed 🎀 👀 🎀 |
Triggered auto assignment to @MariaHCD, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Amazing feedback, thank for your comment. I preferred the second for its simplicity, but totally agree with the point of refactoring. We could add a comment, but would not be enough to keep developers attentive. Happy to proceed and submit a PR whenevr you want. |
The proposal looks good to me too. |
📣 @rushatgabhane Please request via NewDot manual requests for the Reviewer role ($1000) |
📣 @makiour You have been assigned to this job! |
📣 @makiour We're missing your Upwork ID to automatically send you an offer for the Reporter role. |
@rushatgabhane PR is ready for review! Thank you all. |
Great! Once @MariaHCD has reviewed the PR we can wait for the regression period before releasing payments. |
Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:
On to the next one 🚀 |
@sophiepintoraetz so we fixed an additional bug that we encountered while testing. We fixed it in the same PR because it blocked testing of this issue. Please confirm if you agree that we should pay an additional bounty of $1k bug report: https://expensify.slack.com/archives/C049HHMV9SM/p1690926235865309 |
Thank you everyone for your cooperation in solving this issue. Also, here is my proposal: https://www.upwork.com/ab/proposals/1684162045300506625, as I haven't received an offer yet in upwork as my upworkID was missing. Thank you everyone! |
@makiour - I appreciate the case and the discretionary effort, I think the bonus payment is effectively captured in the fact that you are being paid for two bug reports - so it did take you a bit longer but I think you are being well compensated for it! Payouts due (once the regression period passes):
Following payments doubled for fixing two bugs inside this one issue:
Eligible for 50% #urgency bonus? N |
I appreciate your time and clarifications Sophie! Thank you so much for your support. |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.50-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2023-08-14. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
Payouts due today! Issue Reporter: $250 @makiour Contributor: $2000 @makiour (total $2250) - edit - PAID |
|
created a manual request here - https://staging.new.expensify.com/r/8223080099023677 |
Reviewed the details for @rushatgabhane. Approved for payment in NewDot based on the BZ summary above. |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
Currency should be the one in the URL currency parms.
Actual Result:
It changes to the default currency
Workaround:
Can the user still use Expensify without this being fixed? Have you informed them of the workaround?
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.44-0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
bugCurrency-vid.webm
Recording.1323.mp4
Expensify/Expensify Issue URL:
Issue reported by: @makiour
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690050379038969
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: