Skip to content
This repository was archived by the owner on May 18, 2025. It is now read-only.

Commit d035151

Browse files
committed
Avoid cyclic dependencies by moving watchers out of constructor
1 parent 9a37f29 commit d035151

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/stores/room-list/RoomListStore.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
7373

7474
constructor() {
7575
super(defaultDispatcher);
76-
77-
this.checkLoggingEnabled();
78-
for (const settingName of this.watchedSettings) SettingsStore.monitorSetting(settingName, null);
79-
RoomViewStore.addListener(() => this.handleRVSUpdate({}));
80-
this.algorithm.on(LIST_UPDATED_EVENT, this.onAlgorithmListUpdated);
81-
this.algorithm.on(FILTER_CHANGED, this.onAlgorithmFilterUpdated);
82-
this.setupWatchers();
8376
}
8477

8578
private setupWatchers() {
@@ -127,6 +120,12 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
127120

128121
this.checkLoggingEnabled();
129122

123+
for (const settingName of this.watchedSettings) SettingsStore.monitorSetting(settingName, null);
124+
RoomViewStore.addListener(() => this.handleRVSUpdate({}));
125+
this.algorithm.on(LIST_UPDATED_EVENT, this.onAlgorithmListUpdated);
126+
this.algorithm.on(FILTER_CHANGED, this.onAlgorithmFilterUpdated);
127+
this.setupWatchers();
128+
130129
// Update any settings here, as some may have happened before we were logically ready.
131130
// Update any settings here, as some may have happened before we were logically ready.
132131
console.log("Regenerating room lists: Startup");

0 commit comments

Comments
 (0)