@@ -80,14 +80,11 @@ const DELAY_FOR_SCROLLING_TO_END = 100;
8080const BACKFILL_MIN_ACTIONS_THRESHOLD = 50 ;
8181
8282type MoneyRequestReportListProps = {
83- /** The reportID of the report to display */
84- reportID : string | undefined ;
85-
8683 /** Callback executed on layout */
8784 onLayout ?: ( event : LayoutChangeEvent ) => void ;
8885} ;
8986
90- function MoneyRequestReportActionsList ( { reportID : reportIDProp , onLayout} : MoneyRequestReportListProps ) {
87+ function MoneyRequestReportActionsList ( { onLayout} : MoneyRequestReportListProps ) {
9188 const styles = useThemeStyles ( ) ;
9289 const { translate, getLocalDateFromDatetime} = useLocalize ( ) ;
9390 const { isOffline, lastOfflineAt, lastOnlineAt} = useNetworkWithOfflineStatus ( ) ;
@@ -97,18 +94,19 @@ function MoneyRequestReportActionsList({reportID: reportIDProp, onLayout}: Money
9794 const [ isVisible , setIsVisible ] = useState ( Visibility . isVisible ) ;
9895 const isFocused = useIsFocused ( ) ;
9996 const route = useRoute < PlatformStackRouteProp < ReportsSplitNavigatorParamList , typeof SCREENS . REPORT > > ( ) ;
97+ const reportIDFromRoute = route . params . reportID ;
10098
10199 // Self-subscribe to report, policy, metadata, actions, transactions
102100 // report is guaranteed to exist — callers only render this component when report is loaded
103- const [ report ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ reportIDProp } ` ) as unknown as [ OnyxTypes . Report ] ;
101+ const [ report ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ reportIDFromRoute } ` ) as unknown as [ OnyxTypes . Report ] ;
104102 const [ policy ] = useOnyx ( `${ ONYXKEYS . COLLECTION . POLICY } ${ getNonEmptyStringOnyxID ( report ?. policyID ) } ` ) ;
105- const [ reportMetadata ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT_METADATA } ${ reportIDProp } ` ) ;
103+ const [ reportMetadata ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT_METADATA } ${ reportIDFromRoute } ` ) ;
106104 const reportID = report ?. reportID ;
107105
108106 const { reportActions : unfilteredReportActions , hasNewerActions, hasOlderActions} = usePaginatedReportActions ( reportID , route ?. params ?. reportActionID ) ;
109107 const reportActions = useMemo ( ( ) => getFilteredReportActionsForReportView ( unfilteredReportActions ) , [ unfilteredReportActions ] ) ;
110108
111- const allReportTransactions = useReportTransactionsCollection ( reportIDProp ) ;
109+ const allReportTransactions = useReportTransactionsCollection ( reportIDFromRoute ) ;
112110 const reportTransactions = useMemo ( ( ) => getAllNonDeletedTransactions ( allReportTransactions , reportActions , isOffline , true ) , [ allReportTransactions , reportActions , isOffline ] ) ;
113111 const transactions = useMemo (
114112 ( ) => reportTransactions ?. filter ( ( transaction ) => isOffline || transaction . pendingAction !== CONST . RED_BRICK_ROAD_PENDING_ACTION . DELETE ) ?? [ ] ,
0 commit comments