Skip to content

v1.2.1

Latest

Choose a tag to compare

@LucaArgentieri LucaArgentieri released this 12 Jun 07:39
· 6 commits to main since this release
fc097f0

What's changed

🩹 Bug fix — useGsap() premature context revert during page transitions

The composable used onScopeDispose to guard GSAP context cleanup. In certain Nuxt
configurations (async pages wrapped in <Suspense>), onScopeDispose can fire
synchronously before onBeforeRouteLeave sets the internal isLeavingViaRoute flag,
causing the context to revert immediately on unmount instead of waiting for
page:transition:finish. Animations would stop (and DOM properties snap back) as
soon as the user navigated away — before the page leave transition finished.

Fix: replaced onScopeDispose with onUnmounted, which fires asynchronously
in the next render flush and is always guaranteed to run after navigation guards.

This is the same behavior that the (now-deprecated) cleanupOn: 'route-leave' option
was originally introduced to provide. The deprecation notice remains, since after this
fix both values produce identical behavior.

🏡 Playground improvements

  • New demo: useGsap (timeline) — finite 8-second timeline with progress bar,
    useful for visually verifying that the cleanup timing is correct during page transitions
  • Fixed scroll-trigger demo: animation.kill() does not kill associated ScrollTrigger
    instances — added animation.scrollTrigger?.kill() before killing the tween
  • Fixed draggable and flip demos: added null guards before accessing component refs

❤️ Contributors