Fix error in <ConversationListItem>
This commit is contained in:
parent
7f34bedd87
commit
634f4a8bb7
1 changed files with 7 additions and 1 deletions
|
@ -198,6 +198,12 @@ export const ConversationListItem: FunctionComponent<Props> = 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];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue