mirror of
https://github.com/nickzuber/meteorite.git
synced 2024-09-11 11:36:03 +03:00
Fix bug with sign in/out triggering updates
This commit is contained in:
parent
e1a18b057e
commit
771dbff2ac
@ -65,11 +65,15 @@ class NotificationsProvider extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
shouldComponentUpdate (nextProps, nextState) {
|
shouldComponentUpdate (nextProps, nextState) {
|
||||||
// Update if our state changes
|
// Update if our state changes.
|
||||||
if ((this.state.loading !== nextState.loading) ||
|
if ((this.state.loading !== nextState.loading) ||
|
||||||
(this.state.error !== nextState.error)) {
|
(this.state.error !== nextState.error)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// Update if the token changes at all (sign in & sign out).
|
||||||
|
if (this.props.token !== nextProps.token) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// Only update if our notifications prop changes.
|
// Only update if our notifications prop changes.
|
||||||
// All other props "changing" should NOT trigger a rerender.
|
// All other props "changing" should NOT trigger a rerender.
|
||||||
return this.props.notifications !== nextProps.notifications;
|
return this.props.notifications !== nextProps.notifications;
|
||||||
|
Loading…
Reference in New Issue
Block a user