From ed11361b6484287baf3b5c20e7087cd04959b34d Mon Sep 17 00:00:00 2001 From: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com> Date: Fri, 27 Aug 2021 15:49:45 -0500 Subject: [PATCH] Speed up left pane message preview for long messages --- ts/components/conversationList/ConversationListItem.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ts/components/conversationList/ConversationListItem.tsx b/ts/components/conversationList/ConversationListItem.tsx index b4548d253..63407ade3 100644 --- a/ts/components/conversationList/ConversationListItem.tsx +++ b/ts/components/conversationList/ConversationListItem.tsx @@ -130,7 +130,7 @@ export const ConversationListItem: FunctionComponent = React.memo( {i18n('ConversationListItem--draft-prefix')} = React.memo( ) : ( = React.memo( ); } ); + +function truncateMessageText(text: undefined | string = ''): string { + return text.split('\n', 1)[0]; +}