1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-10 09:22:25 +03:00

Remove GroupStore listener when unmounting GroupPublicityToggle

This commit is contained in:
Luke Barnard
2018-05-01 11:50:14 +01:00
parent 28e8ce967f
commit 38d7a5d394

View File

@@ -40,7 +40,7 @@ export default React.createClass({
}, },
_initGroupStore: function(groupId) { _initGroupStore: function(groupId) {
GroupStore.registerListener(groupId, () => { this._groupStoreToken = GroupStore.registerListener(groupId, () => {
this.setState({ this.setState({
isGroupPublicised: GroupStore.getGroupPublicity(groupId), isGroupPublicised: GroupStore.getGroupPublicity(groupId),
ready: GroupStore.isStateReady(groupId, GroupStore.STATE_KEY.Summary), 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) { _onPublicityToggle: function(e) {
e.stopPropagation(); e.stopPropagation();
this.setState({ this.setState({