@@ -17,7 +17,7 @@ import CONST from '@src/CONST';
1717import type { TranslationParameters , TranslationPaths } from '@src/languages/types' ;
1818import type { Route } from '@src/ROUTES' ;
1919import ROUTES from '@src/ROUTES' ;
20- import type { Beta , IntroSelected , LastSelectedDistanceRates , PersonalDetailsList , Policy , QuickAction , Report , Transaction , TransactionViolation } from '@src/types/onyx' ;
20+ import type { Beta , IntroSelected , LastSelectedDistanceRates , PersonalDetailsList , Policy , QuickAction , RecentWaypoint , Report , Transaction , TransactionViolation } from '@src/types/onyx' ;
2121import type { ReportAttributes , ReportAttributesDerivedValue } from '@src/types/onyx/DerivedValues' ;
2222import type { Participant } from '@src/types/onyx/IOU' ;
2323import type { Unit } from '@src/types/onyx/Policy' ;
@@ -62,6 +62,7 @@ type CreateTransactionParams = {
6262 isSelfTourViewed : boolean ;
6363 betas : OnyxEntry < Beta [ ] > ;
6464 personalDetails : OnyxEntry < PersonalDetailsList > ;
65+ recentWaypoints : OnyxEntry < RecentWaypoint [ ] > ;
6566} ;
6667
6768type InitialTransactionParams = {
@@ -173,9 +174,8 @@ function createTransaction({
173174 isSelfTourViewed,
174175 betas,
175176 personalDetails,
177+ recentWaypoints,
176178} : CreateTransactionParams ) {
177- const recentWaypoints = getRecentWaypoints ( ) ;
178-
179179 for ( const [ index , receiptFile ] of files . entries ( ) ) {
180180 const transaction = transactions . find ( ( item ) => item . transactionID === receiptFile . transactionID ) ;
181181 const receipt : Receipt = receiptFile . file ?? { } ;
@@ -376,6 +376,7 @@ function handleMoneyRequestStepScanParticipants({
376376 lat : successData . coords . latitude ,
377377 long : successData . coords . longitude ,
378378 } ;
379+ const recentWaypoints = getRecentWaypoints ( ) ;
379380 createTransaction ( {
380381 transactions,
381382 iouType,
@@ -399,11 +400,13 @@ function handleMoneyRequestStepScanParticipants({
399400 isSelfTourViewed,
400401 betas,
401402 personalDetails,
403+ recentWaypoints,
402404 } ) ;
403405 } ,
404406 ( errorData ) => {
405407 Log . info ( '[IOURequestStepScan] getCurrentPosition failed' , false , errorData ) ;
406408 // When there is an error, the money can still be requested, it just won't include the GPS coordinates
409+ const recentWaypoints = getRecentWaypoints ( ) ;
407410 createTransaction ( {
408411 transactions,
409412 iouType,
@@ -424,11 +427,13 @@ function handleMoneyRequestStepScanParticipants({
424427 isSelfTourViewed,
425428 betas,
426429 personalDetails,
430+ recentWaypoints,
427431 } ) ;
428432 } ,
429433 ) ;
430434 return ;
431435 }
436+ const recentWaypoints = getRecentWaypoints ( ) ;
432437 createTransaction ( {
433438 transactions,
434439 iouType,
@@ -449,6 +454,7 @@ function handleMoneyRequestStepScanParticipants({
449454 isSelfTourViewed,
450455 betas,
451456 personalDetails,
457+ recentWaypoints,
452458 } ) ;
453459 return ;
454460 }
0 commit comments