Fix NaN height issue

This commit is contained in:
Laurent Nguyen 2024-02-29 13:51:03 +01:00
parent 82c7760af2
commit cccb7f5c73
2 changed files with 2 additions and 9 deletions

View File

@ -448,16 +448,9 @@ const DocumentsTabComponent: React.FunctionComponent<{
if (!tableContainerRef.current) { if (!tableContainerRef.current) {
return undefined; return undefined;
} }
const resizeObserver = new ResizeObserver(() => setTableContainerHeightPx(tableContainerRef.current.offsetHeight));
const resizeObserver = new ResizeObserver(() => {
// Do what you want to do when the size of the element changes
setTableContainerHeightPx(tableContainerRef.current.offsetHeight);
console.log('height', tableContainerRef.current.offsetHeight);
});
resizeObserver.observe(tableContainerRef.current); resizeObserver.observe(tableContainerRef.current);
return () => resizeObserver.disconnect(); // clean up return () => resizeObserver.disconnect(); // clean up
}, []); }, []);
return <FluentProvider theme={dataExplorerLightTheme} style={{ height: "100%" }}> return <FluentProvider theme={dataExplorerLightTheme} style={{ height: "100%" }}>

View File

@ -235,7 +235,7 @@ export const DocumentsTableComponent: React.FC<IDocumentsTableComponentProps> =
</TableHeader> </TableHeader>
<TableBody style={{ height: "100%", flex: 1 }}> <TableBody style={{ height: "100%", flex: 1 }}>
<List <List
height={height - 32} height={height !== undefined ? height - 32 : 0}
itemCount={items.length} itemCount={items.length}
itemSize={45} itemSize={45}
width="100%" width="100%"