Speed up left pane message preview for long messages
This commit is contained in:
parent
a43abe628a
commit
ed11361b64
1 changed files with 6 additions and 2 deletions
|
@ -130,7 +130,7 @@ export const ConversationListItem: FunctionComponent<Props> = React.memo(
|
|||
{i18n('ConversationListItem--draft-prefix')}
|
||||
</span>
|
||||
<MessageBody
|
||||
text={(draftPreview || '').split('\n')[0]}
|
||||
text={truncateMessageText(draftPreview)}
|
||||
disableJumbomoji
|
||||
disableLinks
|
||||
i18n={i18n}
|
||||
|
@ -144,7 +144,7 @@ export const ConversationListItem: FunctionComponent<Props> = React.memo(
|
|||
</span>
|
||||
) : (
|
||||
<MessageBody
|
||||
text={(messageBody || '').split('\n')[0]}
|
||||
text={truncateMessageText(messageBody)}
|
||||
disableJumbomoji
|
||||
disableLinks
|
||||
i18n={i18n}
|
||||
|
@ -197,3 +197,7 @@ export const ConversationListItem: FunctionComponent<Props> = React.memo(
|
|||
);
|
||||
}
|
||||
);
|
||||
|
||||
function truncateMessageText(text: undefined | string = ''): string {
|
||||
return text.split('\n', 1)[0];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue