vueuse/vueuse
View on GitHubBUG | `useElementVisibility` | Possible issue with `once` watcher inside of callback
Open
#4704 opened on Apr 13, 2025
good first issuehas pr
Description
Describe the bug
I was looking at the source code for this composable and noticed that the watchOnce call is happening inside of the intersection callback.
Was this intentional? Wouldn't this create a new watcher on each update, kind of separate to the initial effect scope? I would have guessed that this hook would have to be outside of the useIntersectionObserver call.
Reproduction
n/a
System Info
n/a
Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a VueUse issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- The provided reproduction is a minimal reproducible example of the bug.