From 6761ef954098de8afd68d648a7968f281054a69e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 17 Dec 2021 16:41:39 +0000 Subject: [PATCH] Space Panel use SettingsStore instead of SpaceStore as source of truth (#7404) --- src/components/views/spaces/SpacePanel.tsx | 4 +--- src/stores/spaces/SpaceStore.ts | 7 +++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/views/spaces/SpacePanel.tsx b/src/components/views/spaces/SpacePanel.tsx index d68f665ddc..c120d7fd6a 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 { 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