Use nextProps in componentWillReceiveProps (#76)
This commit is contained in:
parent
23a8676c19
commit
119113ca85
4 changed files with 8 additions and 8 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue