Skip to content

Commit 00ed696

Browse files
committed
recompute grid height when rowCount changes
1 parent c4790bc commit 00ed696

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/components/datagrid/data_grid.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,13 +687,18 @@ export const EuiDataGrid: FunctionComponent<EuiDataGridProps> = (props) => {
687687
// this triggers a double re-render when the grid is switched from constrained to unconstrained
688688
// but in reality ... maybe don't do that?
689689
const [gridHeight, setGridHeight] = useState(IS_JEST_ENVIRONMENT ? 500 : 0);
690+
const pageSize = pagination?.pageSize;
690691
useEffect(() => {
691692
if (height == null) {
692693
// if already 0 this update will be ignored
693694
// if not already 0, this resets the height constraint so a new value can be observed
694695
setGridHeight(0);
695696
}
696-
}, [height, pagination?.pageSize]);
697+
}, [
698+
height,
699+
pageSize,
700+
rowCount, // recompute height if the rowCount changes
701+
]);
697702

698703
const [containerRef, _setContainerRef] = useState<HTMLDivElement | null>(
699704
null

0 commit comments

Comments
 (0)