mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 05:04:57 +08:00
Fix issue with spaces context switching looping and breaking
This commit is contained in:
parent
b2e9f6731b
commit
ecd9b8d6de
@ -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
|
||||||
if (room) {
|
if (room) {
|
||||||
window.localStorage.setItem(getLastViewedRoomsStorageKey(this.activeSpace), payload.room_id);
|
window.localStorage.setItem(getLastViewedRoomsStorageKey(this.activeSpace), payload.room_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user