-
Notifications
You must be signed in to change notification settings - Fork 782
fix(Carousel): resolve fade plugin failure during page transitions #4380
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
base: v3
Are you sure you want to change the base?
Conversation
- Replace computedAsync with manual plugin loading using ref + watch - Add retry logic with exponential backoff for dynamic import failures - Fix fade transitions breaking after page navigation with pageTransition enabled - Maintain all existing plugin functionality while improving reliability Fixes issue where carousel fade property stopped working after page navigation when page transitions were configured in Nuxt applications.
commit: |
Just want to say, what a cool project to contribute to! It's my first time here and I'm a little worried my solution is a bandaid and I should have followed the breadcrumbs further back - but I really appreciate this pipeline that lets me install the built package on my project. Hope I can contribute further in the 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.
I understand the issue with computedAsync
which would be enough to solve with a function instead but what's the point of retrying? 🤔
Remove unnecessary retry logic and error handling complexity. Replace computedAsync with simple async function approach as suggested by Nuxt team. Maintains the core fix for fade plugin breaking after page transitions.
Remove unnecessary plugin prop watcher and consolidate onMounted calls. The existing options/plugins watcher handles reinitialization correctly.
@benjamincanac I shouldnt make commits at 4am, I've cleaned up a little, hope thats better! |
Remove intermediate pluginList variable and push directly to plugins.value.
The direct plugins.value.push() approach broke the fade functionality. Restore the pluginList approach that properly fixes the page transition bug.
Fixes issue where carousel fade property stopped working after page navigation when page transitions were configured in Nuxt applications.
🔗 Linked issue
Resolves #4379
❓ Type of change
📚 Description
The Nuxt UI Carousel component's
fade
property would stop working after page navigation whenpageTransition
was enabled in Nuxt applications. This bug manifested as:This issue only occurred when both conditions were met:
fade
prop enableddefinePageMeta({ pageTransition: ... })
Root Cause Analysis
The bug was caused by VueUse's
computedAsync
failing during page transitions in Nuxt:computedAsync
to dynamically import Embla Carousel plugins (includingembla-carousel-fade
)computedAsync
's dynamic imports would fail silentlyplugins.value
to become an empty arrayTechnical Solution
Replaced the unreliable
computedAsync
approach with a robust manual implementation:Before (Problematic):
After (Fixed):
📝 Checklist