From 20ae49832c7f0774b0d5a15ea93a63cba48a98b6 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Mon, 15 May 2023 23:28:26 +0700 Subject: [PATCH] change method update selectedEmplyees --- src/pages/workspace/WorkspaceMembersPage.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js index d1da8bcf9708..1ba01ddeae34 100644 --- a/src/pages/workspace/WorkspaceMembersPage.js +++ b/src/pages/workspace/WorkspaceMembersPage.js @@ -97,12 +97,9 @@ class WorkspaceMembersPage extends React.Component { } if (prevProps.policyMemberList !== this.props.policyMemberList) { - this.setState((prevState) => { - const selectedEmployees = _.filter(prevState.selectedEmployees, (selectedEmployee) => _.has(this.props.policyMemberList, selectedEmployee)); - return { - selectedEmployees, - }; - }); + this.setState((prevState) => ({ + selectedEmployees: _.intersection(prevState.selectedEmployees, _.keys(this.props.policyMemberList)), + })); } const isReconnecting = prevProps.network.isOffline && !this.props.network.isOffline;