fix(SW-441): fixes after PR

This commit is contained in:
Erik Tiekstra
2024-10-08 15:43:24 +02:00
parent d63e8856ec
commit 4212f5c97b
2 changed files with 18 additions and 17 deletions

View File

@@ -46,12 +46,9 @@ export default function useScrollSpy(
const observer = new IntersectionObserver(handleIntersection, mergedOptions)
const elements = sectionIds
.map((id) => document.getElementById(id))
.filter(Boolean)
.filter((el): el is HTMLElement => !!el)
elements.forEach((element) => {
if (!element) {
return
}
observer.observe(element)
})