Commit 44bbf9ad authored by JJ Kasper's avatar JJ Kasper Committed by Tim Neutkens

Catch error from failing to unobserve (#8578)

* Catch error from failing to unobserve

* Update link.tsx
parent 7863b60e
...@@ -99,7 +99,11 @@ const listenToIntersections = (el: any, cb: any) => { ...@@ -99,7 +99,11 @@ const listenToIntersections = (el: any, cb: any) => {
observer.observe(el) observer.observe(el)
listeners.set(el, cb) listeners.set(el, cb)
return () => { return () => {
observer.unobserve(el) try {
observer.unobserve(el)
} catch (err) {
console.error(err)
}
listeners.delete(el) listeners.delete(el)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment