When headerSelected is computed in Selectable.prototype.componentWillReceiveProps(), the computation doesn’t factor in selectedRows (or rrows) with 0 length. This means that if, for example, I select all of the rows in a table and delete them, then the header checkbox will remain checked even though there are no rows selected (and none to be selected).
The code in componentWillReceiveProps() is currently:
const n = selectedRows.length;
this.setState({
headerSelected: n > 0 && n === rrows.length,
selectedRows
});
For tables with no rows, it probably also makes sense to disable the header checkbox since “select all” with an empty table isn’t really possible (at least it doesn’t mean much in practice).
When
headerSelected
is computed inSelectable.prototype.componentWillReceiveProps()
, the computation doesn’t factor inselectedRows
(orrrows
) with 0 length. This means that if, for example, I select all of the rows in a table and delete them, then the header checkbox will remain checked even though there are no rows selected (and none to be selected).The code in
componentWillReceiveProps()
is currently:It probably should be something like:
For tables with no rows, it probably also makes sense to disable the header checkbox since “select all” with an empty table isn’t really possible (at least it doesn’t mean much in practice).