From 763edb7ab9302d6908ff84bafe5801bc390f47c6 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 22 Apr 2022 08:37:23 +0100 Subject: [PATCH] Fix issue with thread panel not updating when it loads on first render (#8382) --- src/components/structures/ThreadPanel.tsx | 12 +++++++----- src/components/structures/TimelinePanel.tsx | 7 ++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/components/structures/ThreadPanel.tsx b/src/components/structures/ThreadPanel.tsx index 3009bedae3..eccb68ed99 100644 --- a/src/components/structures/ThreadPanel.tsx +++ b/src/components/structures/ThreadPanel.tsx @@ -198,9 +198,10 @@ const ThreadPanel: React.FC = ({ useEffect(() => { const room = mxClient.getRoom(roomId); room.createThreadsTimelineSets().then(() => { - setRoom(room); + return room.fetchRoomThreads(); + }).then(() => { setFilterOption(ThreadFilterType.All); - room.fetchRoomThreads(); + setRoom(room); }); }, [mxClient, roomId]); @@ -286,8 +287,8 @@ const ThreadPanel: React.FC = ({ sensor={card.current} onMeasurement={setNarrow} /> - { timelineSet && ( - = ({ permalinkCreator={permalinkCreator} disableGrouping={true} /> - ) } + :
+ } ); diff --git a/src/components/structures/TimelinePanel.tsx b/src/components/structures/TimelinePanel.tsx index bc4ea5bdcb..7201e3c6f2 100644 --- a/src/components/structures/TimelinePanel.tsx +++ b/src/components/structures/TimelinePanel.tsx @@ -1188,11 +1188,8 @@ class TimelinePanel extends React.Component { const onLoaded = () => { if (this.unmounted) return; - // clear the timeline min-height when - // (re)loading the timeline - if (this.messagePanel.current) { - this.messagePanel.current.onTimelineReset(); - } + // clear the timeline min-height when (re)loading the timeline + this.messagePanel.current?.onTimelineReset(); this.reloadEvents(); // If we switched away from the room while there were pending