From 3adb2635bac73810ae27eaf8bfbd586ab0ceb725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 20 Apr 2021 15:40:32 +0200 Subject: [PATCH 1/2] Revert "Remove unnecessary check" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 08c0f0a67ef2068b64f0028279be7a53d4d82a50. Signed-off-by: Šimon Brandner --- src/stores/SpaceStore.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stores/SpaceStore.tsx b/src/stores/SpaceStore.tsx index 290caba9d4..e9be7c1e5e 100644 --- a/src/stores/SpaceStore.tsx +++ b/src/stores/SpaceStore.tsx @@ -514,7 +514,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient { const room = this.matrixClient?.getRoom(payload.room_id); // persist last viewed room from a space - if (room) { + if (room && !room.isSpaceRoom()) { window.localStorage.setItem(getLastViewedRoomsStorageKey(this.activeSpace), payload.room_id); } From 9b81f5b4a034c3f791f7083bb0607e4ca7b9ab10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 20 Apr 2021 16:11:34 +0200 Subject: [PATCH 2/2] Add a comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/stores/SpaceStore.tsx | 6 ++++++ 1 file changed, 6 insertions(+) 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); }