From 84bd136657a50f86d82287348cd40bc2b75f023d Mon Sep 17 00:00:00 2001 From: Germain Date: Fri, 4 Mar 2022 11:10:45 +0000 Subject: [PATCH] Fix destructuring when threads has no server support (#7976) --- src/components/structures/ThreadView.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/structures/ThreadView.tsx b/src/components/structures/ThreadView.tsx index 7509c64dd6..f21528cce6 100644 --- a/src/components/structures/ThreadView.tsx +++ b/src/components/structures/ThreadView.tsx @@ -186,8 +186,10 @@ export default class ThreadView extends React.Component { }, async () => { thread.emit(ThreadEvent.ViewThread); if (!thread.initialEventsFetched) { - const { nextBatch } = await thread.fetchInitialEvents(); - this.nextBatch = nextBatch; + const response = await thread.fetchInitialEvents(); + if (response?.nextBatch) { + this.nextBatch = response.nextBatch; + } } this.timelinePanel.current?.refreshTimeline();