diff --git a/packages/nuxt/src/app/components/nuxt-link.ts b/packages/nuxt/src/app/components/nuxt-link.ts index aa50e11e09..814df1658e 100644 --- a/packages/nuxt/src/app/components/nuxt-link.ts +++ b/packages/nuxt/src/app/components/nuxt-link.ts @@ -506,9 +506,9 @@ function useObserver (): { observe: ObserveFn } | undefined { observer.observe(element) return () => { callbacks.delete(element) - observer!.unobserve(element) + observer?.unobserve(element) if (callbacks.size === 0) { - observer!.disconnect() + observer?.disconnect() observer = null } }