From e7b3cbfdf40065bec5eddd85c8147e1a107ff22d Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 21 Feb 2019 19:21:32 -0700 Subject: [PATCH] Fix categorization of favourites and new rooms New rooms (joined, invited, created, etc) were being ignored because they matched the check as soon as the iterator hit a non-recents section. This fixes the check to ensure there's a positive ID on the room being in the tag (or not, in the case of new rooms) before lying to the rest of the function. Additionally, a fix for favourites has been included to stop the list expanding to fill the void - turns out it was inserting the room twice into the list, and this was breaking the tile rendering. The room sublist would allocate space for the tile, but React would prevent the tile from showing up because of duplicate keys. Fixes https://github.com/vector-im/riot-web/issues/8868 Fixes https://github.com/vector-im/riot-web/issues/8857 correctly --- src/stores/RoomListStore.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/stores/RoomListStore.js b/src/stores/RoomListStore.js index 9bf1f90da5..0a11c2774a 100644 --- a/src/stores/RoomListStore.js +++ b/src/stores/RoomListStore.js @@ -287,7 +287,11 @@ class RoomListStore extends Store { // Speed optimization: Skip the loop below if we're not going to do anything productive if (!hasRoom || LIST_ORDERS[key] !== 'recent') { listsClone[key] = this._state.lists[key]; - inserted = true; // Ensure that we don't try and sort the room into the tag + if (LIST_ORDERS[key] !== 'recent' && (hasRoom || targetTags.includes(key))) { + // Ensure that we don't try and sort the room into the tag + inserted = true; + doInsert = false; + } continue; } else { listsClone[key] = [];