summaryrefslogtreecommitdiffstats
path: root/webapp/components/notify_counts.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/notify_counts.jsx')
-rw-r--r--webapp/components/notify_counts.jsx11
1 files changed, 8 insertions, 3 deletions
diff --git a/webapp/components/notify_counts.jsx b/webapp/components/notify_counts.jsx
index acc64dfb0..9238c8736 100644
--- a/webapp/components/notify_counts.jsx
+++ b/webapp/components/notify_counts.jsx
@@ -32,17 +32,22 @@ export default class NotifyCounts extends React.Component {
this.onListenerChange = this.onListenerChange.bind(this);
this.state = getCountsStateFromStores();
+ this.mounted = false;
}
componentDidMount() {
+ this.mounted = true;
ChannelStore.addChangeListener(this.onListenerChange);
}
componentWillUnmount() {
+ this.mounted = false;
ChannelStore.removeChangeListener(this.onListenerChange);
}
onListenerChange() {
- var newState = getCountsStateFromStores();
- if (!utils.areObjectsEqual(newState, this.state)) {
- this.setState(newState);
+ if (this.mounted) {
+ var newState = getCountsStateFromStores();
+ if (!utils.areObjectsEqual(newState, this.state)) {
+ this.setState(newState);
+ }
}
}
render() {