Use nextProps in componentWillReceiveProps (#76)

This commit is contained in:
Thomas Hopkins 2016-10-21 13:23:17 -07:00 committed by GitHub
parent 23a8676c19
commit 119113ca85
4 changed files with 8 additions and 8 deletions

View file

@ -24,8 +24,8 @@ class ChannelsListView extends Component {
this.props.actions.fetchChannels();
}
componentWillReceiveProps(props) {
const {currentChannelId} = props.channels;
componentWillReceiveProps(nextProps) {
const {currentChannelId} = nextProps.channels;
if (currentChannelId &&
currentChannelId !== this.props.channels.currentChannelId) {
Routes.goToPostsList();

View file

@ -28,9 +28,9 @@ class LoginView extends Component {
password: ''
};
componentWillReceiveProps(props) {
componentWillReceiveProps(nextProps) {
if (this.props.login.status === 'fetching' &&
props.login.status === 'fetched') {
nextProps.login.status === 'fetched') {
Routes.goToSelectTeam();
}
}

View file

@ -16,9 +16,9 @@ const propTypes = {
class Logout extends Component {
static propTypes = propTypes;
componentWillReceiveProps(newProps) {
componentWillReceiveProps(nextProps) {
if (this.props.logout.status === 'fetching' &&
newProps.logout.status === 'fetched') {
nextProps.logout.status === 'fetched') {
Routes.popTo('goToSelectServer');
}
}

View file

@ -27,8 +27,8 @@ export default class SelectTeamView extends Component {
this.props.actions.fetchTeams();
}
componentWillReceiveProps(props) {
const {currentTeamId} = props.teams;
componentWillReceiveProps(nextProps) {
const {currentTeamId} = nextProps.teams;
if (currentTeamId &&
currentTeamId !== this.props.teams.currentTeamId) {
Routes.goToChannelsList();