-
Notifications
You must be signed in to change notification settings - Fork 988
fix(Carousel): resolve plugins with 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
fix(Carousel): resolve plugins with page transitions #4380
Conversation
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. |
benjamincanac
left a comment
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? 🤔
|
@benjamincanac I shouldnt make commits at 4am, I've cleaned up a little, hope thats better! |
- 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.
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.
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.
benjamincanac
left a comment
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've removed the loadPlugins call from onMounted since it was called twice with the immediate watch.
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
fadeproperty would stop working after page navigation whenpageTransitionwas enabled in Nuxt applications. This bug manifested as:This issue only occurred when both conditions were met:
fadeprop enableddefinePageMeta({ pageTransition: ... })Root Cause Analysis
The bug was caused by VueUse's
computedAsyncfailing during page transitions in Nuxt:computedAsyncto dynamically import Embla Carousel plugins (includingembla-carousel-fade)computedAsync's dynamic imports would fail silentlyplugins.valueto become an empty arrayTechnical Solution
Replaced the unreliable
computedAsyncapproach with a robust manual implementation:Before (Problematic):
After (Fixed):
📝 Checklist