@@ -2,7 +2,7 @@ import React from 'react';
2
2
3
3
import { throttle } from 'lodash' ;
4
4
5
- import { operationsApi } from '../../store/reducers/operations' ;
5
+ import { DEFAULT_PAGE_SIZE , operationsApi } from '../../store/reducers/operations' ;
6
6
import type { OperationKind } from '../../types/api/operations' ;
7
7
8
8
interface UseOperationsInfiniteQueryProps {
@@ -18,7 +18,7 @@ const DEFAULT_SCROLL_MARGIN = 100;
18
18
export function useOperationsInfiniteQuery ( {
19
19
database,
20
20
kind,
21
- pageSize = 10 ,
21
+ pageSize = DEFAULT_PAGE_SIZE ,
22
22
searchValue,
23
23
scrollContainerRef,
24
24
} : UseOperationsInfiniteQueryProps ) {
@@ -63,8 +63,14 @@ export function useOperationsInfiniteQuery({
63
63
// Check after data updates
64
64
React . useLayoutEffect ( ( ) => {
65
65
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 ) ;
67
71
}
72
+
73
+ return undefined ;
68
74
} , [ data , isFetchingNextPage , checkAndLoadMorePages ] ) ;
69
75
70
76
// Scroll handler for infinite scrolling
0 commit comments