diff --git a/frontend/src/Activity/Queue/Queue.js b/frontend/src/Activity/Queue/Queue.js index 010dea06f..809f7f11f 100644 --- a/frontend/src/Activity/Queue/Queue.js +++ b/frontend/src/Activity/Queue/Queue.js @@ -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, @@ -82,6 +96,10 @@ class Queue extends Component { // // Listeners + onQueueRowModalOpenOrClose = (isOpen) => { + this._shouldBlockRefresh = isOpen; + } + onSelectAllChange = ({ value }) => { this.setState(selectAll(this.state.selectedState, value)); } @@ -97,16 +115,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; } // @@ -205,7 +226,7 @@ class Queue extends Component { } { - isPopulated && !hasError && !items.length && + isAllPopulated && !hasError && !items.length &&