@@ -121,6 +121,8 @@ function useDimensions(store: Store<BaseState>, params: VirtualizerParams, _api:
121
121
} ,
122
122
} = params ;
123
123
124
+ const containerNode = refs . container . current ;
125
+
124
126
const updateDimensions = React . useCallback ( ( ) => {
125
127
if ( isFirstSizing . current ) {
126
128
return ;
@@ -132,10 +134,7 @@ function useDimensions(store: Store<BaseState>, params: VirtualizerParams, _api:
132
134
// All the floating point dimensions should be rounded to .1 decimal places to avoid subpixel rendering issues
133
135
// https://github.com/mui/mui-x/issues/9550#issuecomment-1619020477
134
136
// https://github.com/mui/mui-x/issues/15721
135
- const scrollbarSize = measureScrollbarSize (
136
- params . refs . container . current ,
137
- params . dimensions . scrollbarSize ,
138
- ) ;
137
+ const scrollbarSize = measureScrollbarSize ( containerNode , params . dimensions . scrollbarSize ) ;
139
138
140
139
const topContainerHeight = topPinnedHeight + rowsMeta . pinnedTopRowsTotalHeight ;
141
140
const bottomContainerHeight = bottomPinnedHeight + rowsMeta . pinnedBottomRowsTotalHeight ;
@@ -234,7 +233,7 @@ function useDimensions(store: Store<BaseState>, params: VirtualizerParams, _api:
234
233
store . update ( { dimensions : newDimensions } ) ;
235
234
} , [
236
235
store ,
237
- params . refs . container ,
236
+ containerNode ,
238
237
params . dimensions . scrollbarSize ,
239
238
params . autoHeight ,
240
239
rowHeight ,
@@ -259,7 +258,7 @@ function useDimensions(store: Store<BaseState>, params: VirtualizerParams, _api:
259
258
) ;
260
259
React . useEffect ( ( ) => debouncedUpdateDimensions ?. clear , [ debouncedUpdateDimensions ] ) ;
261
260
262
- useLayoutEffect ( ( ) => observeRootNode ( refs . container . current , store ) , [ refs , store ] ) ;
261
+ useLayoutEffect ( ( ) => observeRootNode ( containerNode , store ) , [ containerNode , store ] ) ;
263
262
264
263
useLayoutEffect ( updateDimensions , [ updateDimensions ] ) ;
265
264
0 commit comments