[$250] Manual distance - Rate field on confirm page shows default rate instead of last selected rate
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: 9.2.20-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from TestRail: https://test-management.browserstack.com/projects/2219752/test-runs/TR-1030/folder/13176744/41237166/924222990 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Device used: Mac 15.5 / Chrome App Component: Money Requests
Action Performed:
Precondition:
- Create two workspaces - Workspace A and Workspace B.
- Each workspace has two distance rates - 0.70 / mile and 1.00 / mile
-
Go to staging.new.expensify.com
-
Go to workspace chat A.
-
Click + > Track distance > Map.
-
Create a Map distance expense with 1.00 / mile rate.
-
Click + > Track distance > Map.
-
Enter waypoints > Next. β On confirm page, Rate field shows the last selected rate (1.00 / mile), which is expected.
-
Go to workspace chat B.
-
Click + > Track distance > Manual.
-
Create a Manual distance expense with 1.00 / mile rate.
-
Click + > Track distance > Manual.
-
Enter distance > Next. β On confirm page, Rate field shows the the default rate (0.70 / mile) instead of the last selected rate (1.00 / mile), which is inconsistent with Step 6 where Map distance is created and Rate field shows the last selected rate (1.00 / mile).
Expected Result:
In Step 11, Rate field will show the last selected rate, which is 1.00 / mile.
Actual Result:
In Step 11, Rate field shows the the default rate (0.70 / mile) instead of the last selected rate (1.00 / mile).
This is inconsistent with Step 6 where Map distance is created and Rate field shows the last selected rate (1.00 / mile).
Workaround:
Unknown
Platforms:
- [x] Android: App
- [x] Android: mWeb Chrome
- [x] iOS: App
- [x] iOS: mWeb Safari
- [x] iOS: mWeb Chrome
- [x] Windows: Chrome
- [x] MacOS: Chrome / Safari
- [x] MacOS: Desktop
Screenshots/Videos
https://github.com/user-attachments/assets/569dcff0-8c4a-454c-baaa-4ebb48761553
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021973662938595570701
- Upwork Job ID: 1973662938595570701
- Last Price Increase: 2025-12-25
Issue Owner
Current Issue Owner: @akinwale
Triggered auto assignment to @dylanexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Manual distance - Rate field on confirm page shows default rate instead of last selected rate
What is the root cause of that problem?
CUrrently we are using ||, which treated a missing rate (undefined) the same as falsy values and always fell back to the default, even when a valid customUnitRateID was set.
https://github.com/Expensify/App/blob/bda97bb1fb50e3ff24c9f6c79dd715842c46b335/src/libs/DistanceRequestUtils.ts#L363-L366
What changes do you think we should make in order to solve the problem?
We should use ??, so that we fall back when the rate is truly null or undefined, so the previously selected rate is preserved instead of being replaced with the default.
const transactionRate = customUnitRateID ? mileageRates?.[customUnitRateID] : undefined;
const customMileageRate = transactionRate ?? defaultMileageRate;
here
https://github.com/Expensify/App/blob/bda97bb1fb50e3ff24c9f6c79dd715842c46b335/src/libs/DistanceRequestUtils.ts#L363-L366
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
N/A
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
BE return wrong customUnitRateID for Manual track distance and that id's rate match with defaultMileageRate causing this bug.
Job added to Upwork: https://www.upwork.com/jobs/~021973662938595570701
Triggered auto assignment to Contributor-plus team member for initial proposal review - @akinwale (External)
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
@akinwale 10 days overdue. I'm getting more depressed than Marvin.
@akinwale 10 days overdue. I'm getting more depressed than Marvin.
@akinwale 12 days overdue. Walking. Toward. The. Light...
@dylanexpensify This is a bug that needs to be fixed in the backend.
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
@akinwale 10 days overdue. Is anyone even seeing these? Hello?
@akinwale @dylanexpensify this issue is now 4 weeks old, please consider:
- Finding a contributor to fix the bug
- Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
- If you have any questions, don't hesitate to start a discussion in #expensify-open-source
Thanks!
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
This issue has not been updated in over 14 days. @akinwale, @dylanexpensify eroding to Weekly issue.
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
This issue has not been updated in over 15 days. @akinwale, @dylanexpensify 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!
Issue not reproducible during KI retests. (First week)
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
Issue not reproducible during KI retests. (Second week)
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
Issue not reproducible during KI retests. (Third week)