Streamed hydration, step by step
This page is one HTTP response that arrives in pieces. Each box says which piece it came in, what it is waiting for, and whether Angular has taken it over yet. The event log records each step as it happens. The docs take a real page's response apart the same way, in One response, flush by flush.
The server's data takes 1500 ms (A), 2400 ms (D), 3600 ms (B) and 6000 ms (C). Reload to watch it again, or change the speed:
1 · The shell
Everything outside the @defer blocks below is the shell: this text, every box's frame and heading, and the placeholders inside the blocks. The server rendered it once the route was in place, without waiting for the data, and sent it in the first flush, with an inline runtime and the app's script at the end. The response stays open, and Angular starts and hydrates the shell while the rest is still on its way.
Server HTML, not hydrated yet. Angular hydrates it as soon as main.ts has loaded, without waiting for the end of the response.
2 · Block A hydrates as soon as its own data is there
The frame of this box is shell. Its contents are a @defer block: when data A is ready, after 1500 ms, the server renders the block again and streams it as a chunk, a <template> plus a script. The script swaps the new markup in and hands data A to the app. That makes a() true, so Angular hydrates the block right away, while B, C and D are still loading.
Placeholder from the shell. The server sent this before data A existed. The chunk for this block replaces it.
3 · Block B, with block C nested inside
Data B takes 3600 ms. Block C sits inside block B's contents, so it doesn't exist until B's chunk brings it, still showing its own placeholder. When data C arrives, at 6000 ms, the server sends block C by itself. It can still be swapped in, even though Angular has already hydrated block B around it.
Placeholder from the shell. Block C is not in the document yet: it lives inside block B's contents.
4 · Block D waits for the whole stream
Data D is ready after 2400 ms, before B and C, and its chunk arrives then. But hydrate on idle says nothing about data: the browser could go idle before the chunk lands, and Angular would hydrate the placeholder. So the client keeps this block out of Angular's hands until the stream is done, and only then lets the trigger fire. Watch it stay "not hydrated" after its content has arrived.
Placeholder from the shell. The chunk for this block replaces it.
5 · Outside any block: never in the server HTML
The quotes below show data A, just like block A, but they are not inside a @defer block. They belong to the shell, which went out before data A arrived and is never sent again. So the server HTML has empty quotes, and the text appears only because Angular renders it in the browser once data A arrives. The response inspector shows the empty quotes in the shell. (With no delay, data A is ready before the shell is taken, so the quotes are filled in the server HTML too.)
“”
6 · Requests the browser sent: 0
The page asks for all four pieces of data in the browser too. A request the server is already making is held back until its response arrives on the stream, then answered from transfer state, so the browser never fetches it. If this number goes above 0, the browser fetched something itself. That happens when the stream breaks off before all the data has arrived: the client then releases its held requests and lets them go to the network.