11<script setup lang="ts">
2+ import type { HeadTag , Unhead } from ' @unhead/vue'
23import type { NormalizedHeadTag } from ' ~/../src/types/ui-state'
4+ import { resolveTags } from ' @unhead/vue/utils'
35import { computedAsync , until } from ' @vueuse/core'
46import { computed , nextTick , ref } from ' vue'
57import { definePageMeta } from ' #imports'
@@ -22,10 +24,19 @@ definePageMeta({
2224const counter = ref (0 )
2325const head = useClientHead ()
2426
27+ // unhead v2 apps expose tag resolution as an async instance method; v3 removed it in
28+ // favour of the standalone `resolveTags` util, and the inspected app may be on either.
29+ async function resolveHeadTags(instance : Unhead ): Promise <HeadTag []> {
30+ const legacy = instance as Partial <{ resolveTags: () => Promise <HeadTag []> }>
31+ if (typeof legacy .resolveTags === ' function' )
32+ return await legacy .resolveTags ()
33+ return resolveTags (instance )
34+ }
35+
2536const headTags = computedAsync (async () => {
2637// eslint-disable-next-line ts/no-unused-expressions
2738counter .value // for force refresh
28- const tags = await head .value ?. resolveTags ()
39+ const tags = head .value ? await resolveHeadTags ( head . value ) : []
2940return tags .map ((tag ): NormalizedHeadTag => {
3041const props = tag .props || {}
3142if (tag .tag === ' htmlAttrs' && props .lang ) {
0 commit comments