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

Commit

Permalink
Fix issue with thread panel not updating when it loads on first render
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy committed Apr 21, 2022
1 parent 5d6143a commit 885b157
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
12 changes: 7 additions & 5 deletions src/components/structures/ThreadPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,10 @@ const ThreadPanel: React.FC<IProps> = ({
useEffect(() => {
const room = mxClient.getRoom(roomId);
room.createThreadsTimelineSets().then(() => {
setRoom(room);
return room.fetchRoomThreads();
}).then(() => {
setFilterOption(ThreadFilterType.All);
room.fetchRoomThreads();
setRoom(room);
});
}, [mxClient, roomId]);

Expand Down Expand Up @@ -286,8 +287,8 @@ const ThreadPanel: React.FC<IProps> = ({
sensor={card.current}
onMeasurement={setNarrow}
/>
{ timelineSet && (
<TimelinePanel
{ timelineSet
? <TimelinePanel
key={timelineSet.getFilter()?.filterId ?? (roomId + ":" + filterOption)}
ref={timelinePanel}
showReadReceipts={false} // No RR support in thread's MVP
Expand All @@ -311,7 +312,8 @@ const ThreadPanel: React.FC<IProps> = ({
permalinkCreator={permalinkCreator}
disableGrouping={true}
/>
) }
: <div className="mx_AutoHideScrollbar" />
}
</BaseCard>
</RoomContext.Provider>
);
Expand Down
7 changes: 2 additions & 5 deletions src/components/structures/TimelinePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1188,11 +1188,8 @@ class TimelinePanel extends React.Component<IProps, IState> {
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
Expand Down

0 comments on commit 885b157

Please sign in to comment.