@@ -1306,22 +1306,16 @@ function getUpdateMoneyRequestParams(params: GetUpdateMoneyRequestParamsType): U
13061306 apiParams . attendees = JSON . stringify ( apiParams ?. attendees ) ;
13071307 }
13081308
1309- // Clear out the error fields and loading states on success.
1310- // Only clear `routes` when waypoints/rate changed (the server will push a fresh route via Pusher).
1311- // For pure distance edits the route is unchanged, and clearing it would make the map briefly disappear.
1312- // When the caller already supplied a valid optimistic route (waypoint edit with route pre-fetched
1313- // locally), keep it so the receipt thumbnail and ConfirmedRoute don't flicker between success and
1314- // the Pusher route push.
1315- const hasValidOptimisticRoute = ! ! transactionChanges . routes ?. route0 ?. geometry ?. coordinates ?. length ;
1316- const shouldClearRoutes = ( hasWaypointAddressesChanged || hasModifiedDistanceRate ) && ! hasValidOptimisticRoute ;
1309+ // Clear out the error fields and loading states on success. Keep `routes`: the BE never returns it,
1310+ // so it's the only source `ConfirmedRoute`/the preview can draw the map from while the receipt
1311+ // regenerates after a rate/distance edit (GH #90057); a waypoint edit clears + re-fetches it anyway.
13171312 successData . push ( {
13181313 onyxMethod : Onyx . METHOD . MERGE ,
13191314 key : `${ ONYXKEYS . COLLECTION . TRANSACTION } ${ transactionID } ` ,
13201315 value : {
13211316 pendingFields : clearedPendingFields ,
13221317 isLoading : false ,
13231318 errorFields : null ,
1324- ...( shouldClearRoutes && { routes : null } ) ,
13251319 } ,
13261320 } ) ;
13271321
@@ -1672,15 +1666,14 @@ function getUpdateTrackExpenseParams(
16721666 } ) ;
16731667 }
16741668
1675- // Clear out the error fields and loading states on success
1669+ // Clear out the error fields and loading states on success. Keep `routes` (see `getUpdateMoneyRequestParams`) — GH #90057.
16761670 successData . push ( {
16771671 onyxMethod : Onyx . METHOD . MERGE ,
16781672 key : `${ ONYXKEYS . COLLECTION . TRANSACTION } ${ transactionID } ` ,
16791673 value : {
16801674 pendingFields : clearedPendingFields ,
16811675 isLoading : false ,
16821676 errorFields : null ,
1683- routes : null ,
16841677 } ,
16851678 } ) ;
16861679
0 commit comments