2022-11-28 13:55:51 +00:00
|
|
|
import type { ActiveHeadEntry, HeadEntryOptions, UseHeadInput } from '@vueuse/head'
|
|
|
|
import type { HeadAugmentations } from '@nuxt/schema'
|
2022-11-29 22:49:25 +00:00
|
|
|
import { useHead } from '#head'
|
2022-11-28 13:55:51 +00:00
|
|
|
|
2022-11-29 22:49:25 +00:00
|
|
|
// TODO: Workaround for Nuxt bug: https://github.com/elk-zone/elk/pull/199#issuecomment-1329771961
|
|
|
|
export function useHeadFixed<T extends HeadAugmentations>(input: UseHeadInput<T>, options?: HeadEntryOptions): ActiveHeadEntry<UseHeadInput<T>> | void {
|
2022-11-28 13:55:51 +00:00
|
|
|
const deactivated = useDeactivated()
|
2022-11-29 22:49:25 +00:00
|
|
|
return useHead(() => {
|
2022-11-28 13:55:51 +00:00
|
|
|
if (deactivated.value)
|
|
|
|
return {}
|
|
|
|
return resolveUnref(input)
|
|
|
|
}, options)
|
|
|
|
}
|