diff --git a/packages/client/src/store/SelectionPeopleStore.js b/packages/client/src/store/SelectionPeopleStore.js index 605ff04781..88e15ce2a7 100644 --- a/packages/client/src/store/SelectionPeopleStore.js +++ b/packages/client/src/store/SelectionPeopleStore.js @@ -46,8 +46,15 @@ class SelectionStore { } updateSelection = (peopleList) => { + const hasSelection = !!this.selection.length; + const hasBufferSelection = !!this.bufferSelection; + peopleList.some((el) => { - if (el.id === this.selection[0].id) this.setSelection([el]); + if (hasSelection && this.selection[0].id === el.id) + this.setSelection([el]); + + if (hasBufferSelection && this.bufferSelection.id === el.id) + this.setBufferSelection(el); }); }; @@ -303,6 +310,10 @@ class SelectionStore { return this.selection.length > 0 && this.selection.length === 1; } + get isOnlyBufferSelection() { + return !this.selection.length && !!this.bufferSelection; + } + get hasFreeUsers() { const users = this.selection.filter( (x) => x.status !== EmployeeStatus.Disabled && x.isVisitor, diff --git a/packages/client/src/store/UsersStore.js b/packages/client/src/store/UsersStore.js index 0f35f354d8..c014b983dd 100644 --- a/packages/client/src/store/UsersStore.js +++ b/packages/client/src/store/UsersStore.js @@ -141,9 +141,10 @@ class UsersStore { get needResetUserSelection() { const { isVisible: infoPanelVisible } = this.infoPanelStore; - const { isOneUserSelection } = this.peopleStore.selectionStore; + const { isOneUserSelection, isOnlyBufferSelection } = + this.peopleStore.selectionStore; - return !infoPanelVisible || !isOneUserSelection; + return !infoPanelVisible || (!isOneUserSelection && !isOnlyBufferSelection); } updateUserStatus = async (status, userIds) => { return api.people.updateUserStatus(status, userIds).then((users) => {