File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
packages/grid/_modules_/grid/hooks/features/dimensions Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,8 @@ export function useGridDimensions(
176176
177177 const debounceResize = React . useMemo ( ( ) => debounce ( resize , 60 ) , [ resize ] ) ;
178178
179+ const isFirstSizing = React . useRef ( true ) ;
180+
179181 const handleResize = React . useCallback (
180182 ( size : ElementSize ) => {
181183 rootDimensionsRef . current = size ;
@@ -213,6 +215,14 @@ export function useGridDimensions(
213215 if ( isTestEnvironment ) {
214216 // We don't need to debounce the resize for tests.
215217 resize ( ) ;
218+ isFirstSizing . current = false ;
219+ return ;
220+ }
221+
222+ if ( isFirstSizing . current ) {
223+ // We want to initialize the grid dimensions as soon as possible to avoid flickering
224+ resize ( ) ;
225+ isFirstSizing . current = false ;
216226 return ;
217227 }
218228
You can’t perform that action at this time.
0 commit comments