From 7c3e743fb10bc5ef2d059acd9834a3db658e0fc8 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 29 Nov 2021 10:18:47 +0000 Subject: [PATCH 1/2] Respect the home page as a context for the Home space --- src/stores/spaces/SpaceStore.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/stores/spaces/SpaceStore.ts b/src/stores/spaces/SpaceStore.ts index 83e6ae07add..dd374c5b5e8 100644 --- a/src/stores/spaces/SpaceStore.ts +++ b/src/stores/spaces/SpaceStore.ts @@ -854,6 +854,13 @@ export class SpaceStoreClass extends AsyncStoreWithClient { break; } + case "view_home_page": + if (this.enabledMetaSpaces.includes(MetaSpace.Home)) { + this.setActiveSpace(MetaSpace.Home, false); + window.localStorage.setItem(getSpaceContextKey(this.activeSpace), ""); + } + break; + case "after_leave_room": if (this._activeSpace[0] === "!" && payload.room_id === this._activeSpace) { // User has left the current space, go to first space From bb8f56914741ea3c71054c228caa4870b5bc8e13 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 29 Nov 2021 11:14:21 +0000 Subject: [PATCH 2/2] Fix side-effect of context switch --- src/stores/spaces/SpaceStore.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/stores/spaces/SpaceStore.ts b/src/stores/spaces/SpaceStore.ts index dd374c5b5e8..34d8adafd86 100644 --- a/src/stores/spaces/SpaceStore.ts +++ b/src/stores/spaces/SpaceStore.ts @@ -230,6 +230,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient { } else { defaultDispatcher.dispatch({ action: "view_home_page", + context_switch: true, }); } } @@ -855,7 +856,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient { } case "view_home_page": - if (this.enabledMetaSpaces.includes(MetaSpace.Home)) { + if (!payload.context_switch && this.enabledMetaSpaces.includes(MetaSpace.Home)) { this.setActiveSpace(MetaSpace.Home, false); window.localStorage.setItem(getSpaceContextKey(this.activeSpace), ""); }