-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,15 @@ class WorkspaceMembersPage extends React.Component { | |
this.validate(); | ||
} | ||
|
||
if (!_.isEqual(prevProps.policyMemberList, this.props.policyMemberList)) { | ||
this.setState((prevState) => { | ||
const selectedEmployees = _.filter(prevState.selectedEmployees, (selectedEmployee) => _.has(this.props.policyMemberList, selectedEmployee)); | ||
return { | ||
selectedEmployees, | ||
}; | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't you propose to use intersection? Is there something wrong with that? this.setState((prevState) => ({
selectedEmployees: _.intersection(prevState.selectedEmployees, this.props.policyMemberList),
})); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. selectedEmployees is a string array, but policyMemberList is an object that has key is an email of user There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, this should do it then this.setState((prevState) => ({
selectedEmployees: _.intersection(prevState.selectedEmployees, _.keys(this.props.policyMemberList)),
})); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The main purpose of my solution is the way to fix this issue and this code above is for illustration purposes only. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you apply the suggested fix There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @s77rt Sorry, I missed your suggestion above. I will update right now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @s77rt I just updated, please help to check again. |
||
} | ||
|
||
const isReconnecting = prevProps.network.isOffline && !this.props.network.isOffline; | ||
if (!isReconnecting) { | ||
return; | ||
|
There was a problem hiding this comment.
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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@s77rt I just updated.