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

Fix being wrongly sent to Home space when creating/joining/leaving rooms #7418

Merged
merged 3 commits into from
Dec 23, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/stores/spaces/SpaceStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -768,11 +768,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {

private switchSpaceIfNeeded = throttle(() => {
const roomId = RoomViewStore.getRoomId();
if (this.isRoomInSpace(this.activeSpace, roomId)) return;

if (this.matrixClient.getRoom(roomId)?.isSpaceRoom()) {
this.goToFirstSpace(true);
} else {
if (!this.isRoomInSpace(this.activeSpace, roomId) && !this.matrixClient.getRoom(roomId)?.isSpaceRoom()) {
this.switchToRelatedSpace(roomId);
}
}, 100, { leading: true, trailing: true });
Expand Down Expand Up @@ -1069,9 +1065,9 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {

switch (payload.action) {
case "view_room": {
// Don't auto-switch rooms when reacting to a context-switch
// Don't auto-switch rooms when reacting to a context-switch or for new rooms being created
// as this is not helpful and can create loops of rooms/space switching
if (payload.context_switch) break;
if (payload.context_switch || payload.justCreatedOpts) break;
let roomId = payload.room_id;

if (payload.room_alias && !roomId) {
Expand Down