From 771dbff2acc09fb437e9eebf6b6a6cdbb7c3ce6f Mon Sep 17 00:00:00 2001 From: Nicholas Zuber Date: Mon, 5 Nov 2018 00:19:51 -0500 Subject: [PATCH] Fix bug with sign in/out triggering updates --- src/providers/Notifications.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/providers/Notifications.js b/src/providers/Notifications.js index 8d50387..cf008a6 100644 --- a/src/providers/Notifications.js +++ b/src/providers/Notifications.js @@ -65,11 +65,15 @@ class NotificationsProvider extends React.Component { } shouldComponentUpdate (nextProps, nextState) { - // Update if our state changes + // Update if our state changes. if ((this.state.loading !== nextState.loading) || (this.state.error !== nextState.error)) { 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. // All other props "changing" should NOT trigger a rerender. return this.props.notifications !== nextProps.notifications;