Skip to content

Commit

Permalink
fix: 🐛 Improved Table loading state
Browse files Browse the repository at this point in the history
  • Loading branch information
luciobordonaro committed Oct 23, 2020
1 parent 609d747 commit c6f488e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ const Table: FC<ITable> = ({
render: () => (
<Checkbox
dataCy={getComposedDataCy(dataCy, SUBPARTS_MAP.selectAll)}
intermediate={!!selectedRows.length && selectedRows.length !== internalRows.length}
intermediate={!!selectedRows.length && selectedRows.length !== rows.length}
onChange={(selected) => onBulkSelection(selected)}
size={CheckboxSize.small}
value={selectedRows.length === internalRows.length}
value={loading ? false : selectedRows.length === rows.length}
/>
),
width: `${CHECKBOX_SELECTION_WIDTH}px`,
Expand All @@ -207,7 +207,7 @@ const Table: FC<ITable> = ({
}

return { defaultActions, internalColumns, rowActions, selectionActions };
}, [actions, columns, dataCy, internalRows, selectedRows, onBulkSelection, onSelectionChange]);
}, [actions, columns, dataCy, loading, rows, selectedRows, onBulkSelection, onSelectionChange]);

return (
<MUITableContainer component={MUIPaper} data-cy={dataCy} style={{ height, position: "relative" }}>
Expand Down Expand Up @@ -311,7 +311,7 @@ const Table: FC<ITable> = ({
</MUITableRow>
</MUITableHead>
<MUITableBody>
{!internalRows.length ? (
{!loading && !rows.length ? (
<MUITableRow key={`row-no-data`}>
<MUITableCell
key={`column-no-data`}
Expand Down

0 comments on commit c6f488e

Please sign in to comment.