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

Commit a61f4c1

Browse files
committed
Auto-select space if joined whilst being viewed
1 parent 62172ba commit a61f4c1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/stores/SpaceStore.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {setHasDiff} from "../utils/sets";
3434
import {objectDiff} from "../utils/objects";
3535
import {arrayHasDiff} from "../utils/arrays";
3636
import {ISpaceSummaryEvent, ISpaceSummaryRoom} from "../components/structures/SpaceRoomDirectory";
37+
import RoomViewStore from "./RoomViewStore";
3738

3839
type SpaceKey = string | symbol;
3940

@@ -368,6 +369,11 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
368369
this.onRoomsUpdate();
369370
}
370371

372+
// if the user was looking at the room and then joined select that space
373+
if (room.getMyMembership() === "join" && room.roomId === RoomViewStore.getRoomId()) {
374+
this.setActiveSpace(room);
375+
}
376+
371377
const numSuggestedRooms = this._suggestedRooms.length;
372378
this._suggestedRooms = this._suggestedRooms.filter(r => r.room_id !== room.roomId);
373379
if (numSuggestedRooms !== this._suggestedRooms.length) {

0 commit comments

Comments
 (0)