-
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
[Checklist and NewDot C+ payment][$500] Distance - Distance request briefly shows local currency instead of workspace currency after creating it #37643
Comments
Triggered auto assignment to @kadiealexander ( |
@kadiealexander FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors |
We think that this bug might be related to #wave5 |
ProposalPlease re-state the problem that we are trying to solve in this issue.When creating a distance request, the user's local currency code is shown in the preview instead of the workspace currency. What is the root cause of that problem?When creating a distance request, we already calculate the distance amount and include the workspace currency here. App/src/components/MoneyTemporaryForRefactorRequestConfirmationList.js Lines 349 to 350 in af68510
The currency is taken from the workspace mileage rate.
However, there are 2 places where the currency is overwritten with the local currency. First, when we arrive at the distance confirmation page, the manual (amount) tab is unmounted. This will trigger this App/src/pages/iou/request/step/IOURequestStepAmount.js Lines 106 to 113 in af68510
Second, when the confirmation page is mounted, we check if the transaction contains an App/src/pages/iou/request/step/IOURequestStepConfirmation.js Lines 111 to 118 in af68510
They assume that when the user arrives, the
Lines 294 to 296 in af68510
What changes do you think we should make in order to solve the problem?Revert #34075 and fix the original issue, that is #33608. The issue is, let's say I set the currency to A. Then, on the edit amount page, I open the currency picker and select currency B. Then, I reopen the currency picker page, but it shows currency A as the selected currency and that's because the currency picker page shows the selected currency from the To solve it, we can allow the currency picker page (IOURequestStepCurrency) to accept the currency from params and transaction object, similar to what we do in the old amount page. To cover a case where the user pass an invalid currency params, we can check whether the currency is valid or not, just like we did here:
What alternative solutions did you explore? (Optional)First alternative: App/src/pages/iou/request/step/IOURequestStepAmount.js Lines 99 to 113 in af68510
Currently, we check for
Then, we don't need the changes on other pages anymore. Second alternative: > IOURequestStepConfirmation
useEffect(() => {
if (!transaction || !transaction.originalCurrency || requestType !== CONST.IOU.REQUEST_TYPE.MANUAL) {
return;
}
// If user somehow lands on this page without the currency reset, then reset it here.
IOU.setMoneyRequestCurrency_temporaryForRefactor(transactionID, transaction.originalCurrency, true);
}, []);
> IOURequestStepAmount
useEffect(() => (iouRequestTypeRef.current = iouRequestType), [iouRequestType]);
useEffect(() => {
return () => {
if (isSaveButtonPressed.current || iouRequestTypeRef.current !== CONST.IOU.REQUEST_TYPE.MANUAL) {
return;
}
IOU.setMoneyRequestCurrency_temporaryForRefactor(transactionID, originalCurrency.current, true);
};
}, []);
> IOURequestStepDistance
const navigateToNextStep = () =>
IOU.setMoneyRequestOriginalCurrency_temporaryForRefactor(transactionID, null); |
@kadiealexander Whoops! This issue is 2 days overdue. Let's get this updated quick! |
1 similar comment
@kadiealexander Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Not overdue! |
Job added to Upwork: https://www.upwork.com/jobs/~010a112a7314639b9b |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane ( |
@sobitneupane please review the proposal from @bernhardoj. |
Thanks for the proposal @bernhardoj. We can go with your alternative proposal. Let's define a variable
The code was introduced by #34075 to solve #33608 issue. 🎀 👀 🎀 C+ reviewed |
Triggered auto assignment to @roryabraham, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
neither proposal is very clear to me tbh, but that's probably my shortcoming. Bear with me here... |
Ok, I think think is pretty confusing because there are so many places where data is being modified in |
Can someone explain to me what would happen if we were to just remove these two effects completely?
|
The first one is to revert the currency to the "draft" (original) currency. Screen.Recording.2024-03-13.at.13.45.06.movIf we remove it, then the currency will be updated even without pressing the Save button (on the edit page). I believe the second one is to mimic the behavior of the previous version of the money request page. Currently, when we select a currency from the currency selection page, it will immediately be saved to the transaction draft. If the user directly accesses the confirmation page (by changing the URL), the second
Previously, the currency would only be saved when we pressed the Next button, so if the user directly accessed the page, the user would see the first currency.
If we remove it, then we will see the updated currency on confirmation page. Screen.Recording.2024-03-13.at.13.53.39.mov |
PR is ready cc: @sobitneupane |
This issue has not been updated in over 15 days. @sobitneupane, @roryabraham, @bernhardoj, @kadiealexander eroding to Monthly issue. P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do! |
PR was merged yesterday |
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results. If a regression has occurred and you are the assigned CM follow the instructions here. If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future. |
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results. If a regression has occurred and you are the assigned CM follow the instructions here. If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future. |
This one is a false alert #37643 (comment) sorry for that |
@kadiealexander the PR was deployed to production on 2024-04-22, so the next step is to pay this out on Monday 2024-04-29 |
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:
|
Payment Summary
BugZero Checklist (@kadiealexander)
|
Yes
|
Regression Test Proposal Prerequisite: Have a workspace with a currency set to different currency than your local currency
Do we agree 👍 or 👎 |
Requested payment in newDot. |
Regression test: https://github.com/Expensify/Expensify/issues/394860 |
$500 approved for @sobitneupane |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 1.4.46-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
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
Action Performed:
Precondition:
Expected Result:
The amount in distance request preview in the main chat will show default workspace currency
Actual Result:
The amount in distance request preview in the main chat briefly shows local currency
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6398768_1709324762143.bandicam_2024-03-02_03-27-34-243.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @sobitneupaneThe text was updated successfully, but these errors were encountered: