From 51b1ba13c1b9dc9e26469c728e3871d4b7da0788 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 2 Dec 2022 17:27:54 -0800 Subject: [PATCH] Fixed: Grab/remove queue actions not showing spinner --- frontend/src/Activity/Queue/Queue.js | 32 ++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/frontend/src/Activity/Queue/Queue.js b/frontend/src/Activity/Queue/Queue.js index 61de3b6ba..cd030a166 100644 --- a/frontend/src/Activity/Queue/Queue.js +++ b/frontend/src/Activity/Queue/Queue.js @@ -72,13 +72,23 @@ class Queue extends Component { return; } + const nextState = {}; + + if (prevProps.items !== items) { + nextState.items = items; + } + const selectedIds = this.getSelectedIds(); const isPendingSelected = _.some(this.props.items, (item) => { return selectedIds.indexOf(item.id) > -1 && item.status === 'delay'; }); if (isPendingSelected !== this.state.isPendingSelected) { - this.setState({ isPendingSelected }); + nextState.isPendingSelected = isPendingSelected; + } + + if (!_.isEmpty(nextState)) { + this.setState(nextState); } } @@ -211,26 +221,29 @@ class Queue extends Component { { - isRefreshing && !isAllPopulated && - + isRefreshing && !isAllPopulated ? + : + null } { - !isRefreshing && hasError && + !isRefreshing && hasError ?
Failed to load Queue -
+ : + null } { - isAllPopulated && !hasError && !items.length && + isAllPopulated && !hasError && !items.length ?
Queue is empty -
+ : + null } { - isAllPopulated && !hasError && !!items.length && + isAllPopulated && !hasError && !!items.length ?
- + : + null }