Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

useIntersectionObserver does not handle state correctly when target element is changed #1616

Open
mortyccp opened this issue Feb 18, 2025 · 0 comments

Comments

@mortyccp
Copy link

Prior Issues

No

What is the current behavior?

useIntersectionObserver state is not reset when target element is changed, like if target is changed to null, the intersection state still report the pervious value

Steps to Reproduce

  1. use useIntersectionObserver to observe an element and create a button to set the target to null afterwards

What is the expected behavior?

  1. should handle state when the target of any other options pass to the hooks is changed

Environment Details

  • _@react-hookz/web version: 23.1.0
  • _react version: 18.3.3
  • _react-dom version: 19.0.0
  • _typescript version: 5.7.3
  • _OS: Mac
  • _Browser: Chrome
  • _Did this work in previous versions? No
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

1 participant