fix: skip rendering list when data is empty
This commit is contained in:
parent
cfb360ab4e
commit
044090a8f1
1 changed files with 18 additions and 16 deletions
|
|
@ -185,22 +185,24 @@ const DataTable = ({
|
||||||
<TBody className={classes.body}>
|
<TBody className={classes.body}>
|
||||||
{loading && <H4>Loading...</H4>}
|
{loading && <H4>Loading...</H4>}
|
||||||
{!loading && R.isEmpty(data) && <EmptyTable message={emptyText} />}
|
{!loading && R.isEmpty(data) && <EmptyTable message={emptyText} />}
|
||||||
<AutoSizer disableWidth>
|
{!R.isEmpty(data) && (
|
||||||
{({ height }) => (
|
<AutoSizer disableWidth>
|
||||||
<List
|
{({ height }) => (
|
||||||
// this has to be in a style because of how the component works
|
<List
|
||||||
style={{ overflow: 'inherit', outline: 'none' }}
|
// this has to be in a style because of how the component works
|
||||||
{...props}
|
style={{ overflow: 'inherit', outline: 'none' }}
|
||||||
height={loading ? 0 : height}
|
{...props}
|
||||||
width={width}
|
height={loading ? 0 : height}
|
||||||
rowCount={data.length}
|
width={width}
|
||||||
rowHeight={cache.rowHeight}
|
rowCount={data.length}
|
||||||
rowRenderer={rowRenderer}
|
rowHeight={cache.rowHeight}
|
||||||
overscanRowCount={5}
|
rowRenderer={rowRenderer}
|
||||||
deferredMeasurementCache={cache}
|
overscanRowCount={5}
|
||||||
/>
|
deferredMeasurementCache={cache}
|
||||||
)}
|
/>
|
||||||
</AutoSizer>
|
)}
|
||||||
|
</AutoSizer>
|
||||||
|
)}
|
||||||
</TBody>
|
</TBody>
|
||||||
</Table>
|
</Table>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue