From 1b0834facc3e1ec5c31e662ae4cdbcf8dd073dbe Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Tue, 26 Nov 2024 08:34:43 +0100 Subject: [PATCH] fix(nuxt): check if nuxt link observer is null (#30038) --- packages/nuxt/src/app/components/nuxt-link.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 } }