From 634f4a8bb74a060916adead3c3f8407ec3b15293 Mon Sep 17 00:00:00 2001 From: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com> Date: Tue, 7 Sep 2021 15:38:37 -0500 Subject: [PATCH] Fix error in `` --- ts/components/conversationList/ConversationListItem.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ts/components/conversationList/ConversationListItem.tsx b/ts/components/conversationList/ConversationListItem.tsx index 63407ade35..2096ed99d2 100644 --- a/ts/components/conversationList/ConversationListItem.tsx +++ b/ts/components/conversationList/ConversationListItem.tsx @@ -198,6 +198,12 @@ export const ConversationListItem: FunctionComponent = React.memo( } ); -function truncateMessageText(text: undefined | string = ''): string { +// This takes `unknown` because, sometimes, values from the database don't match our +// types. In the long term, we should fix that. In the short term, this smooths over the +// problem. +function truncateMessageText(text: unknown): string { + if (typeof text !== 'string') { + return ''; + } return text.split('\n', 1)[0]; }