@@ -48,7 +48,7 @@ export function Grid<
4848 const isRtl = useIsRtl ( element , dir ) ;
4949
5050 const {
51- getCellBounds : getColumnBounds ,
51+ cachedBounds : cachedColumnBounds ,
5252 getEstimatedSize : getEstimatedWidth ,
5353 startIndexOverscan : columnStartIndexOverscan ,
5454 startIndexVisible : columnStartIndexVisible ,
@@ -68,7 +68,7 @@ export function Grid<
6868 } ) ;
6969
7070 const {
71- getCellBounds : getRowBounds ,
71+ cachedBounds : cachedRowBounds ,
7272 getEstimatedSize : getEstimatedHeight ,
7373 startIndexOverscan : rowStartIndexOverscan ,
7474 startIndexVisible : rowStartIndexVisible ,
@@ -218,7 +218,8 @@ export function Grid<
218218 rowIndex <= rowStopIndexOverscan ;
219219 rowIndex ++
220220 ) {
221- const rowBounds = getRowBounds ( rowIndex ) ;
221+ const rowBounds = cachedRowBounds . getItemBounds ( rowIndex ) ;
222+ const rowOffset = rowBounds ?. scrollOffset ?? 0 ;
222223
223224 const columns : ReactNode [ ] = [ ] ;
224225
@@ -227,7 +228,8 @@ export function Grid<
227228 columnIndex <= columnStopIndexOverscan ;
228229 columnIndex ++
229230 ) {
230- const columnBounds = getColumnBounds ( columnIndex ) ;
231+ const columnBounds = cachedColumnBounds . getItemBounds ( columnIndex ) ;
232+ const columnOffset = columnBounds ?. scrollOffset ?? 0 ;
231233
232234 columns . push (
233235 < CellComponent
@@ -243,9 +245,9 @@ export function Grid<
243245 position : "absolute" ,
244246 left : isRtl ? undefined : 0 ,
245247 right : isRtl ? 0 : undefined ,
246- transform : `translate(${ isRtl ? - columnBounds . scrollOffset : columnBounds . scrollOffset } px, ${ rowBounds . scrollOffset } px)` ,
247- height : rowBounds . size ,
248- width : columnBounds . size
248+ transform : `translate(${ isRtl ? - columnOffset : columnOffset } px, ${ rowOffset } px)` ,
249+ height : rowBounds ? .size ,
250+ width : columnBounds ? .size
249251 } }
250252 />
251253 ) ;
@@ -260,13 +262,13 @@ export function Grid<
260262 }
261263 return children ;
262264 } , [
265+ cachedColumnBounds ,
266+ cachedRowBounds ,
263267 CellComponent ,
264268 cellProps ,
265269 columnCount ,
266270 columnStartIndexOverscan ,
267271 columnStopIndexOverscan ,
268- getColumnBounds ,
269- getRowBounds ,
270272 isRtl ,
271273 rowCount ,
272274 rowStartIndexOverscan ,
0 commit comments