@@ -22,7 +22,7 @@ import {
22
22
import { getAmount , getTransaction , waypointHasValidAddress } from '@libs/TransactionUtils' ;
23
23
import CONST from '@src/CONST' ;
24
24
import ONYXKEYS from '@src/ONYXKEYS' ;
25
- import type { PersonalDetails , RecentWaypoint , Report , ReportAction , ReportActions , ReviewDuplicates , Transaction , TransactionViolation , TransactionViolations } from '@src/types/onyx' ;
25
+ import type { PersonalDetails , RecentWaypoint , Report , ReportAction , ReviewDuplicates , Transaction , TransactionViolation , TransactionViolations } from '@src/types/onyx' ;
26
26
import type { OriginalMessageModifiedExpense } from '@src/types/onyx/OriginalMessage' ;
27
27
import type { OnyxData } from '@src/types/onyx/Request' ;
28
28
import type { WaypointCollection } from '@src/types/onyx/Transaction' ;
@@ -279,11 +279,15 @@ function getOnyxDataForRouteRequest(transactionID: string, transactionState: Tra
279
279
* @returns The sanitized collection of waypoints.
280
280
*/
281
281
function sanitizeRecentWaypoints ( waypoints : WaypointCollection ) : WaypointCollection {
282
- return Object . entries ( waypoints ) . reduce ( ( acc , [ key , waypoint ] ) => {
283
- const { pendingAction, ...rest } = waypoint as RecentWaypoint ;
284
- acc [ key ] = rest ;
282
+ return Object . entries ( waypoints ) . reduce ( ( acc : WaypointCollection , [ key , waypoint ] ) => {
283
+ if ( 'pendingAction' in waypoint ) {
284
+ const { pendingAction, ...rest } = waypoint ;
285
+ acc [ key ] = rest ;
286
+ } else {
287
+ acc [ key ] = waypoint ;
288
+ }
285
289
return acc ;
286
- } , { } as WaypointCollection ) ;
290
+ } , { } ) ;
287
291
}
288
292
289
293
/**
@@ -518,7 +522,7 @@ function markAsCash(transactionID: string | undefined, transactionThreadReportID
518
522
{
519
523
onyxMethod : Onyx . METHOD . MERGE ,
520
524
key : `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ transactionThreadReportID } ` ,
521
- value : optimisticReportActions as ReportActions ,
525
+ value : optimisticReportActions ,
522
526
} ,
523
527
] ,
524
528
failureData : [
0 commit comments