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-11-13] [$175] [Exploratory] Distance - Duplicating expense with alternate route doesn't duplicate the route #102946
Version Number: v9.5.1-9 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:https://test-management.browserstack.com/projects/2219752/folder/57599980/test-cases/41237143 Email or phone of affected tester (no customers):gd868gd@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Desktop / Windows 11 App Component: Money Requests
Action Performed:
Open the Workspace and log in
Click on the global FAB and click on "Track distance"
Set the start and end points on the map
When the route is calculated, select an alternate route shown on the map
Click on "Next" and click on "Create expense"
Click on the created expense to open it
Click on "More" and click on "Duplicate expense"
Observe the distance and the map of the duplicated expense
Expected Result:
The alternate route should be duplicated as well as all other data from the original expense.
Actual Result:
The alternate route is not copied into the duplicate of the original expense.
It causes a difference in the distance between two expenses that should be the same and triggers an error.
this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
Please re-state the problem that we are trying to solve in this issue.
When you duplicate a map distance expense that uses the alternate route, the duplicate gets the primary route. The distance changes, and the amount no longer matches the distance.
What is the root cause of that problem?
The backend learns which route you picked only from the selectedRouteDistance API param. Normal create and edit flows send it, for example useDistanceSubmission.ts:190. Without it, the backend uses the primary route. The param's own comment says this: Split.ts:125-126.
The duplicate flow never sets selectedRouteDistance. buildDuplicateTransactionParams copies only the waypoints. It sets distance only for split, odometer, or manual expenses (L665-L668). So the duplicate sends the waypoints and the alternate route's amount (L755-L761). The backend then recalculates the distance using the primary route. That mismatch between amount and distance explains the error in the video.
What changes do you think we should make in order to solve the problem?
In buildDuplicateTransactionParams, for map distance expenses only, set selectedRouteDistance from the source expense. Use getSelectedRouteDistance(transaction) and fall back to transaction.comment.customUnit.routeDistanceMeters. A saved expense often has no routes, so the saved meters value is the reliable source (TransactionUtils/index.ts:1795-1803).
No other wiring is needed. createDistanceRequest (Split.ts:2116) and trackExpense (TrackExpense.ts:2580) already read it from transactionParams. This covers both the workspace and the self-DM duplicate paths.
Optional: copy routes into the duplicate's optimistic transaction so the map shows the alternate route right away.
Add a test in tests/actions/IOUTest/DuplicateTest.ts that checks selectedRouteDistance is sent when you duplicate an alternate-route expense.
What alternative solutions did you explore? (Optional)
Sending distance for map expenses as well. We rejected this because map expenses rely on waypoints plus the selected route. selectedRouteDistance is the field built for this case.
Notes
The fix is App-only. The backend already accepts selectedRouteDistance on create. We have not confirmed the exact backend error text.
No duplicate issue found. I added External so a C+ can review this.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/102946) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Activity
applause-bot commentedon Oct 4, 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/843c8daf70550ea9b8512beb5c59514a517f589397c1be0fa47b84964a9f3161
https://platform.applause.com/services/links/v1/external/723df821af156b2fc4cd8e42db78fbd443a1476eaa9e1b518f8de867e7f4cb38
melvin-bot commentedon Oct 18, 2026
this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
m-natarajan commentedon Oct 27, 2026
Similar issue reported here as well (https://expensify.slack.com/archives/C049HHMV9SM/p1793052323348019)
m-natarajan commentedon Oct 27, 2026
@MelvinBot Please investigate this and assign accordingly
MelvinBot commentedon Oct 27, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When you duplicate a map distance expense that uses the alternate route, the duplicate gets the primary route. The distance changes, and the amount no longer matches the distance.
What is the root cause of that problem?
The backend learns which route you picked only from the
selectedRouteDistanceAPI param. Normal create and edit flows send it, for exampleuseDistanceSubmission.ts:190. Without it, the backend uses the primary route. The param's own comment says this:Split.ts:125-126.The duplicate flow never sets
selectedRouteDistance.buildDuplicateTransactionParamscopies only the waypoints. It setsdistanceonly for split, odometer, or manual expenses (L665-L668). So the duplicate sends the waypoints and the alternate route's amount (L755-L761). The backend then recalculates the distance using the primary route. That mismatch between amount and distance explains the error in the video.What changes do you think we should make in order to solve the problem?
buildDuplicateTransactionParams, for map distance expenses only, setselectedRouteDistancefrom the source expense. UsegetSelectedRouteDistance(transaction)and fall back totransaction.comment.customUnit.routeDistanceMeters. A saved expense often has noroutes, so the saved meters value is the reliable source (TransactionUtils/index.ts:1795-1803).createDistanceRequest(Split.ts:2116) andtrackExpense(TrackExpense.ts:2580) already read it fromtransactionParams. This covers both the workspace and the self-DM duplicate paths.routesinto the duplicate's optimistic transaction so the map shows the alternate route right away.tests/actions/IOUTest/DuplicateTest.tsthat checksselectedRouteDistanceis sent when you duplicate an alternate-route expense.What alternative solutions did you explore? (Optional)
Sending
distancefor map expenses as well. We rejected this because map expenses rely on waypoints plus the selected route.selectedRouteDistanceis the field built for this case.Notes
selectedRouteDistanceon create. We have not confirmed the exact backend error text.Externalso a C+ can review this.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/102946)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
27 remaining items
melvin-bot commentedon Nov 12, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Nov 12, 2026
Payment Summary
Resolving PRs:
Keep the alternate route when duplicating a map distance expense #105414
Reviewer: @hoangzinh owed $175 via NewDot
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Nov 16, 2026
Claude posting on behalf of Matt:
Ready. Job price: $175 (title).
No deploy blockers or regressions on the issue or the PR.
Next: press Caps+Y, then pay.
Evidence
PAYPREP v1mallenexpensify commentedon Nov 16, 2026
Payment Summary
Contributor+: @hoangzinh due $175 via NewDot