mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-13 16:43:58 -07:00
Fixed: Queue refresh closing manual import from queue if items change
Closes #1934
This commit is contained in:
parent
f0d1cde01a
commit
3ecfe846a0
2 changed files with 39 additions and 3 deletions
|
@ -31,6 +31,8 @@ class Queue extends Component {
|
|||
constructor(props, context) {
|
||||
super(props, context);
|
||||
|
||||
this._shouldBlockRefresh = false;
|
||||
|
||||
this.state = {
|
||||
allSelected: false,
|
||||
allUnselected: false,
|
||||
|
@ -42,6 +44,18 @@ class Queue extends Component {
|
|||
};
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps) {
|
||||
if (!this._shouldBlockRefresh) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (hasDifferentItems(this.props.items, nextProps.items)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
const {
|
||||
items,
|
||||
|
@ -84,6 +98,10 @@ class Queue extends Component {
|
|||
//
|
||||
// Listeners
|
||||
|
||||
onQueueRowModalOpenOrClose = (isOpen) => {
|
||||
this._shouldBlockRefresh = isOpen;
|
||||
}
|
||||
|
||||
onSelectAllChange = ({ value }) => {
|
||||
this.setState(selectAll(this.state.selectedState, value));
|
||||
}
|
||||
|
@ -99,16 +117,19 @@ class Queue extends Component {
|
|||
}
|
||||
|
||||
onRemoveSelectedPress = () => {
|
||||
this._shouldBlockRefresh = true;
|
||||
this.setState({ isConfirmRemoveModalOpen: true });
|
||||
}
|
||||
|
||||
onRemoveSelectedConfirmed = (payload) => {
|
||||
this.props.onRemoveSelectedPress({ ids: this.getSelectedIds(), ...payload });
|
||||
this.setState({ isConfirmRemoveModalOpen: false });
|
||||
this._shouldBlockRefresh = false;
|
||||
}
|
||||
|
||||
onConfirmRemoveModalClose = () => {
|
||||
this.setState({ isConfirmRemoveModalOpen: false });
|
||||
this._shouldBlockRefresh = false;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -209,7 +230,7 @@ class Queue extends Component {
|
|||
}
|
||||
|
||||
{
|
||||
isPopulated && !hasError && !items.length &&
|
||||
isAllPopulated && !hasError && !items.length &&
|
||||
<div>
|
||||
Queue is empty
|
||||
</div>
|
||||
|
@ -238,6 +259,7 @@ class Queue extends Component {
|
|||
columns={columns}
|
||||
{...item}
|
||||
onSelectedChange={this.onSelectedChange}
|
||||
onQueueRowModalOpenOrClose={this.onQueueRowModalOpenOrClose}
|
||||
/>
|
||||
);
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue