@@ -21,6 +21,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
2121import useStyleUtils from '@hooks/useStyleUtils' ;
2222import useTheme from '@hooks/useTheme' ;
2323import useThemeStyles from '@hooks/useThemeStyles' ;
24+ import useTransactionsAndViolationsForReport from '@hooks/useTransactionsAndViolationsForReport' ;
2425import { handleActionButtonPress } from '@libs/actions/Search' ;
2526import { syncMissingAttendeesViolation } from '@libs/AttendeeUtils' ;
2627import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID' ;
@@ -142,6 +143,8 @@ function ExpenseReportListItem<TItem extends ListItem>({
142143 const { showDelegateNoAccessModal} = useDelegateNoAccessActions ( ) ;
143144 const [ amountOwed ] = useOnyx ( ONYXKEYS . NVP_PRIVATE_AMOUNT_OWED ) ;
144145 const { showHoldMenu} = useHoldMenuModal ( ) ;
146+ const { transactions : reportTransactions } = useTransactionsAndViolationsForReport ( reportItem . reportID ) ;
147+ const liveReportTransactions = useMemo ( ( ) => Object . values ( reportTransactions ) , [ reportTransactions ] ) ;
145148
146149 const handleOnButtonPress = useCallback ( ( ) => {
147150 handleActionButtonPress ( {
@@ -162,8 +165,13 @@ function ExpenseReportListItem<TItem extends ListItem>({
162165 // collection yet. Fall back to the snapshot so the modal can submit.
163166 const moneyRequestReport = parentReport ?? snapshotReport ;
164167 const chatReport = parentChatReport ?? snapshotChatReport ;
165- const { nonHeldAmount, fullAmount, hasValidNonHeldAmount} = getNonHeldAndFullAmount ( moneyRequestReport , holdItem . allActions ?. includes ( CONST . SEARCH . ACTION_TYPES . PAY ) ?? false ) ;
166- const hasNonHeldExpenses = holdItem . transactions . some ( ( t ) => ! isOnHold ( t ) ) ;
168+ const transactionsForHoldMenu = liveReportTransactions . length > 0 ? liveReportTransactions : holdItem . transactions ;
169+ const { nonHeldAmount, fullAmount, hasValidNonHeldAmount} = getNonHeldAndFullAmount (
170+ moneyRequestReport ,
171+ holdItem . allActions ?. includes ( CONST . SEARCH . ACTION_TYPES . PAY ) ?? false ,
172+ transactionsForHoldMenu ,
173+ ) ;
174+ const hasNonHeldExpenses = transactionsForHoldMenu . some ( ( t ) => ! isOnHold ( t ) ) ;
167175 showHoldMenu ( {
168176 reportID : holdItem . reportID ,
169177 chatReportID : holdItem . parentReportID ,
@@ -174,7 +182,7 @@ function ExpenseReportListItem<TItem extends ListItem>({
174182 nonHeldAmount : hasNonHeldExpenses && hasValidNonHeldAmount ? nonHeldAmount : undefined ,
175183 fullAmount,
176184 hasNonHeldExpenses,
177- transactionCount : holdItem . transactionCount ?? 0 ,
185+ transactionCount : transactionsForHoldMenu . length > 0 ? transactionsForHoldMenu . length : ( holdItem . transactionCount ?? 0 ) ,
178186 } ) ;
179187 } ,
180188 ownerBillingGracePeriodEnd,
@@ -197,6 +205,7 @@ function ExpenseReportListItem<TItem extends ListItem>({
197205 isDelegateAccessRestricted ,
198206 showDelegateNoAccessModal ,
199207 showHoldMenu ,
208+ liveReportTransactions ,
200209 ownerBillingGracePeriodEnd ,
201210 amountOwed ,
202211 ] ) ;
0 commit comments