diff --git a/src/stores/SpaceStore.tsx b/src/stores/SpaceStore.tsx index e9be7c1e5e..dc0c691505 100644 --- a/src/stores/SpaceStore.tsx +++ b/src/stores/SpaceStore.tsx @@ -514,6 +514,12 @@ export class SpaceStoreClass extends AsyncStoreWithClient { const room = this.matrixClient?.getRoom(payload.room_id); // persist last viewed room from a space + + // Don't save if the room is a space room. This would cause a problem: + // When switching to a space home, we first view that room and + // only after that we switch to that space. This causes us to + // save the space home to be the last viewed room in the home + // space. if (room && !room.isSpaceRoom()) { window.localStorage.setItem(getLastViewedRoomsStorageKey(this.activeSpace), payload.room_id); }