fix: v-motion
directive variants leaking
#173
Merged
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.
You may have noticed the demo page is not working as expected, it seems only the initial motion variant is triggered. While testing #171 in the vite playground I noticed that simply adding en element using a visibility variant would make all motion elements disappear.
Using the Netlify deploy history of the demo page (https://app.netlify.com/sites/vueuse-motion-demo/deploys) I narrowed down when this broke to this commit. I think that by changing the directive to accept a default value
{}
instead of undefined for variants, the same object is being reused for allv-motion
usage, essentially each element usingv-motion
is overwriting/merging all the previous ones.This partially fixes the demo page, but fixes what's probably a bigger bug. I'll have a separate PR to fix the demo page further soon.