Fix: correctly handle the case where the user has no languages configured
parent
948b324cd8
commit
93689ad73d
|
@ -69,7 +69,9 @@ export const PostThreadItem = observer(function PostThreadItem({
|
||||||
const primaryLanguage = store.preferences.contentLanguages[0] || 'en'
|
const primaryLanguage = store.preferences.contentLanguages[0] || 'en'
|
||||||
const translatorUrl = getTranslatorLink(primaryLanguage, record?.text || '')
|
const translatorUrl = getTranslatorLink(primaryLanguage, record?.text || '')
|
||||||
const needsTranslation = useMemo(
|
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],
|
[item.post, store.preferences.contentLanguages],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,9 @@ export const FeedItem = observer(function ({
|
||||||
const primaryLanguage = store.preferences.contentLanguages[0] || 'en'
|
const primaryLanguage = store.preferences.contentLanguages[0] || 'en'
|
||||||
const translatorUrl = getTranslatorLink(primaryLanguage, record?.text || '')
|
const translatorUrl = getTranslatorLink(primaryLanguage, record?.text || '')
|
||||||
const needsTranslation = useMemo(
|
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],
|
[item.post, store.preferences.contentLanguages],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue