From bbad647b85739fbbdc6dacdaf2f376403c211af0 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 17 Dec 2021 15:14:08 +0000 Subject: [PATCH 1/2] Space Panel use SettingsStore instead of SpaceStore as source of truth --- src/components/views/spaces/SpacePanel.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/views/spaces/SpacePanel.tsx b/src/components/views/spaces/SpacePanel.tsx index d68f665ddc6..c120d7fd6ac 100644 --- a/src/components/views/spaces/SpacePanel.tsx +++ b/src/components/views/spaces/SpacePanel.tsx @@ -97,9 +97,7 @@ export const HomeButtonContextMenu = ({ hideHeader, ...props }: ComponentProps) => { - const allRoomsInHome = useEventEmitterState(SpaceStore.instance, UPDATE_HOME_BEHAVIOUR, () => { - return SpaceStore.instance.allRoomsInHome; - }); + const allRoomsInHome = useSettingValue("Spaces.allRoomsInHome"); return Date: Fri, 17 Dec 2021 15:15:46 +0000 Subject: [PATCH 2/2] SpaceStore update allRoomsInHome when Matrix Client is ready --- src/stores/spaces/SpaceStore.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/stores/spaces/SpaceStore.ts b/src/stores/spaces/SpaceStore.ts index 068d51bacef..a49414cf032 100644 --- a/src/stores/spaces/SpaceStore.ts +++ b/src/stores/spaces/SpaceStore.ts @@ -109,8 +109,9 @@ export class SpaceStoreClass extends AsyncStoreWithClient { private _invitedSpaces = new Set(); private spaceOrderLocalEchoMap = new Map(); private _restrictedJoinRuleSupport?: IRoomCapability; - private _allRoomsInHome: boolean = SettingsStore.getValue("Spaces.allRoomsInHome"); - private _enabledMetaSpaces: MetaSpace[] = []; // set by onReady + // The following properties are set by onReady as they live in account_data + private _allRoomsInHome = false; + private _enabledMetaSpaces: MetaSpace[] = []; constructor() { super(defaultDispatcher, {}); @@ -1042,6 +1043,8 @@ export class SpaceStoreClass extends AsyncStoreWithClient { const enabledMetaSpaces = SettingsStore.getValue("Spaces.enabledMetaSpaces"); this._enabledMetaSpaces = metaSpaceOrder.filter(k => enabledMetaSpaces[k]) as MetaSpace[]; + this._allRoomsInHome = SettingsStore.getValue("Spaces.allRoomsInHome"); + this.rebuildSpaceHierarchy(); // trigger an initial update // restore selected state from last session if any and still valid