Merge pull request #14844 from ramonlsouza/fix-undefined-user

fix: undefined user prop crash in userlist
This commit is contained in:
Ramón Souza 2022-04-18 17:10:06 -03:00 committed by GitHub
commit a80ead35db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -211,9 +211,9 @@ class UserListItem extends PureComponent {
componentDidUpdate() {
const { user, selectedUserId } = this.props;
const { selected } = this.state;
if (selectedUserId === user.userId && !selected) {
if (selectedUserId === user?.userId && !selected) {
this.setState({ selected: true });
} else if (selectedUserId !== user.userId && selected) {
} else if (selectedUserId !== user?.userId && selected) {
this.setState({ selected: false });
}
}