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.
This commit is contained in:
Travis Ralston 2019-04-04 16:21:57 -06:00
parent 406196e11c
commit 64a22236c3

View file

@ -88,7 +88,9 @@ export default class RoomBreadcrumbs extends React.Component {
} }
const roomIds = rooms.map((r) => r.room.roomId); 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) { onAction(payload) {
@ -147,6 +149,8 @@ export default class RoomBreadcrumbs extends React.Component {
}; };
_loadRoomIds(roomIds) { _loadRoomIds(roomIds) {
if (!roomIds || roomIds.length <= 0) return; // Skip updates with no rooms
// If we're here, the list changed. // If we're here, the list changed.
const rooms = roomIds.map((r) => MatrixClientPeg.get().getRoom(r)).filter((r) => r).map((r) => { const rooms = roomIds.map((r) => MatrixClientPeg.get().getRoom(r)).filter((r) => r).map((r) => {
const badges = this._calculateBadgesForRoom(r) || {}; const badges = this._calculateBadgesForRoom(r) || {};