diff --git a/packages/eui/src/components/datagrid/body/data_grid_body_virtualized.tsx b/packages/eui/src/components/datagrid/body/data_grid_body_virtualized.tsx index 822d64544f8d..7f6b0caa392a 100644 --- a/packages/eui/src/components/datagrid/body/data_grid_body_virtualized.tsx +++ b/packages/eui/src/components/datagrid/body/data_grid_body_virtualized.tsx @@ -277,7 +277,6 @@ export const EuiDataGridBodyVirtualized: FunctionComponent */ const { finalWidth, finalHeight } = useFinalGridDimensions({ unconstrainedHeight, - unconstrainedWidth: 0, // unable to determine this until the container's size is known wrapperDimensions, wrapperRef, isFullScreen, diff --git a/packages/eui/src/components/datagrid/utils/grid_height_width.ts b/packages/eui/src/components/datagrid/utils/grid_height_width.ts index 7c66fe64d90d..166b3a20b734 100644 --- a/packages/eui/src/components/datagrid/utils/grid_height_width.ts +++ b/packages/eui/src/components/datagrid/utils/grid_height_width.ts @@ -22,14 +22,12 @@ import { DataGridSortedContext } from './sorting'; export const useFinalGridDimensions = ({ unconstrainedHeight, - unconstrainedWidth, wrapperDimensions, wrapperRef, isFullScreen, rowCount, }: { unconstrainedHeight: number; - unconstrainedWidth: number; wrapperDimensions: { width: number; height: number }; wrapperRef: MutableRefObject; isFullScreen: boolean; @@ -69,16 +67,13 @@ export const useFinalGridDimensions = ({ useEffect(() => { if (!wrapperRef.current) return; const wrapperWidth = wrapperRef.current.getBoundingClientRect().width; - - if (wrapperWidth !== unconstrainedWidth) { - setWidth(wrapperWidth); - } - }, [wrapperDimensions.width, unconstrainedWidth, wrapperRef]); + setWidth(wrapperWidth); + }, [wrapperDimensions.width, wrapperRef]); const finalHeight = isFullScreen ? fullScreenHeight : height || unconstrainedHeight; - const finalWidth = width || unconstrainedWidth; + const finalWidth = width || 0; return IS_JEST_ENVIRONMENT ? {