diff --git a/src/components/structures/ThreadView.tsx b/src/components/structures/ThreadView.tsx index 304479cce3..614d3c9f4b 100644 --- a/src/components/structures/ThreadView.tsx +++ b/src/components/structures/ThreadView.tsx @@ -52,6 +52,7 @@ interface IState { @replaceableComponent("structures.ThreadView") export default class ThreadView extends React.Component { private dispatcherRef: string; + private timelinePanelRef: React.RefObject = React.createRef(); constructor(props: IProps) { super(props); @@ -112,10 +113,13 @@ export default class ThreadView extends React.Component { private updateThread = (thread?: Thread) => { if (thread) { - this.setState({ thread }); - } else { - this.forceUpdate(); + this.setState({ + thread, + replyToEvent: thread.replyToEvent, + }); } + + this.timelinePanelRef.current?.refreshTimeline(); }; public render(): JSX.Element { @@ -128,6 +132,7 @@ export default class ThreadView extends React.Component { > { this.state.thread && ( { this.setState(this.getEvents()); } + // Force refresh the timeline before threads support pending events + public refreshTimeline(): void { + this.loadTimeline(); + this.reloadEvents(); + } + // get the list of events from the timeline window and the pending event list private getEvents(): Pick { const events: MatrixEvent[] = this.timelineWindow.getEvents();