From 263b5e006618b1685c8a58f0efc6ce7c0d79574f Mon Sep 17 00:00:00 2001 From: julien huang Date: Sat, 2 Sep 2023 20:29:35 +0200 Subject: [PATCH] docs(guide): add information for context difference between server conly component and app context --- docs/2.guide/2.directory-structure/1.components.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/2.guide/2.directory-structure/1.components.md b/docs/2.guide/2.directory-structure/1.components.md index 70fab5e8c8..7bc83d5736 100644 --- a/docs/2.guide/2.directory-structure/1.components.md +++ b/docs/2.guide/2.directory-structure/1.components.md @@ -314,6 +314,17 @@ Now you can register server-only components with the `.server` suffix and use th Server-only components use `` under the hood, meaning that `lazy` prop and `#fallback` slot are both passed down to ``. +#### server components and context + +When rendering a server-only or island component, `` makes a HTTP request to GET a `NuxtIslandResponse`. + +This means: +- You can't access to the island context from your SSR app and you can't access to your SSR app context from the island component. Both are different context. +- A new Vue app will be created server-side to create the `NuxtIslandResponse`. +- Plugins will be ran for the island Vue app except those marked with `env.island: false` on an object plugin. + +You can access to an island context during the island component rendering through `nuxtApp.ssrContext.islandContext`. + ::alert{type=info} Slots can be interactive and are wrapped within a `
` with `display: contents;` ::