|
|
@ -13,6 +13,7 @@ import TableBody from 'Components/Table/TableBody';
|
|
|
|
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
|
|
|
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
|
|
|
|
import TablePager from 'Components/Table/TablePager';
|
|
|
|
import TablePager from 'Components/Table/TablePager';
|
|
|
|
import { align, icons } from 'Helpers/Props';
|
|
|
|
import { align, icons } from 'Helpers/Props';
|
|
|
|
|
|
|
|
import getRemovedItems from 'Utilities/Object/getRemovedItems';
|
|
|
|
import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
|
|
|
|
import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
|
|
|
|
import getSelectedIds from 'Utilities/Table/getSelectedIds';
|
|
|
|
import getSelectedIds from 'Utilities/Table/getSelectedIds';
|
|
|
|
import removeOldSelectedState from 'Utilities/Table/removeOldSelectedState';
|
|
|
|
import removeOldSelectedState from 'Utilities/Table/removeOldSelectedState';
|
|
|
@ -36,34 +37,28 @@ class Queue extends Component {
|
|
|
|
lastToggled: null,
|
|
|
|
lastToggled: null,
|
|
|
|
selectedState: {},
|
|
|
|
selectedState: {},
|
|
|
|
isPendingSelected: false,
|
|
|
|
isPendingSelected: false,
|
|
|
|
isConfirmRemoveModalOpen: false
|
|
|
|
isConfirmRemoveModalOpen: false,
|
|
|
|
|
|
|
|
items: props.items
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
shouldComponentUpdate(nextProps) {
|
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
// Don't update when fetching has completed if items have changed,
|
|
|
|
const {
|
|
|
|
// before books start fetching or when books start fetching.
|
|
|
|
items,
|
|
|
|
|
|
|
|
isFetching,
|
|
|
|
|
|
|
|
isBooksFetching
|
|
|
|
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
if (
|
|
|
|
this.props.isFetching &&
|
|
|
|
(!isBooksFetching && prevProps.isBooksFetching) ||
|
|
|
|
nextProps.isPopulated &&
|
|
|
|
(!isFetching && prevProps.isFetching) ||
|
|
|
|
hasDifferentItems(this.props.items, nextProps.items) &&
|
|
|
|
(hasDifferentItems(prevProps.items, items) && !items.some((e) => e.bookId))
|
|
|
|
nextProps.items.some((e) => e.bookId)
|
|
|
|
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!this.props.isBooksFetching && nextProps.isBooksFetching) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
|
|
|
|
if (hasDifferentItems(prevProps.items, this.props.items)) {
|
|
|
|
|
|
|
|
this.setState((state) => {
|
|
|
|
this.setState((state) => {
|
|
|
|
return removeOldSelectedState(state, prevProps.items);
|
|
|
|
return {
|
|
|
|
|
|
|
|
...removeOldSelectedState(state, getRemovedItems(prevProps.items, items)),
|
|
|
|
|
|
|
|
items
|
|
|
|
|
|
|
|
};
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -124,7 +119,6 @@ class Queue extends Component {
|
|
|
|
isFetching,
|
|
|
|
isFetching,
|
|
|
|
isPopulated,
|
|
|
|
isPopulated,
|
|
|
|
error,
|
|
|
|
error,
|
|
|
|
items,
|
|
|
|
|
|
|
|
isAuthorFetching,
|
|
|
|
isAuthorFetching,
|
|
|
|
isAuthorPopulated,
|
|
|
|
isAuthorPopulated,
|
|
|
|
isBooksFetching,
|
|
|
|
isBooksFetching,
|
|
|
@ -144,7 +138,8 @@ class Queue extends Component {
|
|
|
|
allUnselected,
|
|
|
|
allUnselected,
|
|
|
|
selectedState,
|
|
|
|
selectedState,
|
|
|
|
isConfirmRemoveModalOpen,
|
|
|
|
isConfirmRemoveModalOpen,
|
|
|
|
isPendingSelected
|
|
|
|
isPendingSelected,
|
|
|
|
|
|
|
|
items
|
|
|
|
} = this.state;
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
|
|
|
|
const isRefreshing = isFetching || isAuthorFetching || isBooksFetching || isRefreshMonitoredDownloadsExecuting;
|
|
|
|
const isRefreshing = isFetching || isAuthorFetching || isBooksFetching || isRefreshMonitoredDownloadsExecuting;
|
|
|
|