diff --git a/src/stores/SpaceStore.tsx b/src/stores/SpaceStore.tsx index e4b537169e..bcf95a82be 100644 --- a/src/stores/SpaceStore.tsx +++ b/src/stores/SpaceStore.tsx @@ -34,6 +34,7 @@ import {setHasDiff} from "../utils/sets"; import {objectDiff} from "../utils/objects"; import {arrayHasDiff} from "../utils/arrays"; import {ISpaceSummaryEvent, ISpaceSummaryRoom} from "../components/structures/SpaceRoomDirectory"; +import RoomViewStore from "./RoomViewStore"; type SpaceKey = string | symbol; @@ -368,6 +369,11 @@ export class SpaceStoreClass extends AsyncStoreWithClient { this.onRoomsUpdate(); } + // if the user was looking at the room and then joined select that space + if (room.getMyMembership() === "join" && room.roomId === RoomViewStore.getRoomId()) { + this.setActiveSpace(room); + } + const numSuggestedRooms = this._suggestedRooms.length; this._suggestedRooms = this._suggestedRooms.filter(r => r.room_id !== room.roomId); if (numSuggestedRooms !== this._suggestedRooms.length) {