Skip to content

Stream pages that load their data with resource() and httpResource() #120

Done

Description

@ChristopherPHolder

Summary

A page that loads a block's data with resource() or httpResource() does not stream. A resource counts as pending work in Angular, the shell waits for whenStable(), and the page goes out in one piece once the data is in: complete, but not streamed. Only requests made directly with HttpClient stream.

httpResource() is how Angular's own docs load data now, so this is the first thing a new user runs into. Found while recording Analog's streaming SSR, compared (#107, #119): Analog's response was the same with httpResource() as with HttpClient.

What we want

A block whose data comes from a resource streams like one that uses HttpClient.get(): the shell goes out with the block in its loading state, and the block follows in a chunk when the resource has its value.

To work out

  • The shell is taken when the application is stable apart from the requests the renderer follows. A resource has to become one of those, not pending work that holds the shell.
  • httpResource() goes through HttpClient, so streamHttpInterceptor already sees its request. A plain resource() with a loader does not: it may need SERVER_REQUEST_TRACKER behind the scenes, or stay documented as manual.
  • The browser must take the value from the stream and not request it again.
  • Check it against every row of the compat matrix (compat/), zoneless and with Zone.js.

Docs to change with it

Each of these says today that a resource does not stream. The PR that fixes this changes them in the same PR.

  • apps/docs/src/content/guides/making-something-stream.md: step "2. Load its data with HttpClient", and "Data from outside HttpClient" (the resource() bullet, and the streamed() helper if this case no longer needs it).
  • apps/docs/src/content/guides/debugging.md: "The page arrives all at once", which lists a resource as a cause.
  • apps/docs/src/content/reference/faq.md: "Does the data have to come through HttpClient?" and "Why does my page arrive all at once?".
  • apps/docs/src/content/reference/core.md: streamHttpInterceptor and SERVER_REQUEST_TRACKER, plus anything new in the API.
  • apps/docs/src/content/guides/analog-streaming-ssr.md: remove "A block can load its data any way" from "What Analog does that this library does not", and fix the "What a flush waits for" row of "Side by side", the second bullet of "In short" and the last bullet of "How this was captured".
  • libs/stream-example and the apps/example-* it feeds: decide whether the example page switches to httpResource(). If it does, the snippets the runtime pages copy from it change too.
  • README.md, where it says requests "go through HttpClient", and AGENTS.md's "Streaming" bullet if the advice on where data belongs changes.

Done when

  • A page with httpResource() in a block streams: shell first, the block in a chunk when its data is in, hydrated from the server's HTML with no second request. Checked with curl -N and in a browser, on every supported Angular version.
  • Every doc listed above is updated in the same PR, and nothing in the docs still says a resource holds the page back.
  • resource() with a custom loader either streams too, or is documented as the one case that needs SERVER_REQUEST_TRACKER.

Activity

  1. added a commit that references this issue on Nov 28, 2026
    8832e71
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions