mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 11:47:23 +03:00
Fix Spaces NPE when a room with no tags gains its first tag
This commit is contained in:
parent
b2e9f6731b
commit
ace8d59a2a
1 changed files with 3 additions and 3 deletions
|
@ -446,11 +446,11 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private onRoomAccountData = (ev: MatrixEvent, room: Room, lastEvent: MatrixEvent) => {
|
private onRoomAccountData = (ev: MatrixEvent, room: Room, lastEvent?: MatrixEvent) => {
|
||||||
if (ev.getType() === EventType.Tag && !room.isSpaceRoom()) {
|
if (ev.getType() === EventType.Tag && !room.isSpaceRoom()) {
|
||||||
// If the room was in favourites and now isn't or the opposite then update its position in the trees
|
// If the room was in favourites and now isn't or the opposite then update its position in the trees
|
||||||
const oldTags = lastEvent.getContent()?.tags;
|
const oldTags = lastEvent?.getContent()?.tags || {};
|
||||||
const newTags = ev.getContent()?.tags;
|
const newTags = ev.getContent()?.tags || {};
|
||||||
if (!!oldTags[DefaultTagID.Favourite] !== !!newTags[DefaultTagID.Favourite]) {
|
if (!!oldTags[DefaultTagID.Favourite] !== !!newTags[DefaultTagID.Favourite]) {
|
||||||
this.onRoomUpdate(room);
|
this.onRoomUpdate(room);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue