Visitar URL original
docs: clarify streaming resource data flow by joaodemarco 路 Pull Request #71233 路 angular/angular 路 GitHub
Skip to content

docs: clarify streaming resource data flow - #71233

Open
joaodemarco wants to merge 2 commits into
angular:mainfrom
joaodemarco:patch-1
Open

joaodemarco wants to merge 2 commits into
angular:mainfrom
joaodemarco:patch-1

Conversation

@joaodemarco

Copy link
Copy Markdown

Clarify the Streaming Resources documentation to make the data flow between the source signal and the resource explicit.

  • Explain that stream should return a signal representing a continuously updating data source.
  • Clarify that the resource consumes the signal's value and updates when the signal changes.
  • Explain that userUpdates simulates an external source such as WebSocket or SSE.
  • Update the example comment to make the direction of the data flow explicit.
  • Distinguish stream from loader for continuously updating versus one-time asynchronous operations.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

The Streaming Resources documentation does not clearly explain the data flow between the source signal and the resource.

The current example may give the impression that the Resource updates the source signal, rather than consuming a signal that represents an external, continuously updating data source.

Issue Number: N/A

What is the new behavior?

The documentation now explicitly explains that:

  • stream should return a signal representing a continuously updating data source.
  • The resource consumes the signal's current value and updates when the signal changes.
  • The example simulates values arriving from an external source such as a WebSocket or Server-Sent Events (SSE) connection.
  • The distinction between stream and loader is clarified: stream is intended for continuously updating sources, while loader is intended for one-time asynchronous operations.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

This PR only updates the documentation and example comments. It does not modify the Resource API or application behavior.

Clarify the Streaming Resources documentation to make the data flow between the source signal and the resource explicit.

- Explain that `stream` should return a signal representing a continuously updating data source.
- Clarify that the resource consumes the signal's value and updates when the signal changes.
- Explain that `userUpdates` simulates an external source such as WebSocket or SSE.
- Update the example comment to make the direction of the data flow explicit.
- Distinguish `stream` from `loader` for continuously updating versus one-time asynchronous operations.
@pullapprove
pullapprove Bot requested a review from crisbeto October 7, 2026 14:57
@angular-robot angular-robot Bot added the area: docs Related to the documentation label Oct 7, 2026
@ngbot ngbot Bot added this to the Backlog milestone Oct 7, 2026
@atscott atscott added the target: patch This PR is targeted for the next patch release label Oct 7, 2026

@atscott atscott left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The update to the comment in the code snippet (// Simulate a new value arriving from the external data source:) is helpful for making it clear that userUpdates is just mocking incoming events rather than something the resource writes back to.

However, the added prose introduces quite a bit of repetition. Paragraphs 2 and 4 end up saying the same thing back-to-back ("The resource uses the signal's value as its current value and updates when the signal changes" vs "The resource reads the signal's value and updates its own value whenever the signal changes"). It's also slightly imprecise to say the resource uses the signal's value directly as its current value, since stream expects a ResourceStreamItem wrapper ({value: T} | {error: Error}) that gets unpacked.

I'd suggest keeping the updated code comment and either dropping the extra prose or trimming it to a single sentence introducing the example, leaving the original contrast between stream and loader intact.

@joaodemarco

Copy link
Copy Markdown
Author

Thanks for the feedback! I've removed the repetitive explanation and kept the original stream/loader distinction. I also kept the updated code comment since it's the only thing necessary to clarify that the signal in this context is just a "simulation" of an external data source.

@atscott atscott added the action: merge The PR is ready for merge by the caretaker label Oct 7, 2026
@atscott
atscott removed the request for review from crisbeto October 7, 2026 18:43
@joaodemarco joaodemarco changed the title docs(resources): clarify streaming resource data flow docs: clarify streaming resource data flow Oct 7, 2026
@joaodemarco

Copy link
Copy Markdown
Author

I removed the resources scope in the commit message because the linter was blocking it and I didn't found any applicable scope among the accepted ones.

@JeanMeche

Copy link
Copy Markdown
Member

No need for a scope for docs commit, can you make sure to squash both commits. We want this change to be a single commit. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: docs Related to the documentation target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants