This repository was archived by the owner on Apr 6, 2023. It is now read-only.
fix(nuxt): remove fragment from createClientOnly#7774
Merged
Conversation
|
|
✅ Deploy Preview for nuxt3-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
danielroe
reviewed
Sep 23, 2022
Member
danielroe
left a comment
There was a problem hiding this comment.
Thank you! ❤️
This seems like a good fix to me. Is there a way we can add a test for the different kinds of client-only components? Maybe a page in the fixture with a variety of types and we can use createPage to assert that all content is correctly displayed?
Member
Author
|
I think this should now cover most of the issues we can run into.
let me know if i missed something :) |
danielroe
approved these changes
Sep 23, 2022
Member
danielroe
left a comment
There was a problem hiding this comment.
This looks great, and I'm really happy with the test suite - thank you 😊
antfu
approved these changes
Sep 25, 2022
Member
Author
|
i forgot to set .client on some test components |
createClientOnlycreateClientOnly
Member
Author
|
updated #7774 (comment)
|
danielroe
approved these changes
Sep 26, 2022
7 tasks
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Linked issue
linked to #6165 (comment)
resolves nuxt/nuxt#15014, resolves nuxt/nuxt#15039
❓ Type of change
📚 Description
Hi 👋 👋 This PR remove the Fragment workaround which prevent using v-show on .client components even if it has a single root node.
There is additionnal changes in the setup part where we return the render function.
Previously in the linked PR, there's was a
Oldchildren is nullissue if we returned directly the setup result as a render function.Using the
h()function to return the VNode was working only for some components (based on @danielroe 's #6165 (comment)).However the component fails to render or update its render silently if it only has a root tag with a string and a variable such as :
The workaround was to use a Fragment but it leads to nuxt/nuxt#15014 issue .
This is fixed by verifying the result of the render function
childrenwhich can bestring|array|null|objectand rendering the component usingcreateElementVNodewhen res.children is null or a string📝 Checklist