You've already forked matrix-react-sdk
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:
@@ -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({
|
||||||
|
|||||||
Reference in New Issue
Block a user