Add method to await space store setup
Otherwise, the room list store will get incorrect information about spaces and thus will produce an incorrect roomlist.
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import { KnownMembership } from "matrix-js-sdk/src/types";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { defer } from "matrix-js-sdk/src/utils";
|
||||
|
||||
import { AsyncStoreWithClient } from "../AsyncStoreWithClient";
|
||||
import defaultDispatcher from "../../dispatcher/dispatcher";
|
||||
@@ -152,6 +153,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<EmptyObject> {
|
||||
private _enabledMetaSpaces: MetaSpace[] = [];
|
||||
/** Whether the feature flag is set for MSC3946 */
|
||||
private _msc3946ProcessDynamicPredecessor: boolean = SettingsStore.getValue("feature_dynamic_room_predecessors");
|
||||
private _isReady = defer();
|
||||
|
||||
public constructor() {
|
||||
super(defaultDispatcher, {});
|
||||
@@ -162,6 +164,14 @@ export class SpaceStoreClass extends AsyncStoreWithClient<EmptyObject> {
|
||||
SettingsStore.monitorSetting("feature_dynamic_room_predecessors", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise that resolves when the space store is ready.
|
||||
* This happens after an initial hierarchy of spaces and rooms has been computed.
|
||||
*/
|
||||
public get isReady(): Promise<void> {
|
||||
return this._isReady.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the order of meta spaces to display in the space panel.
|
||||
*
|
||||
@@ -1201,6 +1211,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<EmptyObject> {
|
||||
} else {
|
||||
this.switchSpaceIfNeeded();
|
||||
}
|
||||
this._isReady.resolve();
|
||||
}
|
||||
|
||||
private sendUserProperties(): void {
|
||||
|
||||
Reference in New Issue
Block a user