Fix automatic space switching behaviour to prioritise canonical parents

pull/21833/head
Michael Telatynski 2021-04-23 14:45:34 +01:00
parent 4446022327
commit f5ab75cfdd
1 changed files with 2 additions and 5 deletions

View File

@ -540,15 +540,12 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
// as this is not helpful and can create loops of rooms/space switching // as this is not helpful and can create loops of rooms/space switching
if (!room || payload.context_switch) break; if (!room || payload.context_switch) break;
// persist last viewed room from a space
if (room.isSpaceRoom()) { if (room.isSpaceRoom()) {
this.setActiveSpace(room); this.setActiveSpace(room);
} else if (!this.getSpaceFilteredRoomIds(this.activeSpace).has(room.roomId)) { } else if (!this.getSpaceFilteredRoomIds(this.activeSpace).has(room.roomId)) {
// TODO maybe reverse these first 2 clauses once space panel active is fixed let parent = this.getCanonicalParent(room.roomId);
let parent = this.rootSpaces.find(s => this.spaceFilteredRooms.get(s.roomId)?.has(room.roomId));
if (!parent) { if (!parent) {
parent = this.getCanonicalParent(room.roomId); parent = this.rootSpaces.find(s => this.spaceFilteredRooms.get(s.roomId)?.has(room.roomId));
} }
if (!parent) { if (!parent) {
const parents = Array.from(this.parentMap.get(room.roomId) || []); const parents = Array.from(this.parentMap.get(room.roomId) || []);