Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remove button remains enabled when removing a user in other device #18934

Merged
merged 4 commits into from
May 15, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
format code
  • Loading branch information
dukenv0307 committed May 15, 2023
commit 3cfd6443da1aa8cf5234420e86a0d562c1f1c3de
9 changes: 5 additions & 4 deletions src/pages/workspace/WorkspaceMembersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ class WorkspaceMembersPage extends React.Component {
}

if (!_.isEqual(prevProps.policyMemberList, this.props.policyMemberList)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need deep comparison here (_.isEqual). Just a shallow comparison will do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@s77rt I just updated.

const selectedEmployees = _.filter(this.state.selectedEmployees, (selectedEmployee) => {
return _.has(this.props.policyMemberList, selectedEmployee);
this.setState((prevState) => {
const selectedEmployees = _.filter(prevState.selectedEmployees, (selectedEmployee) => _.has(this.props.policyMemberList, selectedEmployee));
return {
selectedEmployees,
};
});
this.setState({selectedEmployees});
}

const isReconnecting = prevProps.network.isOffline && !this.props.network.isOffline;
Expand Down Expand Up @@ -370,7 +372,6 @@ class WorkspaceMembersPage extends React.Component {
}

render() {
console.log(this.state.selectedEmployees);
const policyMemberList = lodashGet(this.props, 'policyMemberList', {});
const policyOwner = lodashGet(this.props.policy, 'owner');
const currentUserLogin = lodashGet(this.props.currentUserPersonalDetails, 'login');
Expand Down