-
-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useIntersectionObserver received 2 entries, but only the first (outdated) is taken #271
Labels
bug
Something isn't working
Comments
@reinos I somehow encountered the same problem occasionally but could not find the 100% reproduce step. Would you please share the reproduce step on how to reproduce it in a minimal demo. Thanks in advance. 😄 😄 😄 |
Hi, thanks for the feedback! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
First of all, what a great library of hooks, well done!
Currently I have an issue with the intersectionObserver. In Chrome (not in FF nor Safari) I receive 2 entries in the callback. The first entry has
isIntersecting : false
and the second hasisIntersecting: true
. Im not sure why I receive 2 entries via the Intersection callback, but it seems that the first one is obsolete (outdated) and the latest one is the most up to date with the DOM.So I feel that the implementation here https://github.com/juliencrn/usehooks-ts/blob/master/src/useIntersectionObserver/useIntersectionObserver.ts#L20-L22 of just getting the first entry is wrong. I think this should just catch the latest one. As it seems there are situations where the
Intersection callback
can give more than one result and where latests one is always the one that is up-to-date.The text was updated successfully, but these errors were encountered: