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
Distance on confirm page and actual expense is different when route has edited manual distance #103271
Version Number: 9.5.4-0 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:#102258 Email or phone of affected tester (no customers):jsoidjndoiniodnsjojd@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.5 / Chrome App Component: Money Requests
Action Performed:
Go to staging.new.expensify.com
Go to workspace chat.
Create a map distance expense.
Open the expense.
Click Distance > Manual.
Edit the distance and save it.
Click + > Track distance > Map.
Click Reuse route.
Select the previous route.
Click Create expense.
Open the expense.
Expected Result:
The distance on confirm page (Step 9) and actual expense (Step 11) should match after selecting previous route with edited manual distance.
Actual Result:
The distance on confirm page (Step 9) and actual expense (Step 11) is different after selecting previous route with edited manual distance.
👋 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.
Recommendation: Revert. Reuse route is a new feature that only appears in the create flow, so a revert is low risk. It also clears the related blocker, Mismatch between Distance on confirm page & actual distance when reuse route from p2p expense, which has the same root cause. If ShridharGoel can land the fix below within the deploy window, rolling forward is fine instead.
Root cause: The confirm page shows the reused route's stored distance. That distance is never sent when the expense is created, so the server calculates a new distance from the waypoints.
Investigation details
selectReusableRoute in ReusableDistanceRoutes.ts:46-55 copies route.distance into comment.customUnit.quantity and sets isReusedRoute: true. It does not fill routes.route0. If the source expense's distance was edited manually, route.distance is that edited value.
useFetchRoute.ts:44 skips fetching the route when isReusedRoute is set, so routes stays empty.
When the expense is created, useDistanceDraftData.ts:22 uses quantity only for manual, odometer, and GPS expenses. For a map expense, distance is undefined. selectedRouteDistance (useDistanceSubmission.ts:188) is also undefined, because routes is empty. As a result, only the waypoints are sent (Split.ts:2319).
When the request has no distance, the server calculates the map distance from the waypoints. That map distance replaces the manually edited value.
In selectReusableRoute, also store the route distance in meters, for example in routes.route0.distance. The reused route should return meters, or include its unit, so the App can convert the value correctly. Today it returns a number with no unit, which also causes 103270.
At submit time, fall back to the reused distance when no route was fetched:
Confirm that the backend uses selectedRouteDistance even when the App didn't fetch the route itself.
Product question: when the source distance was edited manually, should Reuse route keep the edit or use the map distance? Either way, the confirm page and the saved expense must match.
Good question. We should use the map calculation, not the user overrides, because the feature is re-using the route, not duplicating an expense (which is a distinct flow).
Activity
applause-bot commentedon Oct 7, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/4eb42d8952ff9fb7ddf4f66e0e7d7c0167b6baa19440ebd9a8c790e6c6f1123d
melvin-bot commentedon Oct 7, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #102258
melvin-bot commentedon Oct 7, 2026
@Gonals @Pujan92 you have been assigned to this deploy blocker because you reviewed the offending PR: #102258
melvin-bot commentedon Oct 7, 2026
@ShridharGoel you have been assigned to this deploy blocker because you authored the offending PR: #102258
melvin-bot commentedon Oct 7, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Oct 7, 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:
melvin-bot commentedon Oct 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.
MelvinBot commentedon Oct 7, 2026
Deploy Blocker Analysis
Causing PR: [Payment due @Pujan92] Add Reuse route to the distance creation flow (high confidence). This is a frontend bug in App.
Recommendation: Revert. Reuse route is a new feature that only appears in the create flow, so a revert is low risk. It also clears the related blocker, Mismatch between Distance on confirm page & actual distance when reuse route from p2p expense, which has the same root cause. If
ShridharGoelcan land the fix below within the deploy window, rolling forward is fine instead.Root cause: The confirm page shows the reused route's stored distance. That distance is never sent when the expense is created, so the server calculates a new distance from the waypoints.
Investigation details
selectReusableRoutein ReusableDistanceRoutes.ts:46-55 copiesroute.distanceintocomment.customUnit.quantityand setsisReusedRoute: true. It does not fillroutes.route0. If the source expense's distance was edited manually,route.distanceis that edited value.isReusedRouteis set, soroutesstays empty.getDistanceInMeters(useDistanceRequestState.ts:101). That function readsquantityfirst (getDistanceInMeters.ts:16-18), so the confirm page shows the edited distance.quantityonly for manual, odometer, and GPS expenses. For a map expense,distanceisundefined.selectedRouteDistance(useDistanceSubmission.ts:188) is alsoundefined, becauseroutesis empty. As a result, only the waypoints are sent (Split.ts:2319).Other candidates ruled out: The investigator checked the distance, waypoint, route, and confirmation changes among the 64 PRs in Deploy Checklist: New Expensify 2026-10-06. Split useExpenseSubmission hook only moves distance logic into new files. Fix - DEV: Rate not valid error is displayed when submitting a distance expense, but the Rate field is not editable only deals with rate validity.
Fix if rolling forward:
selectReusableRoute, also store the route distance in meters, for example inroutes.route0.distance. The reused route should return meters, or include its unit, so the App can convert the value correctly. Today it returns a number with no unit, which also causes 103270.selectedRouteDistanceeven when the App didn't fetch the route itself.view run
ShridharGoel commentedon Oct 7, 2026
@JmillsExpensify What would be the expectation here?
JmillsExpensify commentedon Oct 7, 2026
Good question. We should use the map calculation, not the user overrides, because the feature is re-using the route, not duplicating an expense (which is a distinct flow).
ShridharGoel commentedon Oct 7, 2026
Thanks, closing