Fixed switching between user lists in system console (#3409)

This commit is contained in:
Harrison Healey
2016-06-27 08:08:48 -04:00
committed by Joram Wilander
parent 11afa405ba
commit 5c70635bcd
2 changed files with 17 additions and 4 deletions

View File

@@ -2,6 +2,7 @@
// See License.txt for license information.
import React from 'react';
import 'bootstrap';
import ErrorBar from 'components/error_bar.jsx';
import AdminStore from 'stores/admin_store.jsx';

View File

@@ -43,6 +43,22 @@ export default class UserList extends React.Component {
componentDidMount() {
this.getCurrentTeamProfiles();
AdminStore.addAllTeamsChangeListener(this.onAllTeamsChange);
}
componentWillReceiveProps(nextProps) {
if (nextProps.params.team !== this.props.params.team) {
this.setState({
team: AdminStore.getTeam(nextProps.params.team)
});
this.getTeamProfiles(nextProps.params.team);
}
}
componentWillUnmount() {
AdminStore.removeAllTeamsChangeListener(this.onAllTeamsChange);
}
onAllTeamsChange() {
@@ -144,10 +160,6 @@ export default class UserList extends React.Component {
return null;
}
componentWillReceiveProps(newProps) {
this.getTeamProfiles(newProps.params.team);
}
render() {
if (!this.state.team) {
return null;