Merge pull request #5894 from matrix-org/t3chguy/fix/17026

Fix issue with spaces context switching looping and breaking
pull/21833/head
Michael Telatynski 2021-04-21 09:11:26 +01:00 committed by GitHub
commit bae47bbd79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -124,11 +124,13 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
defaultDispatcher.dispatch({ defaultDispatcher.dispatch({
action: "view_room", action: "view_room",
room_id: roomId, room_id: roomId,
context_switch: true,
}); });
} else if (space) { } else if (space) {
defaultDispatcher.dispatch({ defaultDispatcher.dispatch({
action: "view_room", action: "view_room",
room_id: space.roomId, room_id: space.roomId,
context_switch: true,
}); });
} else { } else {
defaultDispatcher.dispatch({ defaultDispatcher.dispatch({
@ -513,6 +515,10 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
case "view_room": { case "view_room": {
const room = this.matrixClient?.getRoom(payload.room_id); const room = this.matrixClient?.getRoom(payload.room_id);
// Don't auto-switch rooms when reacting to a context-switch
// as this is not helpful and can create loops of rooms/space switching
if (payload.context_switch) break;
// persist last viewed room from a space // persist last viewed room from a space
// Don't save if the room is a space room. This would cause a problem: // Don't save if the room is a space room. This would cause a problem: