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.
This commit is contained in:
Travis Ralston 2019-04-08 11:17:27 -06:00
parent 054011f5f8
commit bf0605cf84

View File

@ -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) {