From 93689ad73df449b476cbb69e79f0f6d9c09ebce1 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Fri, 30 Jun 2023 12:21:30 -0500 Subject: [PATCH] Fix: correctly handle the case where the user has no languages configured --- src/view/com/post-thread/PostThreadItem.tsx | 4 +++- src/view/com/posts/FeedItem.tsx | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index c691e7f3..83a51f7a 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -69,7 +69,9 @@ export const PostThreadItem = observer(function PostThreadItem({ const primaryLanguage = store.preferences.contentLanguages[0] || 'en' const translatorUrl = getTranslatorLink(primaryLanguage, record?.text || '') const needsTranslation = useMemo( - () => !isPostInLanguage(item.post, store.preferences.contentLanguages), + () => + store.preferences.contentLanguages.length > 0 && + !isPostInLanguage(item.post, store.preferences.contentLanguages), [item.post, store.preferences.contentLanguages], ) diff --git a/src/view/com/posts/FeedItem.tsx b/src/view/com/posts/FeedItem.tsx index 7354c8a6..7a292378 100644 --- a/src/view/com/posts/FeedItem.tsx +++ b/src/view/com/posts/FeedItem.tsx @@ -66,7 +66,9 @@ export const FeedItem = observer(function ({ const primaryLanguage = store.preferences.contentLanguages[0] || 'en' const translatorUrl = getTranslatorLink(primaryLanguage, record?.text || '') const needsTranslation = useMemo( - () => !isPostInLanguage(item.post, store.preferences.contentLanguages), + () => + store.preferences.contentLanguages.length > 0 && + !isPostInLanguage(item.post, store.preferences.contentLanguages), [item.post, store.preferences.contentLanguages], )