@@ -18,6 +18,7 @@ import useTheme from '@hooks/useTheme';
1818import useThemeStyles from '@hooks/useThemeStyles' ;
1919import { turnOffMobileSelectionMode } from '@libs/actions/MobileSelectionMode' ;
2020import { deleteAppReport , downloadReportPDF , exportReportToCSV , exportReportToPDF , exportToIntegration , markAsManuallyExported , openUnreportedExpense } from '@libs/actions/Report' ;
21+ import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID' ;
2122import { getThreadReportIDsForTransactions , getTotalAmountForIOUReportPreviewButton } from '@libs/MoneyRequestReportUtils' ;
2223import Navigation from '@libs/Navigation/Navigation' ;
2324import type { PlatformStackRouteProp } from '@libs/Navigation/PlatformStackNavigation/types' ;
@@ -178,7 +179,8 @@ function MoneyReportHeader({
178179 selector : ( _transactions ) => reportTransactionsSelector ( _transactions , moneyRequestReport ?. reportID ) ,
179180 canBeMissing : true ,
180181 } ) ;
181- const [ transaction ] = useOnyx ( `${ ONYXKEYS . COLLECTION . TRANSACTION } ${ isMoneyRequestAction ( requestParentReportAction ) && getOriginalMessage ( requestParentReportAction ) ?. IOUTransactionID } ` , {
182+ const iouTransactionID = isMoneyRequestAction ( requestParentReportAction ) ? getOriginalMessage ( requestParentReportAction ) ?. IOUTransactionID : undefined ;
183+ const [ transaction ] = useOnyx ( `${ ONYXKEYS . COLLECTION . TRANSACTION } ${ getNonEmptyStringOnyxID ( iouTransactionID ) } ` , {
182184 canBeMissing : true ,
183185 } ) ;
184186 const [ dismissedHoldUseExplanation , dismissedHoldUseExplanationResult ] = useOnyx ( ONYXKEYS . NVP_DISMISSED_HOLD_USE_EXPLANATION , { canBeMissing : true } ) ;
@@ -365,14 +367,13 @@ function MoneyReportHeader({
365367 if ( ! requestParentReportAction ) {
366368 return ;
367369 }
368- const iouTransactionID = isMoneyRequestAction ( requestParentReportAction ) ? getOriginalMessage ( requestParentReportAction ) ?. IOUTransactionID : undefined ;
369370 const reportID = transactionThreadReport ?. reportID ;
370371
371372 if ( ! iouTransactionID || ! reportID ) {
372373 return ;
373374 }
374375 markAsCashAction ( iouTransactionID , reportID ) ;
375- } , [ requestParentReportAction , transactionThreadReport ?. reportID ] ) ;
376+ } , [ iouTransactionID , requestParentReportAction , transactionThreadReport ?. reportID ] ) ;
376377
377378 const getStatusIcon : ( src : IconAsset ) => React . ReactNode = ( src ) => (
378379 < Icon
0 commit comments