Remove GroupStore listener when unmounting GroupPublicityToggle
This commit is contained in:
parent
28e8ce967f
commit
38d7a5d394
1 changed files with 5 additions and 1 deletions
|
@ -40,7 +40,7 @@ export default React.createClass({
|
|||
},
|
||||
|
||||
_initGroupStore: function(groupId) {
|
||||
GroupStore.registerListener(groupId, () => {
|
||||
this._groupStoreToken = GroupStore.registerListener(groupId, () => {
|
||||
this.setState({
|
||||
isGroupPublicised: GroupStore.getGroupPublicity(groupId),
|
||||
ready: GroupStore.isStateReady(groupId, GroupStore.STATE_KEY.Summary),
|
||||
|
@ -48,6 +48,10 @@ export default React.createClass({
|
|||
});
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this._groupStoreToken) this._groupStoreToken.unregister();
|
||||
},
|
||||
|
||||
_onPublicityToggle: function(e) {
|
||||
e.stopPropagation();
|
||||
this.setState({
|
||||
|
|
Loading…
Reference in a new issue