fix(nuxt): only observe tag elements for <NuxtLink> prefetching (#7679)

This commit is contained in:
Daniel Roe 2022-09-20 10:29:22 +01:00 committed by GitHub
parent 42c086223f
commit 98ce2e6492
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -197,7 +197,7 @@ export function defineNuxtLink (options: NuxtLinkOptions) {
let unobserve: Function | null = null
onMounted(() => {
idleId = requestIdleCallback(() => {
if (el?.value) {
if (el?.value?.tagName) {
unobserve = observer!.observe(el.value, async () => {
unobserve?.()
unobserve = null