From bf0605cf841efda2dde4ebe5c0befc9fe6a6fe0b Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 8 Apr 2019 11:17:27 -0600 Subject: [PATCH 1/2] Send breadcrumb updates only when they change Fixes an issue where hovering over the breadcrumbs could cause hundreds of web requests due to updates. This also fixes https://github.com/vector-im/riot-web/issues/9390 as the update is more reliable. --- src/components/views/rooms/RoomBreadcrumbs.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/views/rooms/RoomBreadcrumbs.js b/src/components/views/rooms/RoomBreadcrumbs.js index a45b8f257f..989e0a1305 100644 --- a/src/components/views/rooms/RoomBreadcrumbs.js +++ b/src/components/views/rooms/RoomBreadcrumbs.js @@ -88,11 +88,6 @@ export default class RoomBreadcrumbs extends React.Component { setTimeout(() => this.setState({rooms}), 0); } } - - const roomIds = rooms.map((r) => r.room.roomId); - if (roomIds.length > 0) { - SettingsStore.setValue("breadcrumb_rooms", null, SettingLevel.ACCOUNT, roomIds); - } } onAction(payload) { @@ -246,6 +241,11 @@ export default class RoomBreadcrumbs extends React.Component { if (this.refs.scroller) { this.refs.scroller.moveToOrigin(); } + + const roomIds = rooms.map((r) => r.room.roomId); + if (roomIds.length > 0) { + SettingsStore.setValue("breadcrumb_rooms", null, SettingLevel.ACCOUNT, roomIds); + } } _viewRoom(room, index) { From 43362bfb98f184888c8b389228e0e7825fb756b0 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 9 Apr 2019 09:40:49 -0600 Subject: [PATCH 2/2] Explain why the breadcrumbs don't need persisting elsewhere --- src/components/views/rooms/RoomBreadcrumbs.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/views/rooms/RoomBreadcrumbs.js b/src/components/views/rooms/RoomBreadcrumbs.js index 989e0a1305..273ade0e2a 100644 --- a/src/components/views/rooms/RoomBreadcrumbs.js +++ b/src/components/views/rooms/RoomBreadcrumbs.js @@ -242,6 +242,9 @@ export default class RoomBreadcrumbs extends React.Component { this.refs.scroller.moveToOrigin(); } + // We don't track room aesthetics (badges, membership, etc) over the wire so we + // don't need to do this elsewhere in the file. Just where we alter the room IDs + // and their order. const roomIds = rooms.map((r) => r.room.roomId); if (roomIds.length > 0) { SettingsStore.setValue("breadcrumb_rooms", null, SettingLevel.ACCOUNT, roomIds);