Skip to content

Commit

Permalink
docs(app): move watch before surround
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac committed Jan 13, 2025
1 parent e7c10bc commit 01b7547
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions docs/app/pages/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ if (!page.value) {
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
}
// Update the framework/module if the page has different ones
watch(page, () => {
if (page.value?.framework && page.value?.framework !== framework.value) {
framework.value = page.value?.framework as string
}
if (page.value?.module && page.value?.module !== module.value) {
module.value = page.value?.module as string
}
}, { immediate: true })
const { data: surround } = await useAsyncData(`${route.path}-surround`, () => {
return queryCollectionItemSurroundings('content', route.path, {
fields: ['description']
Expand Down Expand Up @@ -53,16 +63,6 @@ if (!import.meta.prerender) {
})
}
// Update the framework/module if the page has different ones
watch(page, () => {
if (page.value?.framework && page.value?.framework !== framework.value) {
framework.value = page.value?.framework as string
}
if (page.value?.module && page.value?.module !== module.value) {
module.value = page.value?.module as string
}
}, { immediate: true })
const type = page.value?.path.includes('components') ? 'Vue Component ' : page.value?.path.includes('composables') ? 'Vue Composable ' : ''
useSeoMeta({
titleTemplate: `%s ${type}- Nuxt UI ${page.value.module === 'ui-pro' ? 'Pro' : ''} v3${page.value.framework === 'vue' ? ' for Vue' : ''}`,
Expand Down

0 comments on commit 01b7547

Please sign in to comment.