From 6c6aeaddc48b3a07e916f96f349432b620ed9cf4 Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Fri, 14 Jan 2022 11:04:10 +0000 Subject: [PATCH] Refresh ThreadView after React state has been updated --- src/components/structures/ThreadView.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/structures/ThreadView.tsx b/src/components/structures/ThreadView.tsx index 4f992c4f434..71efae0c6a9 100644 --- a/src/components/structures/ThreadView.tsx +++ b/src/components/structures/ThreadView.tsx @@ -165,11 +165,11 @@ export default class ThreadView extends React.Component { if (thread && this.state.thread !== thread) { this.setState({ thread, + }, () => { + thread.emit(ThreadEvent.ViewThread); + this.timelinePanelRef.current?.refreshTimeline(); }); - thread.emit(ThreadEvent.ViewThread); } - - this.timelinePanelRef.current?.refreshTimeline(); }; private onScroll = (): void => {