vueuse / motion

๐Ÿคน Vue Composables putting your components in motion
https://motion.vueuse.org
MIT License
2.13k stars 75 forks source link

fix: visibility variants not triggered when visible on load #171

Closed BobbieGoede closed 4 months ago

BobbieGoede commented 4 months ago

Issues

This should fix visibility variants not being triggered when the element should already be visible on page load. It's a bit of a head scratcher, but I think this issue may be exclusive to directive usage (not when using <Motion />).

I'm assuming that useIntersectionObserver doesn't play nice when called in created simply based on v-intersection-observer directive using the mounted hook in @vueuse/components (see source here).

Unfortunately I wasn't able to add a test for this, maybe intersection observer doesn't work in happy-dom? If anyone knows how to properly test this behaviour and could give me pointers on how to do so I would feel a lot better about this fix ๐Ÿ˜…..

BobbieGoede commented 4 months ago

@cpreston321 and/or @Tahul Pinging to request review ๐Ÿ˜… (can't assign reviewers)