Repository navigation
Description
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: v9.2.85-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: Exploratory around https://test-management.browserstack.com/projects/2219752/test-runs/TR-2467/folder/13176744/41237142/1086558789 and https://test-management.browserstack.com/projects/2219752/test-runs/TR-2467/folder/13176744/41237140/1086558788
Email or phone of affected tester (no customers): kiatest.78+ck12192510@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Windows 11/Chrome, iPhone 16/iOS 18.3.1, Pixel 8a/Android 16
App Component: Money Requests
Action Performed:
Preconditions:
On User A's side
- Workspace created with Distance rates enabled
- Few additional distance rates added
- Changed the unit to kilometer in settings
- Invited User B as member to workspace
On User's B side
- User B has created his default workspace with distance rates enabled
Steps:
- [User B] - Navigate to staging.new.expensify.com
- [User B] - Click FAB >> Track Distance >> Map option >> Enter waypoints >> Next
- Observe To field has User's B default workspace with default distance rate/mile ($0.7/mile) & take note of distance & amount
- Switch to User's A workspace in To field
- Observe rate field has default rate with kilometer unit ($0.7/kilometer)
- Change rate to non-default one
- Switch to User's B default workspace in To field
8.Observe incorrect unit displayed in Rate field which changes the distance & amount values
Expected Result:
When User B switches from User's A workspace to User's B default workspace, the Rate field unit should change from kilometer to mile & reflect correct distance & amount
Actual Result:
When User B switches from User's A workspace to User's B default workspace , the Rate field unit still display kilometer & does not change to mile unit which is User's B workspace default unit.
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome / Safari
Screenshots/Videos
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022003058270992773869
- Upwork Job ID: 2003058270992773869
- Last Price Increase: 2026-01-05
Issue Owner
Current Issue Owner: @laurenreidexpensifyMetadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
melvin-bot commentedon Dec 20, 2025
Triggered auto assignment to @laurenreidexpensify (
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.[-]Confirm details - Unit doesn't change from Km to Mile when switching workspaces after selecting non-default rate[/-][+][$250] Confirm details - Unit doesn't change from Km to Mile when switching workspaces after selecting non-default rate[/+]melvin-bot commentedon Dec 22, 2025
Job added to Upwork: https://www.upwork.com/jobs/~022003058270992773869
melvin-bot commentedon Dec 22, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (
External)Eskalifer1 commentedon Dec 22, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Confirm details - Unit doesn't change from Km to Mile when switching workspaces after selecting non-default rate
What is the root cause of that problem?
This is because when we use a custom rate, we perform this function:
App/src/pages/iou/request/step/IOURequestStepDistanceRate.tsx
Line 116 in 6072cfb
Which adds
distanceUnit:App/src/libs/actions/IOU.ts
Lines 1469 to 1490 in 6072cfb
App/src/libs/actions/IOU.ts
Line 1485 in 6072cfb
This means that the transaction now has this value, and when the unit is received here:
App/src/components/MoneyRequestConfirmationList.tsx
Lines 326 to 329 in 6072cfb
In the
getRatefunction:App/src/libs/DistanceRequestUtils.ts
Line 378 in 6072cfb
We always try to get the unit from
transaction?.comment?.customUnit?.distanceUnitfirst, and since we inserted it when selecting a non-default unit, we get it:App/src/libs/DistanceRequestUtils.ts
Lines 347 to 349 in 6072cfb
And we don't have any logic that would clear this field when the participant changes, we only have the logic for changing the rate:
App/src/pages/iou/request/step/IOURequestStepParticipants.tsx
Lines 258 to 271 in 6072cfb
What changes do you think we should make in order to solve the problem?
When changing a participant, we can determine and set the same logic that we use here:
App/src/libs/actions/IOU.ts
Lines 1469 to 1490 in 6072cfb
Or reset this field, which I think is more correct, since it will correspond to the logic we have now (
transaction?.comment?.customUnitdoes not have thedistanceUnitfield in the normal flow). To do this, we can create a separate function:And use it here:
App/src/pages/iou/request/step/IOURequestStepParticipants.tsx
Line 265 in 6072cfb
And we can use it here, if necessary:
App/src/pages/iou/request/step/IOURequestStepParticipants.tsx
Line 269 in 6072cfb
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.
marufsharifi commentedon Dec 25, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Confirm details - Unit doesn't change from Km to Mile when switching workspaces after selecting non-default rate
What is the root cause of that problem?
The issue originates from how the distance unit is persisted and later resolved during the distance request flow:
When a user selects a non-default distance rate in a workspace,
setMoneyRequestDistanceRateupdates the draft transaction by storing:transaction.comment.customUnit.distanceUnithere:App/src/libs/actions/IOU.ts
Lines 1482 to 1491 in c00b37a
This is expected behavior and ensures correct recalculation within the same workspace .
The transaction is still in draft state when the user switches the To workspace. At this point, the draft transaction continues to carry the previously stored
distanceUnit.In the confirmation step,
MoneyRequestConfirmationListresolves the mileage rate viagetRate, which internally callsgetDistanceUnit:App/src/libs/DistanceRequestUtils.ts
Line 378 in 54c7eb4
getDistanceUnitcurrently prioritizes the transaction’s stored unit:App/src/libs/DistanceRequestUtils.ts
Lines 347 to 349 in 54c7eb4
This means the draft transaction’s unit always overrides the mileage rate’s unit, even when the mileage rate now belongs to a different workspace with a different default unit.
As a result, a kilometer unit from Workspace A incorrectly overrides a mile-based rate from Workspace B.
In short, the draft transaction’s stored unit leaks across workspace boundaries and incorrectly takes precedence over the newly selected workspace’s mileage rate unit.
What changes do you think we should make in order to solve the problem?
The distance unit used for display and calculation should always be consistent with the currently selected mileage rate . While the transaction’s stored distance unit is valid within the same workspace, it should not override the unit of a mileage rate that belongs to a different workspace.
To achieve this, we should refine the distance unit resolution logic so that:
This ensures that:
We update
getDistanceUnitto explicitly validate whether the transaction’s stored unit is compatible with the mileage rate’s unit before using it.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.
etCoderDysto commentedon Dec 25, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Confirm details - Unit doesn't change from Km to Mile when switching workspaces after selecting non-default rate
What is the root cause of that problem?
When we change distance rate we call
setMoneyRequestDistanceRate, and we set the draftTransaction'scomment?.customUnit?.distanceUnitto kmApp/src/libs/actions/IOU.ts
Lines 1471 to 1488 in 54c7eb4
And when try to get the rate on
MoneyRequestConfirmationList, we callgetRate, and insidegetRateuseTransactionDistanceUnittransaction istrueby default ingetRatefunction call.App/src/libs/DistanceRequestUtils.ts
Lines 357 to 361 in 54c7eb4
And we always calculate
unitfrom transaction (transaction?.comment?.customUnit?.distanceUnit). And we fallback to using mileageRate whentransaction?.comment?.customUnit?.distanceUnitis undefined.App/src/libs/DistanceRequestUtils.ts
Line 378 in 54c7eb4
The logic to get the distance rate unit from transaction was introduced in this PR. The logic was introduced to avoid changing distance rate unit on MoneyRequestView when user changes unit in workspace settings by using the transaction as source of truth rather than using workspace distance rates (policy?.customUnits).
What changes do you think we should make in order to solve the problem?
We should pass false to
useTransactionDistanceUnitwhen we callgetRateinMoneyRequestConfirmationList.tsxApp/src/components/MoneyRequestConfirmationList.tsx
Line 326 in 54c7eb4
That should work fine since we get distance rate unit from the policy when creating distance request to a policy and from personal policy when we create distance request in DM.
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.
63 remaining items
trjExpensify commentedon Mar 16, 2026
approved $250 for @mananjadhav
marufsharifi commentedon Mar 16, 2026
@laurenreidexpensify, I've accepted the offer. thanks.
marufsharifi commentedon Mar 18, 2026
@laurenreidexpensify, gentle bump. thanks.
inimaga commentedon Mar 19, 2026
@marufsharifi Lauren is currently OOO and payment is being handled by @trjExpensify. Have you responded to the offer sent in upwork here.
melvin-bot commentedon Mar 19, 2026
@laurenreidexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
melvin-bot commentedon Mar 19, 2026
@laurenreidexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
trjExpensify commentedon Mar 19, 2026
That was a C+ payment approval. I can though...
trjExpensify commentedon Mar 19, 2026
Paid the Upwork contract out @marufsharifi. Closing!