Properly updated FilteredUserList when the provided user list is changed (#2983)

This commit is contained in:
Harrison Healey
2016-05-12 21:35:55 -04:00
committed by Corey Hulen
parent 9a701b7e5b
commit 94f8be51f9

View File

@@ -43,6 +43,15 @@ class FilteredUserList extends React.Component {
};
}
componentWillUpdate(nextProps) {
// assume the user list is immutable
if (this.props.users !== nextProps.users) {
this.setState({
users: this.filterUsers(nextProps.teamMembers, nextProps.users)
});
}
}
componentDidUpdate(prevProps, prevState) {
if (prevState.filter !== this.state.filter) {
$(ReactDOM.findDOMNode(this.refs.userList)).scrollTop(0);