Skip to content

Commit

Permalink
fix: ContentQuery _path not used properly (#1141) (#1143)
Browse files Browse the repository at this point in the history
Co-authored-by: Yaël Guilloux <yael.guilloux@gmail.com>
  • Loading branch information
GerryWilko and Tahul committed May 25, 2022
1 parent 2d74b90 commit 1dc7377
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/runtime/components/ContentQuery.ts
@@ -1,5 +1,4 @@
import { PropType, toRefs, defineComponent, h, useSlots } from 'vue'
import { withLeadingSlash, withoutTrailingSlash } from 'ufo'
import type { ParsedContent, QueryBuilder, SortParams } from '../types'
import { computed, useAsyncData, queryContent } from '#imports'

Expand Down Expand Up @@ -101,11 +100,12 @@ export default defineComponent({
const { data, refresh } = await useAsyncData<ParsedContent | ParsedContent[]>(
`content-doc-${path.value}`,
() => {
let queryBuilder: QueryBuilder = queryContent()
let queryBuilder: QueryBuilder

if (path.value) {
const _path = withLeadingSlash(withoutTrailingSlash(path.value))
queryBuilder = queryBuilder.where({ _path })
queryBuilder = queryContent(path.value)
} else {
queryBuilder = queryContent()
}

if (only.value) { queryBuilder = queryBuilder.only(only.value) }
Expand Down

0 comments on commit 1dc7377

Please sign in to comment.