-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix(useScroll): use mutationObserver to update arrivedState when the DOM is changed #4433
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
Merged
antfu
merged 11 commits into
vueuse:main
from
andylou0102:fix/add-mutation-observer-in-useScroll
Jun 19, 2025
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ba1d0f9
fix: add useMutationObserver in useScroll
edb020f
Merge branch 'main' into fix/add-mutation-observer-in-useScroll
OrbisK 5de18ac
test(useScroll): add basic browser test
andylou0102 cb5fef0
test(useScroll): add test case for child element being added or removed
andylou0102 e6bd4f2
fix: missing word
andylou0102 561540b
fix: check element can be observed in useScroll
andylou0102 32d00e9
feat(useScroll): enhance observe option with mutation properties
andylou0102 540b0b8
refact(useScroll): unify boolean and object handling in observe initi…
andylou0102 93269f3
Merge branch 'main' into fix/add-mutation-observer-in-useScroll
andylou0102 26bcefb
Merge branch 'main' into fix/add-mutation-observer-in-useScroll
andylou0102 3bcae33
Merge branch 'main' into fix/add-mutation-observer-in-useScroll
antfu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
fix: add useMutationObserver in useScroll
- Loading branch information
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regarding #4655
lets maybe do
so we can have
{mutation: boolean, resize: boolean}
with #4655Like this we can merge this PR and update #4655 to support this :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andylou0102 I think if we add this, we can merge this soon 😃
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, the observe option has been updated to
boolean | { mutation: boolean }
to support more specific observation settings and provide extensibility for #4655 in future.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OrbisK I wrote a piece of logic to construct observe, aiming to allow users to control it in a simple way (without worrying about whether it's
mutation
orresize
), while internally unifying it into an object for distinction.In my opinion, after adding
resize
, it would look like this :Passing a boolean will toggle both
mutation
andresize
at the same time. If the user needs fine-grained control, they can pass an object to configure it manually.commit