Skip to content

Commit

Permalink
revert(contentnavigation): revert parts of ContentNavigation ; will a…
Browse files Browse the repository at this point in the history
…pply #1205 on this branch
  • Loading branch information
Tahul committed Jun 3, 2022
1 parent 7b5a664 commit a9ea149
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/runtime/components/ContentNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,18 @@ export default defineComponent({

const queryBuilder = computed(() => {
/*
* `fetchContentNavigation` accepts a QueryBuilder instance.
*
* If `query` is a QueryBuilder instance, we use it directly.
*
* Otherwise, cast the QueryBuilderParams into a QueryBuilder instance.
* We need to extract params from a possible QueryBuilder beforehand
* so we don't end up with a duplicate useAsyncData key.
*/
if (typeof query.value?.params === 'function') { return query.value }
if (typeof query.value?.params === 'function') {
return query.value.params()
}

return queryContent(query.value || {})
return query.value
})

const { data, refresh } = await useAsyncData<NavItem[]>(
`content-navigation-${hash(queryBuilder.value.params())}`,
`content-navigation-${hash(queryBuilder.value)}`,
() => fetchContentNavigation(queryBuilder.value)
)

Expand Down

0 comments on commit a9ea149

Please sign in to comment.