Reference store token, call .remove on it on unmount

This commit is contained in:
Luke Barnard 2017-05-16 11:52:51 +01:00
parent 269fd51130
commit eb36e979c2
2 changed files with 8 additions and 8 deletions

View file

@ -69,16 +69,16 @@ module.exports = React.createClass({
componentWillMount: function() {
this._sessionStore = sessionStore;
this._removeSSListener = this._sessionStore.addListener(
this._sessionStoreToken = this._sessionStore.addListener(
this._setStateFromSessionStore,
).remove;
);
this._setStateFromSessionStore();
},
componentWillUnmount: function() {
if (this._removeSSListener) {
this._removeSSListener();
if (this._sessionStoreToken) {
this._sessionStoreToken.remove();
}
},