@@ -38,7 +38,6 @@ function useLoadReportActions({reportID, reportActions, allReportActionIDs, tran
3838
3939 const isTransactionThreadReport = ! isEmptyObject ( transactionThreadReport ) ;
4040
41- // Track oldest/newest actions per report in a single pass
4241 let currentReportNewestAction = null ;
4342 let currentReportOldestAction = null ;
4443 let transactionThreadNewestAction = null ;
@@ -68,11 +67,6 @@ function useLoadReportActions({reportID, reportActions, allReportActionIDs, tran
6867 }
6968 }
7069
71- const currentReportOldest = currentReportOldestAction ;
72- const currentReportNewest = currentReportNewestAction ;
73- const transactionThreadOldest = transactionThreadOldestAction ;
74- const transactionThreadNewest = transactionThreadNewestAction ;
75-
7670 /**
7771 * Retrieves the next set of reportActions for the chat once we are nearing the end of what we are currently
7872 * displaying.
@@ -89,10 +83,10 @@ function useLoadReportActions({reportID, reportActions, allReportActionIDs, tran
8983 }
9084
9185 if ( isTransactionThreadReport ) {
92- getOlderActions ( reportID , currentReportOldest ?. reportActionID ) ;
93- getOlderActions ( transactionThreadReport ?. reportID , transactionThreadOldest ?. reportActionID ) ;
86+ getOlderActions ( reportID , currentReportOldestAction ?. reportActionID ) ;
87+ getOlderActions ( transactionThreadReport ?. reportID , transactionThreadOldestAction ?. reportActionID ) ;
9488 } else {
95- getOlderActions ( reportID , currentReportOldest ?. reportActionID ) ;
89+ getOlderActions ( reportID , currentReportOldestAction ?. reportActionID ) ;
9690 }
9791 } ;
9892
@@ -111,8 +105,8 @@ function useLoadReportActions({reportID, reportActions, allReportActionIDs, tran
111105 }
112106
113107 if ( isTransactionThreadReport ) {
114- getNewerActions ( reportID , currentReportNewest ?. reportActionID ) ;
115- getNewerActions ( transactionThreadReport . reportID , transactionThreadNewest ?. reportActionID ) ;
108+ getNewerActions ( reportID , currentReportNewestAction ?. reportActionID ) ;
109+ getNewerActions ( transactionThreadReport . reportID , transactionThreadNewestAction ?. reportActionID ) ;
116110 } else if ( newestReportAction ) {
117111 getNewerActions ( reportID , newestReportAction . reportActionID ) ;
118112 }
0 commit comments