diff --git a/src/stores/room-list/RoomListLayoutStore.ts b/src/stores/room-list/RoomListLayoutStore.ts index dd4364f5fc..4d8c98a4f8 100644 --- a/src/stores/room-list/RoomListLayoutStore.ts +++ b/src/stores/room-list/RoomListLayoutStore.ts @@ -16,12 +16,21 @@ limitations under the License. import { TagID } from "./models"; import { ListLayout } from "./ListLayout"; +import { AsyncStoreWithClient } from "../AsyncStoreWithClient"; +import defaultDispatcher from "../../dispatcher/dispatcher"; +import { ActionPayload } from "../../dispatcher/payloads"; -export default class RoomListLayoutStore { +interface IState {} + +export default class RoomListLayoutStore extends AsyncStoreWithClient { private static internalInstance: RoomListLayoutStore; private readonly layoutMap = new Map(); + constructor() { + super(defaultDispatcher); + } + public ensureLayoutExists(tagId: TagID) { if (!this.layoutMap.has(tagId)) { this.layoutMap.set(tagId, new ListLayout(tagId)); @@ -49,6 +58,16 @@ export default class RoomListLayoutStore { } return RoomListLayoutStore.internalInstance; } + + protected async onNotReady(): Promise { + // On logout, clear the map. + this.layoutMap.clear(); + } + + // We don't need this function, but our contract says we do + protected async onAction(payload: ActionPayload): Promise { + return Promise.resolve(); + } } window.mx_RoomListLayoutStore = RoomListLayoutStore.instance;