From 64a22236c3383f0879744b47c9e817e8b25ea51e Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 4 Apr 2019 16:21:57 -0600 Subject: [PATCH] Handle cases where the user rapidly clicks between rooms Once the user has breadcrumbs, there should always be breadcrumbs. Therefore it is safe to ignore any updates which have zero entries. --- src/components/views/rooms/RoomBreadcrumbs.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/RoomBreadcrumbs.js b/src/components/views/rooms/RoomBreadcrumbs.js index 0856ed892c..0950032aa2 100644 --- a/src/components/views/rooms/RoomBreadcrumbs.js +++ b/src/components/views/rooms/RoomBreadcrumbs.js @@ -88,7 +88,9 @@ export default class RoomBreadcrumbs extends React.Component { } const roomIds = rooms.map((r) => r.room.roomId); - SettingsStore.setValue("breadcrumb_rooms", null, SettingLevel.ACCOUNT, roomIds); + if (roomIds.length > 0) { + SettingsStore.setValue("breadcrumb_rooms", null, SettingLevel.ACCOUNT, roomIds); + } } onAction(payload) { @@ -147,6 +149,8 @@ export default class RoomBreadcrumbs extends React.Component { }; _loadRoomIds(roomIds) { + if (!roomIds || roomIds.length <= 0) return; // Skip updates with no rooms + // If we're here, the list changed. const rooms = roomIds.map((r) => MatrixClientPeg.get().getRoom(r)).filter((r) => r).map((r) => { const badges = this._calculateBadgesForRoom(r) || {};