mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
Remove experimental.serverIslands flag (#11991)
* Remove experimental.serverIslands flag * update link to the guide * Add changeset * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> --------- Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
This commit is contained in:
parent
a604a0ca9e
commit
d7a396ca3e
3 changed files with 7 additions and 67 deletions
5
.changeset/dry-lamps-smile.md
Normal file
5
.changeset/dry-lamps-smile.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Update error link to on-demand rendering guide
|
|
@ -415,7 +415,7 @@ export const AdapterSupportOutputMismatch = {
|
||||||
/**
|
/**
|
||||||
* @docs
|
* @docs
|
||||||
* @see
|
* @see
|
||||||
* - [Server-side Rendering](https://docs.astro.build/en/guides/server-side-rendering/)
|
* - [On-demand Rendering](https://5-0-0-beta.docs.astro.build/en/guides/on-demand-rendering/)
|
||||||
* @description
|
* @description
|
||||||
* To use server islands, the same constraints exist as for sever-side rendering, so an adapter is needed.
|
* To use server islands, the same constraints exist as for sever-side rendering, so an adapter is needed.
|
||||||
*/
|
*/
|
||||||
|
@ -423,7 +423,7 @@ export const NoAdapterInstalledServerIslands = {
|
||||||
name: 'NoAdapterInstalledServerIslands',
|
name: 'NoAdapterInstalledServerIslands',
|
||||||
title: 'Cannot use Server Islands without an adapter.',
|
title: 'Cannot use Server Islands without an adapter.',
|
||||||
message: `Cannot use server islands without an adapter. Please install and configure the appropriate server adapter for your final deployment.`,
|
message: `Cannot use server islands without an adapter. Please install and configure the appropriate server adapter for your final deployment.`,
|
||||||
hint: 'See https://docs.astro.build/en/guides/server-side-rendering/ for more information.',
|
hint: 'See https://5-0-0-beta.docs.astro.build/en/guides/on-demand-rendering/ for more information.',
|
||||||
} satisfies ErrorData;
|
} satisfies ErrorData;
|
||||||
/**
|
/**
|
||||||
* @docs
|
* @docs
|
||||||
|
|
|
@ -1603,71 +1603,6 @@ export interface AstroUserConfig {
|
||||||
*/
|
*/
|
||||||
clientPrerender?: boolean;
|
clientPrerender?: boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* @docs
|
|
||||||
* @name experimental.serverIslands
|
|
||||||
* @type {boolean}
|
|
||||||
* @default `false`
|
|
||||||
* @version 4.12.0
|
|
||||||
* @description
|
|
||||||
*
|
|
||||||
* Enables experimental Server Island features.
|
|
||||||
* Server Islands offer the ability to defer a component to render asynchronously after the page has already rendered.
|
|
||||||
*
|
|
||||||
* To enable, configure an [on-demand server rendering `output` mode](https://docs.astro.build/en/basics/rendering-modes/#on-demand-rendered) with an adapter, and add the `serverIslands` flag to the `experimental` object:
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* {
|
|
||||||
* output: 'hybrid', // or 'server'
|
|
||||||
* adapter: nodejs({ mode: 'standalone' }),
|
|
||||||
* experimental: {
|
|
||||||
* serverIslands: true,
|
|
||||||
* },
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* Use the `server:defer` directive on any Astro component to delay initial rendering:
|
|
||||||
*
|
|
||||||
* ```astro "server:defer"
|
|
||||||
* ---
|
|
||||||
* import Avatar from '~/components/Avatar.astro';
|
|
||||||
* ---
|
|
||||||
* <Avatar server:defer />
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* The outer page will be rendered, either at build time (`hybrid`) or at runtime (`server`) with the island content omitted and a `<script>` tag included in its place.
|
|
||||||
*
|
|
||||||
* After the page loads in the browser, the script tag will replace itself with the the contents of the island by making a request.
|
|
||||||
*
|
|
||||||
* Any Astro component can be given the `server: defer` attribute to delay its rendering. There is no special API and you can write `.astro` code as normal:
|
|
||||||
*
|
|
||||||
* ```astro
|
|
||||||
* ---
|
|
||||||
* import { getUser } from '../api';
|
|
||||||
*
|
|
||||||
* const user = await getUser(Astro.locals.userId);
|
|
||||||
* ---
|
|
||||||
* <img class="avatar" src={user.imageUrl}>
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* #### Server island fallback content
|
|
||||||
*
|
|
||||||
* Since your component will not render with the rest of the page, you may want to add generic content (e.g. a loading message) to temporarily show in its place. This content will be displayed when the page first renders but before the island has loaded.
|
|
||||||
*
|
|
||||||
* Add placeholder content as a child of your Astro component with the `slot="fallback"` attribute. When your island content is available, the fallback content will be replaced.
|
|
||||||
*
|
|
||||||
* The example below displays a generic avatar as fallback content, then animates into a personalized avatar using view transitions:
|
|
||||||
*
|
|
||||||
* ```astro
|
|
||||||
* <Avatar server:defer>
|
|
||||||
* <svg slot="fallback" class="generic-avatar" transition:name="avatar">...</svg>
|
|
||||||
* </Avatar>
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* For a complete overview, and to give feedback on this experimental API, see the [Server Islands RFC](https://github.com/withastro/roadmap/pull/963).
|
|
||||||
*/
|
|
||||||
serverIslands?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @docs
|
* @docs
|
||||||
* @name experimental.contentIntellisense
|
* @name experimental.contentIntellisense
|
||||||
|
|
Loading…
Reference in a new issue