Skip to content

Commit af47690

Browse files
Room List Store: Fetch rooms after space store is ready + attach store to window (#29453)
* Attach the new store to window * Fetch rooms after space store is ready If we fetch a list of rooms and then wait for the space store to be ready, we will need some way of handling the onAction calls we get while we wait. These calls are dropped now.
1 parent da87bbe commit af47690

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/@types/global.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import { type DeepReadonly } from "./common";
4747
import type MatrixChat from "../components/structures/MatrixChat";
4848
import { type InitialCryptoSetupStore } from "../stores/InitialCryptoSetupStore";
4949
import { type ModuleApiType } from "../modules/Api.ts";
50+
import type { RoomListStoreV3Class } from "../stores/room-list-v3/RoomListStoreV3.ts";
5051

5152
/* eslint-disable @typescript-eslint/naming-convention */
5253

@@ -99,6 +100,7 @@ declare global {
99100
mxToastStore: ToastStore;
100101
mxDeviceListener: DeviceListener;
101102
mxRoomListStore: RoomListStore;
103+
mxRoomListStoreV3: RoomListStoreV3Class;
102104
mxRoomListLayoutStore: RoomListLayoutStore;
103105
mxPlatformPeg: PlatformPeg;
104106
mxIntegrationManagers: typeof IntegrationManagers;

src/stores/room-list-v3/RoomListStoreV3.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ export class RoomListStoreV3Class extends AsyncStoreWithClient<EmptyObject> {
116116
if (this.roomSkipList?.initialized || !this.matrixClient) return;
117117
const sorter = new RecencySorter(this.matrixClient.getSafeUserId());
118118
this.roomSkipList = new RoomSkipList(sorter, FILTERS);
119-
const rooms = this.getRooms();
120119
await SpaceStore.instance.storeReadyPromise;
120+
const rooms = this.getRooms();
121121
this.roomSkipList.seed(rooms);
122122
this.emit(LISTS_UPDATE_EVENT);
123123
}
@@ -244,3 +244,5 @@ export default class RoomListStoreV3 {
244244
return this.internalInstance;
245245
}
246246
}
247+
248+
window.mxRoomListStoreV3 = RoomListStoreV3.instance;

0 commit comments

Comments
 (0)