From 28e8ce967fe9d403c9697755f293f1e99ca8698c Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 1 May 2018 11:38:57 +0100 Subject: [PATCH] Correctly unregister group store listener when unmounting RoomList --- src/components/views/rooms/RoomList.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index 5be28ae6fa..b70c4a994e 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -97,7 +97,7 @@ module.exports = React.createClass({ if (tag[0] !== '+') { return; } - this.groupStoreToken = GroupStore.registerListener(tag, () => { + this._groupStoreToken = GroupStore.registerListener(tag, () => { // This group's rooms or members may have updated, update rooms for its tag this.updateVisibleRoomsForTag(dmRoomMap, tag); this.updateVisibleRooms(); @@ -179,7 +179,9 @@ module.exports = React.createClass({ } // NB: GroupStore is not a Flux.Store - this._groupStoreToken.unregister(); + if (this._groupStoreToken) { + this._groupStoreToken.unregister(); + } // cancel any pending calls to the rate_limited_funcs this._delayedRefreshRoomList.cancelPendingCall();