Skip to content

Commit 355a8ff

Browse files
committed
Revert "docs: remove using path as async data key"
This reverts commit 0b15938.
1 parent 0b15938 commit 355a8ff

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

docs/pages/blog/[slug].vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ const { copy } = useCopyToClipboard()
1313
const { toc } = useAppConfig()
1414
const { url } = useSiteConfig()
1515
16-
const { data: post } = await useAsyncData(() => queryContent<BlogPost>(route.path).findOne())
16+
const { data: post } = await useAsyncData(route.path, () => queryContent<BlogPost>(route.path).findOne())
1717
if (!post.value) {
1818
throw createError({ statusCode: 404, statusMessage: 'Post not found', fatal: true })
1919
}
2020
21-
const { data: surround } = await useAsyncData(() => queryContent()
21+
const { data: surround } = await useAsyncData(`${route.path}-surround`, () => queryContent()
2222
.where({ _extension: 'md', navigation: { $ne: false }, _path: { $regex: /^\/blog/ } })
2323
.without(['body', 'excerpt'])
2424
.sort({ date: -1 })

docs/pages/changelog/[slug].vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ const route = useRoute()
1111
const { copy } = useCopyToClipboard()
1212
const { url } = useSiteConfig()
1313
14-
const { data: changelog } = await useAsyncData(() => queryContent<ChangelogPost>(route.path).findOne())
14+
const { data: changelog } = await useAsyncData(route.path, () => queryContent<ChangelogPost>(route.path).findOne())
1515
if (!changelog.value) {
1616
throw createError({ statusCode: 404, statusMessage: 'Post not found', fatal: true })
1717
}
1818
19-
const { data: surround } = await useAsyncData(() => queryContent('/changelog')
19+
const { data: surround } = await useAsyncData(`${route.path}-surround`, () => queryContent('/changelog')
2020
.where({ _extension: 'md', navigation: { $ne: false }, _path: { $regex: /^\/changelog/ } })
2121
.without(['body', 'excerpt'])
2222
.sort({ date: -1 })

docs/pages/docs/[...slug].vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ definePageMeta({
1111
const route = useRoute()
1212
const { toc, seo } = useAppConfig()
1313
14-
const { data: page } = await useAsyncData(() => queryContent(route.path).findOne())
14+
const { data: page } = await useAsyncData(route.path, () => queryContent(route.path).findOne())
1515
if (!page.value) {
1616
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
1717
}
1818
19-
const { data: surround } = await useAsyncData(() => queryContent()
19+
const { data: surround } = await useAsyncData(`${route.path}-surround`, () => queryContent()
2020
.where({ _extension: 'md', navigation: { $ne: false }, _path: { $regex: /^\/docs/ } })
2121
.only(['title', 'description', '_path'])
2222
.findSurround(withoutTrailingSlash(route.path))

0 commit comments

Comments
 (0)