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 - After merging expenses, discarded route is removed, map preview is not shown #103274
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):jsndojsnodjdsoij@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
👋 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.
Workspace chat > Create 2 map distance expenses (A and B)
Open report > Bulk select both > More > Merge
Select any distance > Continue > Merge expenses
Track distance > Map > Reuse route
Check route list
Expected: Both routes A and B appear in Reuse route list, map preview shown Actual: Discarded route (B) is removed from list, map preview not shown
Root Cause:
When merging, MERGE_TRANSACTIONS API deletes the discarded transaction (say transaction B) and its routes / comment.waypoints from Onyx (COLLECTION.TRANSACTION).
The Reuse route screen (src/pages/iou/request/step/DistanceMapPage / DistanceRequestUtils.ts) builds its list from:
Because transaction B is deleted optimistically + on server, its route is lost and never added to recentWaypoints. Also map preview fails because routes object is cleared before being saved.
Similar bug fixed for attendees / categories before - discarded expense data was not preserved.
Fix:
In src/libs/actions/IOU.ts -> mergeExpenses() / buildMergeExpensesData():
Before creating optimisticData that deletes discarded transactions, save their routes to recent waypoints:
// Inside mergeExpenses, for each discardedTransactionconstdiscardedTransactions=allTransactions.filter(t=>selectedIDs.includes(t.transactionID)&&t.transactionID!==keptTransactionID);discardedTransactions.forEach((discardedTx)=>{constwaypoints=discardedTx.comment?.waypoints??discardedTx.routes?.route0?.waypoints;if(waypoints){// Preserve for Reuse RouteoptimisticData.push({onyxMethod: Onyx.METHOD.MERGE,key: ONYXKEYS.NVP_RECENT_WAYPOINTS,value: {[JSON.stringify(waypoints)]: waypoints,},});// Also keep transaction routes in recent routes cache if exists// so DistanceMapPage can show map preview}});
Recommendation: demote. Do not revert. The first part of this report is expected behavior. The second part is a cosmetic gap in the new Reuse route feature from [Payment due @Pujan92] Add Reuse route to the distance creation flow. The feature is not in production yet, so users lose nothing.
Discarded route disappears (expected): merging deletes the discarded expense. The Reuse route list shows only existing map expenses from the server, so one route remains.
The merge call deletes the source expense with transactionIDList: [sourceTransactionID] (MergeTransaction.ts:485). The kept expense takes the receipt, waypoints, and routes of the selected distance (MergeTransactionUtils.ts:854-857).
No other PR on the current checklist changes the merge logic. Product should decide whether merged-away routes stay reusable. If they should, that change belongs on the backend, not in App.
If receiptSource is empty, or if the image fails to load, the card shows the generic receipt icon (ReuseRouteListItem.tsx:45-68).
Likely cause (not confirmed): the merge replaces the kept expense's receipt and route. After that, the server returns an empty or stale map image for the route entry. I could not verify the backend side.
Possible fixes (none urgent)
Backend: return the kept expense's current map image after a merge or route change.
App: keep showing the last good thumbnail when a refreshed entry has no image.
Quick check to locate the problem: after the merge, open the kept expense. If its map receipt renders, the route list's image source is wrong. If it does not render, the merge itself drops the map image. That would also happen in production, so it would not block the deploy.
Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.
The discarded route is removed in route list (Expected per product - deduped per unique route, last 90 days)
Map preview is not shown in route list (REAL BUG - receiptSource empty after merge)
Root Cause Analysis (with Melvin blocker analysis):
Discarded route removed = EXPECTED BEHAVIOR
File: src/libs/actions/MergeTransaction.ts:485 uses transactionIDList: [sourceTransactionID] which deletes discarded transaction
Reuse list ONYXKEYS.COLLECTION.REUSABLE_DISTANCE_ROUTES = "map expenses last 90 days deduped per unique route" - only kept remains. Product decision, not App bug.
Map preview not shown = ACTUAL BUG (cosmetic)
src/pages/iou/request/step/DistanceMapPage.tsx:195-200 calls fetchReusableDistanceRoutes() -> OpenReuseRoutePage -> builds list from REUSABLE_DISTANCE_ROUTES
Thumbnail in src/components/ReuseRouteListItem.tsx:45-68 and src/libs/ReusableDistanceRoutesUtils.ts:63-72 uses receiptSource -> ${receiptSource}.1024.jpg as <source>.1024.jpg
src/libs/MergeTransactionUtils.ts:854-857 - kept expense takes receipt/waypoints/routes of selected distance, but after merge server returns empty/stale receiptSource, so thumbnail fails and falls back to generic receipt icon.
Fix:
App side in src/libs/ReusableDistanceRoutesUtils.ts:
functiongetMapImageSource(route: ReusableRoute){// Keep last good thumbnail if new entry has no imageconstbaseSource=route.receiptSource||route.lastReceiptSource;if(!baseSource){// Fallback: generate preview from routes if availablereturnroute.routes?.route0 ? getMapPreviewFromRoutes(route.routes) : null;}return`${baseSource}.1024.jpg`;}
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/ad828b0d9ba5ef54ddac5f169e657ba469a5111b2db1e5aa57dd15a746ec347c
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:
quantumchain-core commentedon Oct 7, 2026
Proposal for #103274
Version: 9.5.4-0
Repro: Yes in staging
Action Performed:
Expected: Both routes A and B appear in Reuse route list, map preview shown
Actual: Discarded route (B) is removed from list, map preview not shown
Root Cause:
When merging,
MERGE_TRANSACTIONSAPI deletes the discarded transaction (say transaction B) and itsroutes/comment.waypointsfrom Onyx (COLLECTION.TRANSACTION).The
Reuse routescreen (src/pages/iou/request/step/DistanceMapPage/DistanceRequestUtils.ts) builds its list from:allTransactionswithtransactionType = distanceNVP_RECENT_WAYPOINTS/getRecentWaypoints()/getRoutes()Because transaction B is deleted optimistically + on server, its route is lost and never added to
recentWaypoints. Also map preview fails becauseroutesobject is cleared before being saved.Similar bug fixed for attendees / categories before - discarded expense data was not preserved.
Fix:
In
src/libs/actions/IOU.ts->mergeExpenses()/buildMergeExpensesData():Before creating
optimisticDatathat deletes discarded transactions, save their routes to recent waypoints:MelvinBot commentedon Oct 7, 2026
Deploy Blocker Analysis
Recommendation: demote. Do not revert. The first part of this report is expected behavior. The second part is a cosmetic gap in the new Reuse route feature from [Payment due @Pujan92] Add Reuse route to the distance creation flow. The feature is not in production yet, so users lose nothing.
Investigation details
1. Why the discarded route disappears
fetchReusableDistanceRoutes()(IOURequestStepDistanceMap.tsx:195-200). This callsOpenReuseRoutePage(ReusableDistanceRoutes.ts:41). The Onyx key holds "map distance expenses from the last 90 days, deduped to one entry per unique route" (ONYXKEYS.ts:860-861).transactionIDList: [sourceTransactionID](MergeTransaction.ts:485). The kept expense takes the receipt, waypoints, and routes of the selected distance (MergeTransactionUtils.ts:854-857).2. Why the map preview is missing
receiptSource, which becomes<source>.1024.jpg(ReusableDistanceRoutesUtils.ts:63-72).receiptSourceis empty, or if the image fails to load, the card shows the generic receipt icon (ReuseRouteListItem.tsx:45-68).Possible fixes (none urgent)
Quick check to locate the problem: after the merge, open the kept expense. If its map receipt renders, the route list's image source is wrong. If it does not render, the merge itself drops the map image. That would also happen in production, so it would not block the deploy.
Next Steps: Reply with
@MelvinBot <your feedback>to refine this analysis.view run
quantumchain-core commentedon Oct 7, 2026
Proposal for #103274 - Distance - After merging expenses, discarded route is removed, map preview is not shown
Version: 9.5.4-0
Reproducible: Yes staging
Bug ID: 7279485
Action Performed:
Expected Result:
Actual Result:
Root Cause Analysis (with Melvin blocker analysis):
src/libs/actions/MergeTransaction.ts:485usestransactionIDList: [sourceTransactionID]which deletes discarded transactionONYXKEYS.COLLECTION.REUSABLE_DISTANCE_ROUTES= "map expenses last 90 days deduped per unique route" - only kept remains. Product decision, not App bug.src/pages/iou/request/step/DistanceMapPage.tsx:195-200callsfetchReusableDistanceRoutes()->OpenReuseRoutePage-> builds list fromREUSABLE_DISTANCE_ROUTESsrc/components/ReuseRouteListItem.tsx:45-68andsrc/libs/ReusableDistanceRoutesUtils.ts:63-72usesreceiptSource->${receiptSource}.1024.jpgas<source>.1024.jpgsrc/libs/MergeTransactionUtils.ts:854-857- kept expense takes receipt/waypoints/routes of selected distance, but after merge server returns empty/stalereceiptSource, so thumbnail fails and falls back to generic receipt icon.Fix:
App side in
src/libs/ReusableDistanceRoutesUtils.ts:JmillsExpensify commentedon Oct 7, 2026
Let's demote and resolve the cosmetic issue.
ShridharGoel commentedon Oct 8, 2026
@JmillsExpensify Should this be closed since we are not planning to show deleted routes?
JmillsExpensify commentedon Oct 8, 2026
Yes.