You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2023-08-14] [$1000] Currency changes after refresh although URL has currency params #23436
Change currency and notice it has changed in the URL
Copy the URL and open it somewhere or just refresh
The currency param is there in the URL but changed
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?
Android / native
Android / Chrome
iOS / native
iOS / Safari
MacOS / Chrome / Safari
MacOS / Desktop
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
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:
As we can see the first useEffect is handling it correctly and changing the currency when we send it through URL params.
However, in the other case, in the second useEffect, we don't handle this, which causes the selectedCurrency to always change
to IOU.currency especially that at first it is initalized to constant.
We need to handle this in here.
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:
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 Preferred
Since 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:
useEffect(() => {
setSelectedCurrencyCode(props.iou.currency);
}, [props.iou.currency]);
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:
As we can see the first useEffect is handling it correctly and changing the currency when we send it through URL params.
However, in the other case, in the second useEffect, we don't handle this, which causes the selectedCurrency to always change
to IOU.currency especially that at first it is initalized to constant.We need to handle this in here.
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:
Since 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:
changed the title [-]Currency changes after refresh although URL has currency params [/-][+][$1000] Currency changes after refresh although URL has currency params [/+]on Jul 25, 2023
@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!
changed the title [-][$1000] Currency changes after refresh although URL has currency params [/-][+][HOLD for payment 2023-08-14] [$1000] Currency changes after refresh although URL has currency params [/+]on Aug 7, 2023
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.
External issue reporter
Contributor that fixed the issue
Contributor+ that helped on the issue and/or PR
For reference, here are some details about the assignees on this issue:
@rushatgabhanedoes not require payment (Eligable for Manual Requests)
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:
[@rushatgabhane] The PR that introduced the bug has been identified. Link to the PR:
[@rushatgabhane] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
[@rushatgabhane] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
[@rushatgabhane] Determine if we should create a regression test for this bug.
[@rushatgabhane] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
[@sophiepintoraetz] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
Issue Reporter: $250 @makiour
Following payments doubled for fixing two bugs inside this one issue:
Contributor: $2000 @makiour (total $2250) - edit - PAID
Contributor+: $2000 @rushatgabhane (once the checklist has been completed)
Eligible for 50% #urgency bonus? N
A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: Missed edge case by PR author and reviewer.
Determine if we should create a regression test for this bug. Sure!
If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again
Open a chat in the app
Open the request money tab
Change the currency and notice it has changed in the URL
Activity
melvin-bot commentedon Jul 23, 2023
Triggered auto assignment to @sophiepintoraetz (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jul 23, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)kavimuru commentedon Jul 23, 2023
Proposal
Please 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
We need to keep the selected currency.
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
Line 181 in b7d17e0
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.
However, in the other case, in the second useEffect, we don't handle this, which causes the selectedCurrency to always change
to IOU.currency especially that at first it is initalized to constant.
We need to handle this in here.
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 Preferred
Since 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:
useEffect(() => {
setSelectedCurrencyCode(props.iou.currency);
}, [props.iou.currency]);
makiour commentedon Jul 23, 2023
It is the one shared by kavimuru, but with result and better format. Thank you!
Proposal
Please 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
We need to keep the selected currency.
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
Line 181 in b7d17e0
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.
However, in the other case, in the second useEffect, we don't handle this, which causes the selectedCurrency to always change
to IOU.currency especially that at first it is initalized to constant.We need to handle this in here.
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
setSelectedCurrencyCode(props.iou.currency);To be like that:
Option 2: Simpler and Preferred
Since 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:
Result
bugCurrency.webm
sophiepintoraetz commentedon Jul 25, 2023
Yup, able to reproduce!

[-]Currency changes after refresh although URL has currency params [/-][+][$1000] Currency changes after refresh although URL has currency params [/+]melvin-bot commentedon Jul 25, 2023
Job added to Upwork: https://www.upwork.com/jobs/~01b122db1f8bca0f1d
melvin-bot commentedon Jul 25, 2023
Current assignee @sophiepintoraetz is eligible for the External assigner, not assigning anyone new.
melvin-bot commentedon Jul 25, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane (
External)19 remaining items
sophiepintoraetz commentedon Aug 4, 2023
@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
makiour commentedon Aug 4, 2023
I appreciate your time and clarifications Sophie! Thank you so much for your support.
[-][$1000] Currency changes after refresh although URL has currency params [/-][+][HOLD for payment 2023-08-14] [$1000] Currency changes after refresh although URL has currency params [/+]melvin-bot commentedon Aug 7, 2023
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Aug 7, 2023
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:
melvin-bot commentedon Aug 7, 2023
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:
sophiepintoraetz commentedon Aug 14, 2023
Payouts due today!
Issue Reporter: $250 @makiour
Following payments doubled for fixing two bugs inside this one issue:
Contributor: $2000 @makiour (total $2250) - edit - PAID
Contributor+: $2000 @rushatgabhane (once the checklist has been completed)
Eligible for 50% #urgency bonus? N
rushatgabhane commentedon Aug 14, 2023
The PR that introduced the bug has been identified. Link to the PR: migrating MoneyRequestAmountPage to functional component #21005
The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: https://github.com/Expensify/App/pull/21005/files#r1293863455
A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: Missed edge case by PR author and reviewer.
Determine if we should create a regression test for this bug. Sure!
If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again
rushatgabhane commentedon Aug 14, 2023
created a manual request here - https://staging.new.expensify.com/r/8223080099023677
JmillsExpensify commentedon Aug 16, 2023
Reviewed the details for @rushatgabhane. Approved for payment in NewDot based on the BZ summary above.