From e5bc5a933e07bac4a4ef99ece0b01a1523c7374a Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Wed, 21 Jul 2021 16:09:32 +0200 Subject: [PATCH] Use cached value to read member count --- src/components/structures/MessagePanel.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/structures/MessagePanel.tsx b/src/components/structures/MessagePanel.tsx index 5bfe759508..4ca38266dd 100644 --- a/src/components/structures/MessagePanel.tsx +++ b/src/components/structures/MessagePanel.tsx @@ -712,6 +712,8 @@ export default class MessagePanel extends React.Component { const callEventGrouper = this.callEventGroupers.get(mxEv.getContent().call_id); + const isDirectMessage = this.props.room?.getJoinedMemberCount() <= 2; + // use txnId as key if available so that we don't remount during sending ret.push( @@ -743,7 +745,7 @@ export default class MessagePanel extends React.Component { enableFlair={this.props.enableFlair} showReadReceipts={this.props.showReadReceipts} callEventGrouper={callEventGrouper} - hideSender={this.props.room?.getMembers().length <= 2 && this.props.layout === Layout.Bubble} + hideSender={isDirectMessage && this.props.layout === Layout.Bubble} /> , );