fix: defer loading text and server links until hydration (#926)
This commit is contained in:
parent
c92fd7939e
commit
f04d7ac067
14 changed files with 25 additions and 23 deletions
|
@ -3,21 +3,21 @@ const { t } = useI18n()
|
|||
|
||||
const tabs = $computed(() => [
|
||||
{
|
||||
to: `/${currentServer.value}/explore`,
|
||||
display: t('tab.posts'),
|
||||
to: isHydrated.value ? `/${currentServer.value}/explore` : '/explore',
|
||||
display: isHydrated.value ? t('tab.posts') : '',
|
||||
},
|
||||
{
|
||||
to: `/${currentServer.value}/explore/tags`,
|
||||
display: t('tab.hashtags'),
|
||||
to: isHydrated.value ? `/${currentServer.value}/explore/tags` : '/explore/tags',
|
||||
display: isHydrated.value ? t('tab.hashtags') : '',
|
||||
},
|
||||
{
|
||||
to: `/${currentServer.value}/explore/links`,
|
||||
display: t('tab.news'),
|
||||
to: isHydrated.value ? `/${currentServer.value}/explore/links` : '/explore/links',
|
||||
display: isHydrated.value ? t('tab.news') : '',
|
||||
},
|
||||
// This section can only be accessed after logging in
|
||||
{
|
||||
to: `/${currentServer.value}/explore/users`,
|
||||
display: t('tab.for_you'),
|
||||
to: isHydrated.value ? `/${currentServer.value}/explore/users` : '/explore/users',
|
||||
display: isHydrated.value ? t('tab.for_you') : '',
|
||||
disabled: !isMastoInitialised.value || !currentUser.value,
|
||||
},
|
||||
] as const)
|
||||
|
|
|
@ -8,7 +8,7 @@ const paginator = useMasto().v1.trends.listStatuses()
|
|||
const hideNewsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_POSTS_TIPS, false)
|
||||
|
||||
useHeadFixed({
|
||||
title: () => `${t('tab.posts')} | ${t('nav.explore')}`,
|
||||
title: () => isHydrated.value ? `${t('tab.posts')} | ${t('nav.explore')}` : '',
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ const paginator = useMasto().v1.trends.listLinks()
|
|||
const hideNewsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_NEWS_TIPS, false)
|
||||
|
||||
useHeadFixed({
|
||||
title: () => `${t('tab.news')} | ${t('nav.explore')}`,
|
||||
title: () => isHydrated.value ? `${t('tab.news')} | ${t('nav.explore')}` : '',
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ const paginator = masto.v1.trends.listTags({
|
|||
const hideTagsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_TAGS_TIPS, false)
|
||||
|
||||
useHeadFixed({
|
||||
title: () => `${t('tab.hashtags')} | ${t('nav.explore')}`,
|
||||
title: () => isHydrated.value ? `${t('tab.hashtags')} | ${t('nav.explore')}` : '',
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ const { t } = useI18n()
|
|||
const paginator = useMasto().v2.suggestions.list({ limit: 20 })
|
||||
|
||||
useHeadFixed({
|
||||
title: () => `${t('tab.for_you')} | ${t('nav.explore')}`,
|
||||
title: () => isHydrated.value ? `${t('tab.for_you')} | ${t('nav.explore')}` : '',
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -10,12 +10,12 @@ const tabs = $computed(() => [
|
|||
{
|
||||
name: 'all',
|
||||
to: '/notifications',
|
||||
display: t('tab.notifications_all'),
|
||||
display: isHydrated.value ? t('tab.notifications_all') : '',
|
||||
},
|
||||
{
|
||||
name: 'mention',
|
||||
to: '/notifications/mention',
|
||||
display: t('tab.notifications_mention'),
|
||||
display: isHydrated.value ? t('tab.notifications_mention') : '',
|
||||
},
|
||||
] as const)
|
||||
</script>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
const { t } = useI18n()
|
||||
useHeadFixed({
|
||||
title: () => `${t('tab.notifications_all')} | ${t('nav.notifications')}`,
|
||||
title: () => isHydrated.value ? `${t('tab.notifications_all')} | ${t('nav.notifications')}` : '',
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
const { t } = useI18n()
|
||||
useHeadFixed({
|
||||
title: () => `${t('tab.notifications_mention')} | ${t('nav.notifications')}`,
|
||||
title: () => isHydrated.value ? `${t('tab.notifications_mention')} | ${t('nav.notifications')}` : '',
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue