Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 757d473

Browse files
authored
Fix automatic space switching wrongly going via Home for room aliases (#7247)
1 parent 2e82887 commit 757d473

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/stores/spaces/SpaceStore.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import {
5050
UPDATE_SUGGESTED_ROOMS,
5151
UPDATE_TOP_LEVEL_SPACES,
5252
} from ".";
53+
import { getCachedRoomIDForAlias } from "../../RoomAliasCache";
5354

5455
interface IState {}
5556

@@ -834,8 +835,14 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
834835
// Don't auto-switch rooms when reacting to a context-switch
835836
// as this is not helpful and can create loops of rooms/space switching
836837
if (payload.context_switch) break;
838+
let roomId = payload.room_id;
839+
840+
if (payload.room_alias && !roomId) {
841+
roomId = getCachedRoomIDForAlias(payload.room_alias);
842+
}
843+
844+
if (!roomId) return; // we'll get re-fired with the room ID shortly
837845

838-
const roomId = payload.room_id;
839846
const room = this.matrixClient?.getRoom(roomId);
840847
if (room?.isSpaceRoom()) {
841848
// Don't context switch when navigating to the space room

0 commit comments

Comments
 (0)