Repository navigation
Closed
Labels
BugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewHas a PR in reviewWeeklyKSv2KSv2
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: 9.3.20-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #77292
Email or phone of affected tester (no customers): applausetester+ihbuiivyw@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests
Action Performed:
Precondition:
- Log in with Expensifail account.
- Distance rates are enabled.
- Workspace has at least two different rates.
- Go to staging.new.expensify.com
- Go to workspace chat.
- Click + > Track distance > Odometer.
- Create a 400 mi odometer expense with 100mi start reading and 500mile end reading.
- Go to workspace settings > Distance rates.
- Click Settings > Unit.
- Change the unit to Kilometers (or Miles if the current unit is Kilometers).
- Go to workspace chat and open odometer expense.
- Click Rate.
- Select another rate.
→ Distance field shows 643.74 kilometers. - Click Distance rate.
Expected Result:
- Start reading and End reading should convert to kilometers.
- Total distance should also convert to kilometers, which should be 643.74 kilometers (from Step 10).
Actual Result:
- Start reading and End reading does not convert to kilometers.
- Total distance does not correctly convert to kilometers. It shows 400 km, while Distance field in expense details page shows 643.74 kilometers (from Step 10).
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome / Safari
Screenshots/Videos
1.mp4
Issue Owner
Current Issue Owner: @shubham1206agraUpwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022026440401498482120
- Upwork Job ID: 2026440401498482120
- Last Price Increase: 2026-02-24
Metadata
Metadata
Labels
BugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewHas a PR in reviewWeeklyKSv2KSv2
Type
Projects
- StatusShow more project fieldsDone
Activity
melvin-bot commentedon Feb 24, 2026
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.MelvinBot commentedon Feb 24, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
After creating an odometer expense in miles (e.g., start=100, end=500, total=400 mi) and then changing the workspace distance unit to kilometers and selecting a new rate, the odometer distance page shows incorrect values: the start/end readings remain unconverted (100, 500) and the total distance shows "400 km" instead of the correct "643.74 km". Meanwhile, the expense detail view (Distance field) correctly shows 643.74 km.
What is the root cause of that problem?
When the user selects a new rate with a different unit, the code in
TransactionUtils/index.ts:769-772correctly convertstransaction.comment.customUnit.quantity(400 mi → 643.74 km) and updatesdistanceUnitto 'km'. However, it does not converttransaction.comment.odometerStartortransaction.comment.odometerEnd— these raw values (100, 500) remain unchanged.The odometer page (
IOURequestStepDistanceOdometer.tsx) displays these values with no conversion:odometerStart/odometerEndvia.toString()with no conversion applied.endReading - startReading(a raw subtraction), not read from the properly-convertedquantityfield.The result is the raw mile values (100, 500, 400) displayed with the "km" label — producing "400 km" instead of "643.74 km".
In contrast,
MoneyRequestView.tsx:419-427reads the authoritativequantityfield (which was properly converted to 643.74) through thegetDistanceInMeters→getDistanceForDisplaypipeline, so it shows "643.74 km" correctly.What changes do you think we should make in order to solve the problem?
Two changes are needed:
TransactionUtils/index.ts(lines 769-773): When the rate change triggers a unit conversion, also convertodometerStartandodometerEndby the same conversion factor. After the existing quantity conversion block, add logic to convert both odometer readings:odometerStartandodometerEndbyMILES_TO_KILOMETERSKILOMETERS_TO_MILESupdatedTransactionvialodashSetIOURequestStepDistanceOdometer.tsx(lines 223-232): As a safety measure for the display, when in editing mode (isEditing), thetotalDistanceshould prefer reading fromtransaction.comment.customUnit.quantity(the authoritative converted value) rather than recalculating from the raw odometer readings. This ensures the display is consistent with MoneyRequestView even if the odometer readings haven't been converted yet.What alternative solutions did you explore? (Optional)
Only fix the display (not the data): We could make the odometer page read
quantityfor the total distance and apply a conversion factor to the displayed start/end readings without persisting the converted values. However, this would leave the stored data inconsistent —odometerStart/odometerEndwould be in miles whilequantityanddistanceUnitare in km. This inconsistency would cause issues if the readings are used elsewhere or if the user re-edits and saves (the raw mile values would be saved back as km values).Only fix TransactionUtils: Converting the stored odometer readings on rate change would fix the issue for the common flow, but without the safety measure in the display component, any edge case where the conversion doesn't fire (e.g., if the backend updates
quantitybut the client doesn't re-trigger the conversion) would still show stale values.Relevant Code
App/src/libs/TransactionUtils/index.ts:757-773— Rate change conversion logic (convertsquantitybut not odometer readings)App/src/pages/iou/request/step/IOURequestStepDistanceOdometer.tsx:195-232— Odometer page display (loads raw readings, computes raw subtraction)App/src/pages/iou/request/step/IOURequestStepDistanceOdometer.tsx:132— Unit resolutionApp/src/components/ReportActionItem/MoneyRequestView.tsx:419-427— Expense detail view (correct conversion pipeline)App/src/pages/iou/request/step/IOURequestStepDistanceManual.tsx:112-118— Manual distance page (correct conversion pattern to reference)Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.melvin-bot commentedon Feb 24, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (
External)[-]Odometer - Odometer distance page shows wrong amount after changing distance unit[/-][+][$250] Odometer - Odometer distance page shows wrong amount after changing distance unit[/+]melvin-bot commentedon Feb 24, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022026440401498482120
shubham1206agra commentedon Feb 25, 2026
@MelvinBot implement this
31 remaining items
DylanDylann commentedon Mar 3, 2026
@Julesssss Do you want to update the flow to match the oldDot behavior?
Julesssss commentedon Mar 3, 2026
Oh you're right. I see that now. Perhaps it was due to my report policy 😕
So yeah, lets keep things as simple as possible and align with classic.
DylanDylann commentedon Mar 4, 2026
@MelvinBot We need to update the expectation. When the user changes the rate unit, we will not convert the distance to the new unit automatically. The distance number is still retained and only changes the unit of distance
MelvinBot commentedon Mar 4, 2026
Updated Proposal (revised per feedback from
DylanDylannandJulesssss)Please re-state the problem that we are trying to solve in this issue.
After creating an odometer expense in miles (e.g., start=100, end=500, total=400 mi) and then changing the workspace distance unit to kilometers and selecting a new rate, the odometer distance page and the expense detail view show inconsistent values. The expense detail view converts the distance (showing 643.74 km) while the odometer page shows the raw number with the new unit label (400 km).
Per the updated expectation aligned with OldDot behavior: when the user changes the rate to one with a different unit, the distance number should NOT be converted — it is retained as-is and only the unit label changes. So 400 mi becomes 400 km (not 643.74 km).
What is the root cause of that problem?
There are two places where distance is currently converted when the rate unit changes, which contradicts the desired OldDot behavior:
TransactionUtils/index.ts:766-770(getUpdatedTransaction): WhencustomUnitRateIDchanges and the new rate has a different unit, this code convertsquantityby multiplying withMILES_TO_KILOMETERSorKILOMETERS_TO_MILES. This causes the expense detail view to show 643.74 km instead of keeping the raw 400.IOU/index.ts:1805-1806(setMoneyRequestDistanceRate): Same conversion for draft transactions — converts quantity viaconvertDistanceUnit(getDistanceInMeters(...), newDistanceUnit)when the rate unit differs.Additionally, the amount recalculation at
TransactionUtils/index.ts:780uses the OLD unit to interpret the quantity (getDistanceInMeters(transaction, oldMileageRate?.unit)), which produces the correct physical distance in meters. Under the new expectation, the raw quantity should be treated as being in the NEW unit for amount calculation purposes.What changes do you think we should make in order to solve the problem?
Three changes to stop converting the distance number on rate change:
TransactionUtils/index.ts:766-770: Remove the distance conversion block. Keep thedistanceUnitupdate (line 763) but delete theif (existingDistanceUnit && newDistanceUnit !== existingDistanceUnit)block that multipliesquantityby a conversion factor.TransactionUtils/index.ts:780: Update the amount recalculation to use the new unit instead of the old unit, since the raw quantity is now treated as being in the new unit:getDistanceInMeters(transaction, oldMileageRate?.unit)togetDistanceInMeters(updatedTransaction, unit)so the unchanged quantity (400) is interpreted as the new unit (km) for amount calculation.amount = 400 * newRate(matching OldDot behavior), not643.74 * newRate.IOU/index.ts:1805-1807: Remove the distance conversion for draft transactions. Keep thedistanceUnitupdate but remove thenewDistancecalculation and its application toquantity. The Onyx merge should updatecustomUnitRateIDanddistanceUnitbut NOTquantity.No changes needed to
IOURequestStepDistanceOdometer.tsx— it already displays the raw odometer readings and raw total distance, which is now the correct behavior.What alternative solutions did you explore? (Optional)
getUpdatedTransaction: This would fix existing transactions but leave draft transactions still converting insetMoneyRequestDistanceRate. Both paths need to be updated for consistency.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.DylanDylann commentedon Mar 5, 2026
@MelvinBot implement this (and close the previous PR)
MelvinBot commentedon Mar 5, 2026
🤖 Draft PR created: #84253
Please mark it as "Ready for review" when it is ready for review.
I created this PR from an upstream branch since I don't have push access to your fork.
To take ownership of this branch and be able to push updates, run:
Then you can close this PR and open a new one from your fork.
DylanDylann commentedon Mar 5, 2026
@Julesssss We likely need an update from the BE side (Command: UpdateMoneyRequestDistanceRate).
When updating the rate (with a new unit) for an odometer request, we should only update the unit and not convert the distance (
transaction.comment.customUnit.quantity). Thetransaction.comment.customUnit.quantityshould always remainodometerEnd - odometerStart.As a workaround on the FE, we could calculate the distance using
odometerEnd - odometerStartinstead of relying on the quantity field. However, I think updating this in the BE would be the better long-term approach.DylanDylann commentedon Mar 5, 2026
The FE PR is complete. Waiting for the BE update to move forward
Julesssss commentedon Mar 6, 2026
Backend issue created for
UpdateMoneyRequestDistanceRateconverting quantity on odometer expenses: https://github.com/Expensify/Expensify/issues/608482Julesssss commentedon Mar 6, 2026
Backend PR in progress
IuliiaHerets commentedon Mar 16, 2026
Windows 10 / Chrome
Not Repro
v9.3.38-1
bandicam.2026-03-16.15-13-24-503.mp4