- componentDidUpdate(prevProps: Readonly<DataTableProps<T>>) {
- if (!arraysAreCongruent(prevProps.items, this.props.items)) {
- this.initializeCheckedList(this.props.items);
+ componentDidUpdate(prevProps: Readonly<DataTableProps<T>>, prevState: DataTableState) {
+ const { items } = this.props;
+ const { checkedList } = this.state;
+ if (!arraysAreCongruent(prevProps.items, items)) {
+ this.state.isSelected = false;
+ this.initializeCheckedList(items);
+ }
+ if (prevState.checkedList !== checkedList) {
+ window.localStorage.setItem('selectedRows', JSON.stringify(checkedList));