From d03515111615891b8a86e9828b0cc21850dd0922 Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Tue, 29 Jun 2021 17:04:51 +0100 Subject: [PATCH] Avoid cyclic dependencies by moving watchers out of constructor --- src/stores/room-list/RoomListStore.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/stores/room-list/RoomListStore.ts b/src/stores/room-list/RoomListStore.ts index b5961f1ac3..67552043de 100644 --- a/src/stores/room-list/RoomListStore.ts +++ b/src/stores/room-list/RoomListStore.ts @@ -73,13 +73,6 @@ export class RoomListStoreClass extends AsyncStoreWithClient { constructor() { super(defaultDispatcher); - - this.checkLoggingEnabled(); - for (const settingName of this.watchedSettings) SettingsStore.monitorSetting(settingName, null); - RoomViewStore.addListener(() => this.handleRVSUpdate({})); - this.algorithm.on(LIST_UPDATED_EVENT, this.onAlgorithmListUpdated); - this.algorithm.on(FILTER_CHANGED, this.onAlgorithmFilterUpdated); - this.setupWatchers(); } private setupWatchers() { @@ -127,6 +120,12 @@ export class RoomListStoreClass extends AsyncStoreWithClient { this.checkLoggingEnabled(); + for (const settingName of this.watchedSettings) SettingsStore.monitorSetting(settingName, null); + RoomViewStore.addListener(() => this.handleRVSUpdate({})); + this.algorithm.on(LIST_UPDATED_EVENT, this.onAlgorithmListUpdated); + this.algorithm.on(FILTER_CHANGED, this.onAlgorithmFilterUpdated); + this.setupWatchers(); + // Update any settings here, as some may have happened before we were logically ready. // Update any settings here, as some may have happened before we were logically ready. console.log("Regenerating room lists: Startup");