Skip to content
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

feat(Accordion): add unmount prop to allow lazy mounting for heavy components #1590

Merged
merged 8 commits into from
Apr 5, 2024

Conversation

noook
Copy link
Collaborator

@noook noook commented Mar 30, 2024

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

When dealing with Accordion with 10+ more list items that have heavy components inside the disclosure, every state change on the accordion items can slow down or block the page.

This PR allows configuring the DisclosurePanel to not be mounted unless the panel is open. When unmount is false (default), the previous behaviour (static) applies.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link
Member

@benjamincanac benjamincanac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would have been easier to to just handle the unmount prop on the DisclosurePanel component without the static and v-show but if I remember correctly it breaks the transition.

@noook
Copy link
Collaborator Author

noook commented Apr 3, 2024

Yes that's exactly why I use the reuseTemplate, because static requires us to handle the div with a v-show or v-if around for the display condition

@benjamincanac
Copy link
Member

@noook This seem to break the whole documentation: https://ui-7z2kyn5b0-nuxt-js.vercel.app/components/accordion

@benjamincanac benjamincanac changed the title perfs(Accordion): Allow lazy mounting for heavy components feat(Accordion): add unmount prop to allow lazy mounting for heavy components Apr 5, 2024
@benjamincanac benjamincanac merged commit 91e5002 into nuxt:dev Apr 5, 2024
2 checks passed
@noook
Copy link
Collaborator Author

noook commented Apr 5, 2024

I don't know why createReusableTemplate was causing issues here, this should be strictly equivalent πŸ€”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants