File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/components/PaginatedTable Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,17 @@ interface UseScrollBasedChunksProps {
1212}
1313
1414const THROTTLE_DELAY = 100 ;
15+ const CHUNKS_AHEAD_COUNT = 1 ;
1516
1617export const useScrollBasedChunks = ( {
1718 containerRef,
1819 totalItems,
1920 itemHeight,
2021 chunkSize,
2122} : UseScrollBasedChunksProps ) : number [ ] => {
22- const [ activeChunks , setActiveChunks ] = React . useState < number [ ] > ( [ 0 ] ) ;
23+ const [ activeChunks , setActiveChunks ] = React . useState < number [ ] > (
24+ getArray ( 1 + CHUNKS_AHEAD_COUNT ) . map ( ( index ) => index ) ,
25+ ) ;
2326
2427 const calculateActiveChunks = React . useCallback ( ( ) => {
2528 const container = containerRef . current ;
@@ -37,7 +40,7 @@ export const useScrollBasedChunks = ({
3740 const startChunk = Math . floor ( visibleStartIndex / chunkSize ) ;
3841 const endChunk = Math . floor ( visibleEndIndex / chunkSize ) ;
3942
40- const newActiveChunks = getArray ( endChunk - startChunk + 1 ) . map (
43+ const newActiveChunks = getArray ( endChunk - startChunk + 1 + CHUNKS_AHEAD_COUNT ) . map (
4144 ( index ) => startChunk + index ,
4245 ) ;
4346
You can’t perform that action at this time.
0 commit comments