Skip to content

Commit

Permalink
fix: fix issue 386 (#437)
Browse files Browse the repository at this point in the history
Signed-off-by: eugenejahn <[email protected]>
  • Loading branch information
eugenejahn authored Apr 28, 2022
1 parent c404c81 commit 4ff7cdd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/zapp/console/src/components/Tables/DataList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const DataListImplComponent: React.RefForwardingComponent<DataListRef, DataListI
* thrown away immediately. So we're using a creation function which useState
* will call to create the initial value.
*/
const [cellCache] = React.useState(createCellMeasurerCache);
const [cellCache, setCellCache] = React.useState(createCellMeasurerCache);

const recomputeRow = React.useMemo(
() => (rowIndex: number) => {
Expand All @@ -115,6 +115,9 @@ const DataListImplComponent: React.RefForwardingComponent<DataListRef, DataListI
recomputeRow(lengthRef.current);
}
lengthRef.current = props.value.length;

// remesuare each row and cache the value when the rows update
setCellCache(createCellMeasurerCache);
}, [items.length]);

const headerHeight = theme.spacing(headerGridHeight);
Expand Down

0 comments on commit 4ff7cdd

Please sign in to comment.