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

tab content is not displayed when components are imported async #2596

Closed
ahoyahoy opened this issue Jul 15, 2023 · 5 comments · Fixed by #2642
Closed

tab content is not displayed when components are imported async #2596

ahoyahoy opened this issue Jul 15, 2023 · 5 comments · Fixed by #2642
Assignees

Comments

@ahoyahoy
Copy link

tab content is not displayed when components are imported async
until click tab button or page is rerendered (with already initialized components)

minimal example
https://stackblitz.com/edit/github-lbvgvg-h9qsnw?file=src%2FApp.vue

I noticed a similar behavior with the components for the dropdown menu, when the width of the menu according to the button is incorrectly set the first time, but when rerendering it works fine

@RobinMalfait RobinMalfait self-assigned this Jul 27, 2023
@RobinMalfait
Copy link
Member

Hey, thank you for this bug report! 🙏

What is the reason you want to do this? I think what I would do instead is use Headless UI as described in the docs and import it straight away. But if you want to optimize the contents, lazy load the contents of the TabPanel instead of the TabPanel itself.

Is this a solution that would work for you?

@ahoyahoy
Copy link
Author

Hi @RobinMalfait

the use case is dynamic loading components in the page builder, so the components are not part of the main application.

:(

@ahoyahoy
Copy link
Author

ahoyahoy commented Aug 1, 2023

ping @RobinMalfait

@RobinMalfait
Copy link
Member

RobinMalfait commented Aug 3, 2023

Hey!

Sorry for the delay. Closing an issue doesn't mean that the conversation is over. Closing is more of a way to know that we handle an issue and if new information is available that wasn't available yet that results in the fact that an actual issue is present in Headless UI then we can take next steps and re-open the issue if necessary.

In this case, the potential solution I provided was not enough for your use case which is totally fine. But now that I know your use case a bit more, I dug deeper to see what's going on exactly.

It just took a bit of time on my end to get back to this issue, my apologies for this.

That said, this should be fixed by #2642, and will be available in the next release.

You can already try it using:

  • npm install @headlessui/react@insiders.
  • npm install @headlessui/vue@insiders.

@ahoyahoy
Copy link
Author

ahoyahoy commented Aug 3, 2023

hi @RobinMalfait ,

thank you very much and really sorry for the panic :)

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 a pull request may close this issue.

2 participants