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(nuxt): allow client components within NuxtIsland
#22649
Conversation
β¦n/nuxt into feat/granular-client
Run & review this pull request in StackBlitz Codeflow. |
7c9d45e
to
761dea3
Compare
Co-authored-by: Daniel Roe <daniel@roe.dev>
Co-authored-by: Daniel Roe <daniel@roe.dev>
β¦n/nuxt into feat/granular-client
/trigger release |
π Release triggered! You can now install nuxt@npm:nuxt-nightly@pr-22649 |
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## main #22649 +/- ##
=======================================
Coverage ? 59.25%
=======================================
Files ? 5
Lines ? 945
Branches ? 54
=======================================
Hits ? 560
Misses ? 385
Partials ? 0 β View full report in Codecov by Sentry. |
/trigger release |
π Release triggered! You can now install nuxt@npm:nuxt-nightly@pr-22649 |
4a7d11d
to
5c14de4
Compare
π Linked issue
#19772
β Type of change
π Description
Hi π This PR finally introduce client components within island components.
How does it works ?
This still use
Teleport
and the same trick of reactivity from client-side slots.nuxt-client
prop/attr -><SugarCounter :multiplier nuxt-client />
How to enable it
This feature is behind a flag:
experimental.componentIslands.selectiveClient
(i'm open for any other name likenuxtClient
,selectiveHydration
?) which needs to be set to trueAbout remote islands
NuxtIsland
with remote islands (it's thesource
prop introduced in Nuxt 3.7), you need to setdangerouslyAllowClientComponents
totrue
in order to load client components for security reasons (you should'nt trust a remote island)<NuxtIsland source="some-source.com" name="SomeComponent" dangerouslyAllowClientComponents />
.Allow deeply selective hydration within server component (.server -> component -> component -> nuxt-client)laterAbout
nuxt-client
Since we use
nuxt-client
to determine wich component should be loaded client-side, this means that this cannot be used as attribute by users (we remove it).About payload
Since we cannot only rely on what is received by the HTML during hydration, this means we need to retrieve some additionnal payloads:
What's next
Todo (by priorities) - it's working but some small improvement can be done
nuxt-client
attr from the client componentfilter teleports (in the island response) if neededinput
ormanualChunk
)IF usingmanualChunk
instead ofrollupOptions.build.input
to chunk components, makemanualChunk
hookable so users can extend itinput
, fix the client/ssr stylesMake the unplugin compatible with webpack (if possible :( ).(later....probably)π Checklist