Skip to content

Commit ad3bb35

Browse files
committed
fix(useIntersectionObserver): return an array consistently
1 parent ccf0402 commit ad3bb35

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/useIntersectionObserver.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ export default function useIntersectionObserver<TElement extends Element>(
2828
if (!element || !observer) return
2929

3030
observer.observe(element)
31+
3132
return () => {
3233
observer.unobserve(element)
3334
}
3435
}, [observer, element])
3536

36-
return entries
37+
return entries || []
3738
}

0 commit comments

Comments
 (0)