diff --git a/src/@types/global.d.ts b/src/@types/global.d.ts index 289bda3f49..9d43a13ca4 100644 --- a/src/@types/global.d.ts +++ b/src/@types/global.d.ts @@ -98,7 +98,7 @@ declare global { mxToastStore: ToastStore; mxDeviceListener: DeviceListener; mxRoomListStore: RoomListStore; - mxRoomListStoreV3: RoomListStoreV3Class; + getRoomListStoreV3: () => RoomListStoreV3Class; mxRoomListLayoutStore: RoomListLayoutStore; mxPlatformPeg: PlatformPeg; mxIntegrationManagers: typeof IntegrationManagers; diff --git a/src/stores/room-list-v3/RoomListStoreV3.ts b/src/stores/room-list-v3/RoomListStoreV3.ts index f5fb48df07..e0461c3a5f 100644 --- a/src/stores/room-list-v3/RoomListStoreV3.ts +++ b/src/stores/room-list-v3/RoomListStoreV3.ts @@ -373,4 +373,4 @@ export default class RoomListStoreV3 { } } -window.mxRoomListStoreV3 = RoomListStoreV3.instance; +window.getRoomListStoreV3 = () => RoomListStoreV3.instance; diff --git a/test/unit-tests/components/viewmodels/roomlist/RoomListHeaderViewModel-test.tsx b/test/unit-tests/components/viewmodels/roomlist/RoomListHeaderViewModel-test.tsx index eb92208fc9..ba93dc9072 100644 --- a/test/unit-tests/components/viewmodels/roomlist/RoomListHeaderViewModel-test.tsx +++ b/test/unit-tests/components/viewmodels/roomlist/RoomListHeaderViewModel-test.tsx @@ -48,6 +48,9 @@ describe("useRoomListHeaderViewModel", () => { beforeEach(() => { matrixClient = stubClient(); space = mkStubRoom("spaceId", "spaceName", matrixClient); + jest.spyOn(SettingsStore, "getValue").mockImplementation((name: string): any => { + if (name === "RoomList.preferredSorting") return SortingAlgorithm.Recency; + }); }); afterEach(() => {