@@ -2,7 +2,7 @@ import React from 'react';
22
33import { throttle } from 'lodash' ;
44
5- import { operationsApi } from '../../store/reducers/operations' ;
5+ import { DEFAULT_PAGE_SIZE , operationsApi } from '../../store/reducers/operations' ;
66import type { OperationKind } from '../../types/api/operations' ;
77
88interface UseOperationsInfiniteQueryProps {
@@ -18,7 +18,7 @@ const DEFAULT_SCROLL_MARGIN = 100;
1818export function useOperationsInfiniteQuery ( {
1919 database,
2020 kind,
21- pageSize = 10 ,
21+ pageSize = DEFAULT_PAGE_SIZE ,
2222 searchValue,
2323 scrollContainerRef,
2424} : UseOperationsInfiniteQueryProps ) {
@@ -63,8 +63,14 @@ export function useOperationsInfiniteQuery({
6363 // Check after data updates
6464 React . useLayoutEffect ( ( ) => {
6565 if ( ! isFetchingNextPage ) {
66- checkAndLoadMorePages ( ) ;
66+ // RAF to ensure browser has completed layout and paint
67+ const raf = requestAnimationFrame ( ( ) => {
68+ checkAndLoadMorePages ( ) ;
69+ } ) ;
70+ return ( ) => cancelAnimationFrame ( raf ) ;
6771 }
72+
73+ return undefined ;
6874 } , [ data , isFetchingNextPage , checkAndLoadMorePages ] ) ;
6975
7076 // Scroll handler for infinite scrolling
0 commit comments