From 119113ca8540a84331cd6d7a55e5a00c15ac646d Mon Sep 17 00:00:00 2001 From: Thomas Hopkins Date: Fri, 21 Oct 2016 13:23:17 -0700 Subject: [PATCH] Use nextProps in componentWillReceiveProps (#76) --- src/components/channels_list_view.js | 4 ++-- src/components/login_view.js | 4 ++-- src/components/logout.js | 4 ++-- src/components/select_team_view.js | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/channels_list_view.js b/src/components/channels_list_view.js index f05c9dd88..e9c02fbb7 100644 --- a/src/components/channels_list_view.js +++ b/src/components/channels_list_view.js @@ -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(); diff --git a/src/components/login_view.js b/src/components/login_view.js index 53358776a..d004381a7 100644 --- a/src/components/login_view.js +++ b/src/components/login_view.js @@ -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(); } } diff --git a/src/components/logout.js b/src/components/logout.js index 65be3d53f..49a78e22e 100644 --- a/src/components/logout.js +++ b/src/components/logout.js @@ -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'); } } diff --git a/src/components/select_team_view.js b/src/components/select_team_view.js index db06ebd33..74978468b 100644 --- a/src/components/select_team_view.js +++ b/src/components/select_team_view.js @@ -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();