diff --git a/spec/integ/matrix-client-event-timeline.spec.js b/spec/integ/matrix-client-event-timeline.spec.js index ad475f3fc5a..6e93a063a8d 100644 --- a/spec/integ/matrix-client-event-timeline.spec.js +++ b/spec/integ/matrix-client-event-timeline.spec.js @@ -496,6 +496,7 @@ describe("MatrixClient event timelines", function() { }); it("should handle thread replies with server support by fetching a contiguous thread timeline", async () => { + client.clientOpts.experimentalThreadSupport = true; Thread.setServerSideSupport(true); client.stopClient(); // we don't need the client to be syncing at this time const room = client.getRoom(roomId); diff --git a/src/client.ts b/src/client.ts index bc55145e557..a601c96de24 100644 --- a/src/client.ts +++ b/src/client.ts @@ -3776,7 +3776,6 @@ export class MatrixClient extends TypedEventEmitter public threadsReady = false; public async fetchRoomThreads(): Promise { - if (this.threadsReady) { + if (this.threadsReady || !this.client.supportsExperimentalThreads()) { return; } @@ -1662,7 +1662,7 @@ export class Room extends TypedEventEmitter // benefit from all the APIs a homeserver can provide to enhance the thread experience thread = this.createThread(rootEvent, events, toStartOfTimeline); if (thread) { - rootEvent.setThread(thread); + rootEvent?.setThread(thread); } deferred.resolve(thread); }