From 408f13f68cd508a37a76931998b66cdb5f9aa1cc Mon Sep 17 00:00:00 2001 From: lukebarnard Date: Mon, 15 Jan 2018 14:42:41 +0000 Subject: [PATCH] Only set selected tags state when updating rooms instead of every time we get an update from a GroupStore/otherwise. This was leading to many setStates and renders at startup when we receive many group /members /rooms etc. responses. Also, use the rate limited version of refreshRoomList. --- src/components/views/rooms/RoomList.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js index d1e00bd302..d1ef6c2f2c 100644 --- a/src/components/views/rooms/RoomList.js +++ b/src/components/views/rooms/RoomList.js @@ -324,12 +324,7 @@ module.exports = React.createClass({ // Show all rooms this._visibleRooms = MatrixClientPeg.get().getRooms(); } - - this.setState({ - selectedTags, - }, () => { - this.refreshRoomList(); - }); + this._delayedRefreshRoomList(); }, refreshRoomList: function() { @@ -345,6 +340,9 @@ module.exports = React.createClass({ this.setState({ lists: this.getRoomLists(), totalRoomCount: totalRooms, + // Do this here so as to not render every time the selected tags + // themselves change. + selectedTags: TagOrderStore.getSelectedTags(), }); // this._lastRefreshRoomListTs = Date.now();