-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Server islands #11305
Server islands #11305
Conversation
🦋 Changeset detectedLatest commit: a63ff42 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
!preview server-islands |
Snapshots have been released for the following packages:
Publish Log
Build Log
|
This alternative gives the expected result for a recursive component: ---
import Self from './Foo.astro'; // Name of the file where this is on
import * as timers from 'node:timers/promises';
await timers.setTimeout(1000);
const now = Date();
---
<p>
{now}
</p>
{!Astro.props.stop && <Self stop server:defer />} |
Does that work normally? I was trying to use |
Yes, without |
Can the example be extended to several pages (e.g. online shop items 1, 2 and 3)? This would allow you to see how the server-islands behave when changing pages and consider how you could eliminate the (probable) flickering, e.g. at the count. |
Great work here! however it would be better if there's some sort of client persistence/caching mechanism. It'd be too server consuming to load the server island on every navigation. I suggest adding a |
@Mouaz that will work if you use the |
* Add support for the build to Server Islands * Use command instead * editor tips * Add comment about defaultRoutes * Use renderChunk instead of generateBundle
!preview server-islands |
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Just noting there's no changeset yet, which I'd normally look over too. But, docs are approved, and we usually use some manner of copy/paste of those, so would be straightforward to pull from there when it's time. That's the only reason there's no explicit docs approval here! The in-docs docs are good to on my end. (Also just confirming that I didn't see any new error messages introduced with this!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some suggestions to consider here @matthewp !
- link to docs is always good! (your call if you want the RFC, blog post etc. Note: docs will have the RFC link there)
- added concepts (without going into details) of needing both a server rendered mode and fallback content
- Chose a bit more active phrase to hint at "turning existing components into" vs another more definition-y "server islands are" Just feels a bit more exciting! And easy to do!
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving for docs! 🥳
Co-authored-by: Sarah Rainsberger <[email protected]>
* Spike * Server Islands * Remove extra stuff * Fix build, a little * Fix build * astro metadata can be undefined * Add server:defer type * Add support for the build to Server Islands (#11372) * Add support for the build to Server Islands * Use command instead * editor tips * Add comment about defaultRoutes * Use renderChunk instead of generateBundle * Server islands tests (#11405) * Add support for the build to Server Islands * Use command instead * editor tips * Add comment about defaultRoutes * Use renderChunk instead of generateBundle * Adds tests for server islands * linting * Pass slots to server islands (#11431) * Require the experimental flag to use server islands (#11432) * Require the experimental flag to use server islands * Add flag to tests/examples * Protect SSR against SI not being enabled * Update the docs in the API ref * Upgrade to compiler 2.9.0 * Update packages/astro/src/@types/astro.ts Co-authored-by: Sarah Rainsberger <[email protected]> * Update packages/astro/src/@types/astro.ts Co-authored-by: Sarah Rainsberger <[email protected]> * Update packages/astro/src/@types/astro.ts Co-authored-by: Sarah Rainsberger <[email protected]> * Update packages/astro/src/@types/astro.ts Co-authored-by: Sarah Rainsberger <[email protected]> * Update packages/astro/src/@types/astro.ts Co-authored-by: Sarah Rainsberger <[email protected]> * Update packages/astro/src/@types/astro.ts Co-authored-by: Sarah Rainsberger <[email protected]> * Update packages/astro/src/@types/astro.ts Co-authored-by: Sarah Rainsberger <[email protected]> * Fix lockfile * Add a changeset * Update .changeset/five-rocks-vanish.md Co-authored-by: Sarah Rainsberger <[email protected]> * Update .changeset/five-rocks-vanish.md Co-authored-by: Sarah Rainsberger <[email protected]> * Update .changeset/five-rocks-vanish.md Co-authored-by: Sarah Rainsberger <[email protected]> * Update .changeset/five-rocks-vanish.md Co-authored-by: Sarah Rainsberger <[email protected]> * Update lockfile * Update .changeset/five-rocks-vanish.md Co-authored-by: Sarah Rainsberger <[email protected]> --------- Co-authored-by: Sarah Rainsberger <[email protected]>
API Bashing
Create a new Astro project as normal:
After that has been created, install the preview release:
To use server islands you need to set your
output
to'hybrid'
or'server'
:Then add
server:defer
to any component. You can provide fallback HTML that will be rendered on the initial request withslot="fallback"
:Changes
server:defer
directive to allow deferred islands that are loaded from the server after the page loads.Testing
TODO
Docs
TODO