fix(nuxt): check if nuxt link observer is null (#30038)

This commit is contained in:
Guillaume Chau 2024-11-26 08:34:43 +01:00 committed by GitHub
parent a0dcb64c76
commit 1b0834facc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -506,9 +506,9 @@ function useObserver (): { observe: ObserveFn } | undefined {
observer.observe(element) observer.observe(element)
return () => { return () => {
callbacks.delete(element) callbacks.delete(element)
observer!.unobserve(element) observer?.unobserve(element)
if (callbacks.size === 0) { if (callbacks.size === 0) {
observer!.disconnect() observer?.disconnect()
observer = null observer = null
} }
} }