From 5902ddaf062e4c1c5f173267799ec26483772a30 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 10 Mar 2022 13:34:24 +0000 Subject: [PATCH] Fix issues with ThreadSummary in msc-enabled mode (#8018) --- src/components/views/rooms/ThreadSummary.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/views/rooms/ThreadSummary.tsx b/src/components/views/rooms/ThreadSummary.tsx index 2a5865fddc..22c30dacda 100644 --- a/src/components/views/rooms/ThreadSummary.tsx +++ b/src/components/views/rooms/ThreadSummary.tsx @@ -68,11 +68,13 @@ const ThreadSummary = ({ mxEvent, thread }: IProps) => { export const ThreadMessagePreview = ({ thread }: Pick) => { const cli = useContext(MatrixClientContext); - const lastReply = useTypedEventEmitterState(thread, ThreadEvent.Update, () => thread.lastReply()); + const lastReply = useTypedEventEmitterState(thread, ThreadEvent.Update, () => thread.replyToEvent); const preview = useAsyncMemo(async () => { + if (!lastReply) return; await cli.decryptEventIfNeeded(lastReply); return MessagePreviewStore.instance.generatePreviewForEvent(lastReply); }, [lastReply]); + if (!preview) return null; const sender = thread.roomState.getSentinelMember(lastReply.getSender()); return <> @@ -83,13 +85,11 @@ export const ThreadMessagePreview = ({ thread }: Pick) => { height={24} className="mx_ThreadInfo_avatar" /> - { preview && ( -
- - { preview } - -
- ) } +
+ + { preview } + +
; };