File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
src/views/workflow-history/hooks Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ export default function useWorkflowHistoryFetcher(
2525) {
2626 const queryClient = useQueryClient ( ) ;
2727 const fetcherRef = useRef < WorkflowHistoryFetcher | null > ( null ) ;
28- const lastFlattenedPagesCountRef = useRef < number > ( - 1 ) ;
2928
3029 if ( ! fetcherRef . current ) {
3130 fetcherRef . current = new WorkflowHistoryFetcher ( queryClient , params ) ;
@@ -46,12 +45,13 @@ export default function useWorkflowHistoryFetcher(
4645
4746 useEffect ( ( ) => {
4847 if ( ! fetcherRef . current ) return ;
48+ let lastFlattenedPagesCount = - 1 ;
4949 const unsubscribe = fetcherRef . current . onChange ( ( state ) => {
5050 const pagesCount = state . data ?. pages ?. length || 0 ;
5151 // If the pages count is greater than the last flattened pages count, then we need to flatten the pages and call the onEventsChange callback
5252 // Depending on ref variable instead of historyQuery is because historyQuery is throttled.
53- if ( pagesCount > lastFlattenedPagesCountRef . current ) {
54- lastFlattenedPagesCountRef . current = pagesCount ;
53+ if ( pagesCount > lastFlattenedPagesCount ) {
54+ lastFlattenedPagesCount = pagesCount ;
5555 onEventsChange (
5656 state . data ?. pages ?. flatMap ( ( page ) => page . history ?. events || [ ] ) || [ ]
5757 ) ;
You can’t perform that action at this time.
0 commit comments