diff --git a/apps/docs/src/app/docs/nav.ts b/apps/docs/src/app/docs/nav.ts index 1b4280d..589724e 100644 --- a/apps/docs/src/app/docs/nav.ts +++ b/apps/docs/src/app/docs/nav.ts @@ -307,6 +307,15 @@ export const DOCS: DocSection[] = [ 'A Suspense boundary, its fallback and loading.js: what each maps to here, and where streaming an Angular page differs from streaming a React one.', load: () => import('../../content/guides/coming-from-react-suspense.md'), }, + { + dir: 'guides', + slug: 'analog-streaming-ssr', + title: "Analog's streaming SSR, compared", + headline: "Analog's streaming SSR and angular-ssr-stream, compared", + description: + 'One page sent through both: what each sends first, what a @defer block waits for, when the page hydrates, and how each reaches into Angular.', + load: () => import('../../content/guides/analog-streaming-ssr.md'), + }, { dir: 'guides', slug: 'debugging', diff --git a/apps/docs/src/content/concepts/angular-streaming-ssr.md b/apps/docs/src/content/concepts/angular-streaming-ssr.md index 9fa5f0b..21377ad 100644 --- a/apps/docs/src/content/concepts/angular-streaming-ssr.md +++ b/apps/docs/src/content/concepts/angular-streaming-ssr.md @@ -92,6 +92,11 @@ page whose application has already started, without Angular finding a mismatch. A block that Angular is not looking at yet is the one place where that is allowed. +Two projects build streaming on it from outside Angular: this one, and +[Analog](https://analogjs.org), the meta-framework, whose renderer is +experimental. [Analog's streaming SSR, compared](../guides/analog-streaming-ssr.md) +sends one page through both. + ## Adding the other half angular-ssr-stream does the sending. It renders with Angular's own platform, but diff --git a/apps/docs/src/content/guides/analog-streaming-ssr.md b/apps/docs/src/content/guides/analog-streaming-ssr.md new file mode 100644 index 0000000..b1a0b9e --- /dev/null +++ b/apps/docs/src/content/guides/analog-streaming-ssr.md @@ -0,0 +1,244 @@ +[Analog](https://analogjs.org), the Angular meta-framework, has a streaming +renderer of its own: [`renderStream()`][docs], added in version 2.7, +experimental and opt-in. It and this library build on the same piece of Angular, +[incremental hydration][ih], and an app marks its slow parts the same way in +both: a `@defer` block with a `hydrate` trigger. What differs is what goes over +the wire, and when. This page sends one page through both and reads the two +responses. + +Everything said about Analog here is from version 3.0.0: its [docs][docs], the +[RFC][rfc] its renderer was built from, [its source][render], and a response +recorded from an app built with it. The RFC lists what is planned next, so +expect some of this to change. + +## The same page through both + +The page is the one in Analog's own [example app][example]: a heading and a +component outside any block, and three blocks. Block B shows a label that comes +from a request taking 600 ms. + +```html title="index.page.ts, its template" +

Analog Streaming SSR

+ + + +@defer (hydrate on immediate) { + +} @placeholder { +

Loading A…

+} + + +@defer (hydrate on immediate) { + +} @placeholder { +

Loading B…

+} + + +@defer (hydrate on interaction) { + +} @placeholder { +

Loading C…

+} +``` + +Here is what arrived, and when: + +| Time | Analog 3.0.0 | angular-ssr-stream | +| ----------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| 0.03 s | ``, with the entry script as a `modulepreload`. An inline runtime, and an empty `
` | The shell: the heading, the component and all three blocks, each where it belongs. B says `label = loading`. Then the runtime and the entry script | +| 0.03 s | Blocks A, B and C, each in a `