diff --git a/CHANGELOG.md b/CHANGELOG.md index 4645e43bc15..28477d39219 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## [`main`](https://github.com/elastic/eui/tree/main) -No public interface changes since `41.2.1`. +**Bug fixes** + +- Fixed an `EuiDataGrid` bug where paginated overflowing data grids could become unscrollable when `rowCount` changed ([#5400](https://github.com/elastic/eui/pull/5400)) ## [`41.2.1`](https://github.com/elastic/eui/tree/v41.2.1) diff --git a/src/components/datagrid/body/data_grid_body.tsx b/src/components/datagrid/body/data_grid_body.tsx index 40dd820669f..3d77da0a3c7 100644 --- a/src/components/datagrid/body/data_grid_body.tsx +++ b/src/components/datagrid/body/data_grid_body.tsx @@ -596,11 +596,6 @@ export const EuiDataGridBody: FunctionComponent = ( makeRowManager(innerGridRef) ); - // reset height constraint when rowCount changes - useEffect(() => { - setHeight(undefined); - }, [rowCount]); - useEffect(() => { const boundingRect = wrapperRef.current!.getBoundingClientRect(); @@ -610,7 +605,7 @@ export const EuiDataGridBody: FunctionComponent = ( if (boundingRect.width !== unconstrainedWidth) { setWidth(boundingRect.width); } - }, [unconstrainedHeight, wrapperDimensions, isFullScreen]); + }, [rowCount, unconstrainedHeight, wrapperDimensions, isFullScreen]); const preventTabbing = useCallback((records: MutationRecord[]) => { // multiple mutation records can implicate the same cell