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
[Due for payment 2026-04-14] [Due for payment 2026-03-13] [$250] Distance - Old unit persists when creating distance expense after changing distance unit #84010
Version Number: 9.3.28-1 Reproducible in staging?: Yes Reproducible in production?: N/A - new feature, doesn't exist in prod If this was caught during regression testing, add the test name, ID and link from BrowserStack:#74967 Email or phone of affected tester (no customers):isodjnosidjiojiojiso@gmail.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:
Enable distance rates.
Change distance unit to Kilometers.
Go to staging.new.expensify.com
Go to self DM.
Click + > Track distance > Manual.
Enter amount > Next.
Click Create expense.
Open the expense.
Click Distance field.
Expected Result:
In Step 3 and 4, when creating distance expense, distance unit should default to kilometer (from the changes in precondition).
Actual Result:
In Step 3 and 4, when creating distance expense, old distance unit (mile) persists.
In Step 6, after creating the expense, the distance amount persists but with the different unit (kilometer).
In Step 7, distance editor still shows miles when the menu item shows kilometers.
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Classification: Frontend bug Causing PR: #74967 - "Fix - [Unreported] Add distance rate to the distance expenses tracked in selfDM" by @FitseTLT (High confidence) Related Issues: None
Recommendation: REVERT
PR #74967 adds functionality for distance rates in self DM (unreported expenses), but introduces a bug where the distance unit from policy settings is not properly applied during distance expense creation. The old unit persists during creation, then switches to the new unit after the expense is created, causing confusion and incorrect data display.
Labels: No label changes needed. DeployBlockerCash is correctly applied (this is a frontend/App bug that blocks the App deploy).
Detailed Analysis
Evidence
The issue states that when creating a distance expense after changing the distance unit from miles to kilometers:
During creation (steps 3-4), the old unit (miles) persists
After creating the expense (step 6), the distance amount persists but with the different unit (kilometers)
The distance editor still shows miles when the menu item shows kilometers
This matches the changes introduced in PR #74967, which modified how distance rates are handled for track expenses in self DM. The PR was merged on 2026-02-28 and is included in the 9.3.28-1 staging deploy checklist.
Verification
PR #74967 modified the following distance-related files:
src/libs/DistanceRequestUtils.ts - Added isTrackDistanceExpense parameter to rate selection logic
src/pages/iou/request/DistanceRequestStartPage.tsx - Changed to use usePolicyForTransaction hook
src/components/MoneyRequestConfirmationList.tsx - Added policyForMovingExpenses to rate calculation
The bug appears to be in how the distance unit is initialized during the creation flow. The setMoneyRequestDistanceRate function (lines 1798-1821 in src/libs/actions/IOU/index.ts) properly updates the distance unit when a rate is selected, but during initial creation on the confirmation page, the unit may not be properly initialized from the policy rate settings for track expenses.
Root Cause
When creating a distance expense in self DM after changing the distance unit setting, the transaction is initialized without the updated distance unit from the policy settings. The unit gets updated only after a rate is explicitly selected or after the expense is created, causing the unit mismatch during the creation flow.
Please re-state the problem that we are trying to solve in this issue.
When a user enables distance rates, changes the distance unit to kilometers in their workspace settings, and then creates a TRACK distance expense from self-DM using the manual distance flow, the distance input UI still shows miles as the unit. After creating the expense, the unit inconsistently shows kilometers in some views and miles in the distance editor.
What is the root cause of that problem?
The root cause is in IOURequestStepDistanceManual.tsx (lines 106-116). When determining the distance unit to display, the component calls:
When creating from self-DM's "+" button via "Track distance > Manual", the iouType is CONST.IOU.TYPE.TRACK (set in AttachmentPickerWithMenuItems.tsx:270). Since TRACK !== CREATE, shouldUseDefaultExpensePolicy returns false, and the component falls back to policy from usePolicy(report?.policyID), which is null for self-DM reports (they have no policyID).
With a null policy, DistanceRequestUtils.getRate() takes the following path:
getMileageRates(null) returns {} (empty)
The transaction draft has customUnitRateID = FAKE_P2P_ID (set by getCustomUnitRateID at DistanceRequestUtils.ts:333 which returns FAKE_P2P_ID when policy is empty)
getRateForP2P(currency, transaction) is called, which returns the hardcoded P2P rate from CONST.CURRENCY_TO_DEFAULT_MILEAGE_RATE — for USD, this is {rate: 72.5, unit: "mi"} (CONST/index.ts:6887-6890)
So regardless of the workspace's distance unit configuration, the creation UI always shows the P2P default unit for the currency (miles for USD).
The same issue affects IOURequestStepDistanceOdometer which uses a similar pattern. The IOURequestStepDistanceMap component also has this issue since it doesn't pass unit to handleMoneyRequestStepDistanceNavigation (see IOURequestStepDistanceMap.tsx:301-334), so the self-DM P2P unit conversion is never performed for map-based requests.
What changes do you think we should make in order to solve the problem?
The fix should ensure the workspace's distance unit is used for TRACK distance expenses from self-DM:
In IOURequestStepDistanceManual.tsx (line 113): When shouldUseDefaultExpensePolicy is false but the report is a self-DM (and the user has a defaultExpensePolicy), fall back to defaultExpensePolicy instead of the null policy. Something like:
This ensures that when the direct report policy is null (self-DM), the user's default workspace policy is used to determine the distance unit.
Apply the same fix in IOURequestStepDistanceOdometer.tsx which has the same pattern.
Consider the same approach in IOURequestStepDistanceMap.tsx and in handleMoneyRequestStepDistanceNavigation where the unit parameter is used for self-DM P2P conversion.
What alternative solutions did you explore? (Optional)
An alternative would be to modify shouldUseDefaultExpensePolicy to also return true for TRACK type, but that could have broader side effects since shouldUseDefaultExpensePolicy controls policy selection in many parts of the flow (participants, confirmation page, etc.). The more targeted fix of falling back to defaultExpensePolicy when policy is null is safer and more localized.
Another alternative would be to set the correct customUnitRateID from the workspace policy during initMoneyRequest even for TRACK expenses in self-DM. However, this is architecturally complex because initMoneyRequest would need awareness of the default expense policy, and the transaction should use P2P rates in self-DM — the issue is only about the display unit during creation.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
changed the title [-][$250] Distance - Old unit persists when creating distance expense after changing distance unit[/-][+][Due for payment 2026-03-13] [$250] Distance - Old unit persists when creating distance expense after changing distance unit[/+]on Mar 6, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.31-12 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@parasharrajat / @FitseTLT@dylanexpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
changed the title [-][Due for payment 2026-03-13] [$250] Distance - Old unit persists when creating distance expense after changing distance unit[/-][+][Due for payment 2026-04-14] [Due for payment 2026-03-13] [$250] Distance - Old unit persists when creating distance expense after changing distance unit[/+]on Apr 7, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.53-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@parasharrajat / @FitseTLT The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
Activity
melvin-bot commentedon Mar 3, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #74967
melvin-bot commentedon Mar 3, 2026
💬 A slack conversation has been started in #expensify-open-source
melvin-bot commentedon Mar 3, 2026
Triggered auto assignment to @CortneyOfstad (
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.github-actions commentedon Mar 3, 2026
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
OSBotify commentedon Mar 3, 2026
Investigation Summary
Classification: Frontend bug
Causing PR: #74967 - "Fix - [Unreported] Add distance rate to the distance expenses tracked in selfDM" by @FitseTLT (High confidence)
Related Issues: None
Recommendation: REVERT
PR #74967 adds functionality for distance rates in self DM (unreported expenses), but introduces a bug where the distance unit from policy settings is not properly applied during distance expense creation. The old unit persists during creation, then switches to the new unit after the expense is created, causing confusion and incorrect data display.
Labels: No label changes needed. DeployBlockerCash is correctly applied (this is a frontend/App bug that blocks the App deploy).
Detailed Analysis
Evidence
The issue states that when creating a distance expense after changing the distance unit from miles to kilometers:
This matches the changes introduced in PR #74967, which modified how distance rates are handled for track expenses in self DM. The PR was merged on 2026-02-28 and is included in the 9.3.28-1 staging deploy checklist.
Verification
PR #74967 modified the following distance-related files:
src/libs/DistanceRequestUtils.ts- AddedisTrackDistanceExpenseparameter to rate selection logicsrc/pages/iou/request/DistanceRequestStartPage.tsx- Changed to useusePolicyForTransactionhooksrc/components/MoneyRequestConfirmationList.tsx- AddedpolicyForMovingExpensesto rate calculationcustomUnitRateIDparameterThe bug appears to be in how the distance unit is initialized during the creation flow. The
setMoneyRequestDistanceRatefunction (lines 1798-1821 insrc/libs/actions/IOU/index.ts) properly updates the distance unit when a rate is selected, but during initial creation on the confirmation page, the unit may not be properly initialized from the policy rate settings for track expenses.Root Cause
When creating a distance expense in self DM after changing the distance unit setting, the transaction is initialized without the updated distance unit from the policy settings. The unit gets updated only after a rate is explicitly selected or after the expense is created, causing the unit mismatch during the creation flow.
MelvinBot commentedon Mar 3, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user enables distance rates, changes the distance unit to kilometers in their workspace settings, and then creates a TRACK distance expense from self-DM using the manual distance flow, the distance input UI still shows miles as the unit. After creating the expense, the unit inconsistently shows kilometers in some views and miles in the distance editor.
What is the root cause of that problem?
The root cause is in
IOURequestStepDistanceManual.tsx(lines 106-116). When determining the distance unit to display, the component calls:The function
shouldUseDefaultExpensePolicy(src/libs/shouldUseDefaultExpensePolicy.ts:7-14) only returns true wheniouType === CONST.IOU.TYPE.CREATE:When creating from self-DM's "+" button via "Track distance > Manual", the
iouTypeisCONST.IOU.TYPE.TRACK(set inAttachmentPickerWithMenuItems.tsx:270). SinceTRACK !== CREATE,shouldUseDefaultExpensePolicyreturnsfalse, and the component falls back topolicyfromusePolicy(report?.policyID), which is null for self-DM reports (they have nopolicyID).With a null policy,
DistanceRequestUtils.getRate()takes the following path:getMileageRates(null)returns{}(empty)customUnitRateID = FAKE_P2P_ID(set bygetCustomUnitRateIDatDistanceRequestUtils.ts:333which returnsFAKE_P2P_IDwhen policy is empty)isCustomUnitRateIDForP2P(transaction)returnstrueatDistanceRequestUtils.ts:414getRateForP2P(currency, transaction)is called, which returns the hardcoded P2P rate fromCONST.CURRENCY_TO_DEFAULT_MILEAGE_RATE— for USD, this is{rate: 72.5, unit: "mi"}(CONST/index.ts:6887-6890)So regardless of the workspace's distance unit configuration, the creation UI always shows the P2P default unit for the currency (miles for USD).
The same issue affects
IOURequestStepDistanceOdometerwhich uses a similar pattern. TheIOURequestStepDistanceMapcomponent also has this issue since it doesn't passunittohandleMoneyRequestStepDistanceNavigation(seeIOURequestStepDistanceMap.tsx:301-334), so the self-DM P2P unit conversion is never performed for map-based requests.What changes do you think we should make in order to solve the problem?
The fix should ensure the workspace's distance unit is used for TRACK distance expenses from self-DM:
In
IOURequestStepDistanceManual.tsx(line 113): WhenshouldUseDefaultExpensePolicyis false but the report is a self-DM (and the user has adefaultExpensePolicy), fall back todefaultExpensePolicyinstead of the nullpolicy. Something like:This ensures that when the direct report policy is null (self-DM), the user's default workspace policy is used to determine the distance unit.
Apply the same fix in
IOURequestStepDistanceOdometer.tsxwhich has the same pattern.Consider the same approach in
IOURequestStepDistanceMap.tsxand inhandleMoneyRequestStepDistanceNavigationwhere theunitparameter is used for self-DM P2P conversion.What alternative solutions did you explore? (Optional)
An alternative would be to modify
shouldUseDefaultExpensePolicyto also return true forTRACKtype, but that could have broader side effects sinceshouldUseDefaultExpensePolicycontrols policy selection in many parts of the flow (participants, confirmation page, etc.). The more targeted fix of falling back todefaultExpensePolicywhenpolicyis null is safer and more localized.Another alternative would be to set the correct
customUnitRateIDfrom the workspace policy duringinitMoneyRequesteven for TRACK expenses in self-DM. However, this is architecturally complex becauseinitMoneyRequestwould need awareness of the default expense policy, and the transaction should use P2P rates in self-DM — the issue is only about the display unit during creation.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.25 remaining items
[-][$250] Distance - Old unit persists when creating distance expense after changing distance unit[/-][+][Due for payment 2026-03-13] [$250] Distance - Old unit persists when creating distance expense after changing distance unit[/+]melvin-bot commentedon Mar 6, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Mar 6, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.31-12 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 2026-03-13. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Mar 6, 2026
@parasharrajat / @FitseTLT @dylanexpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
melvin-bot commentedon Mar 6, 2026
Current assignee @dylanexpensify is eligible for the Awaiting Payment assigner, not assigning anyone new.
melvin-bot commentedon Apr 7, 2026
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.
jponikarchuk commentedon Apr 7, 2026
Deploy Blocker #87207 was identified to be related to the PR #84136 that attempted to fix this issue.
[-][Due for payment 2026-03-13] [$250] Distance - Old unit persists when creating distance expense after changing distance unit[/-][+][Due for payment 2026-04-14] [Due for payment 2026-03-13] [$250] Distance - Old unit persists when creating distance expense after changing distance unit[/+]melvin-bot commentedon Apr 7, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.53-7 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 2026-04-14. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Apr 7, 2026
@parasharrajat / @FitseTLT The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]