Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 763edb7

Browse files
authored
Fix issue with thread panel not updating when it loads on first render (#8382)
1 parent 495a695 commit 763edb7

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/components/structures/ThreadPanel.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,10 @@ const ThreadPanel: React.FC<IProps> = ({
198198
useEffect(() => {
199199
const room = mxClient.getRoom(roomId);
200200
room.createThreadsTimelineSets().then(() => {
201-
setRoom(room);
201+
return room.fetchRoomThreads();
202+
}).then(() => {
202203
setFilterOption(ThreadFilterType.All);
203-
room.fetchRoomThreads();
204+
setRoom(room);
204205
});
205206
}, [mxClient, roomId]);
206207

@@ -286,8 +287,8 @@ const ThreadPanel: React.FC<IProps> = ({
286287
sensor={card.current}
287288
onMeasurement={setNarrow}
288289
/>
289-
{ timelineSet && (
290-
<TimelinePanel
290+
{ timelineSet
291+
? <TimelinePanel
291292
key={timelineSet.getFilter()?.filterId ?? (roomId + ":" + filterOption)}
292293
ref={timelinePanel}
293294
showReadReceipts={false} // No RR support in thread's MVP
@@ -311,7 +312,8 @@ const ThreadPanel: React.FC<IProps> = ({
311312
permalinkCreator={permalinkCreator}
312313
disableGrouping={true}
313314
/>
314-
) }
315+
: <div className="mx_AutoHideScrollbar" />
316+
}
315317
</BaseCard>
316318
</RoomContext.Provider>
317319
);

src/components/structures/TimelinePanel.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,11 +1188,8 @@ class TimelinePanel extends React.Component<IProps, IState> {
11881188
const onLoaded = () => {
11891189
if (this.unmounted) return;
11901190

1191-
// clear the timeline min-height when
1192-
// (re)loading the timeline
1193-
if (this.messagePanel.current) {
1194-
this.messagePanel.current.onTimelineReset();
1195-
}
1191+
// clear the timeline min-height when (re)loading the timeline
1192+
this.messagePanel.current?.onTimelineReset();
11961193
this.reloadEvents();
11971194

11981195
// If we switched away from the room while there were pending

0 commit comments

Comments
 (0)