Visitar URL original
docs(resources): clarify streaming resource data flow · angular/angular@67c6ee2 · GitHub
Skip to content

Commit 67c6ee2

Browse files
authored
docs(resources): clarify streaming resource data flow
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.
1 parent 813e90f commit 67c6ee2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎adev/src/content/guide/signals/resource.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ If the `params` computation returns `undefined`, the loader function does not ru
6161

6262
Some asynchronous data sources produce multiple values over time instead of returning a single result. Examples include WebSockets, Server-Sent Events (SSE), and Firestore `onSnapshot` listeners.
6363

64-
Use `stream` for these continuously updating data sources. Unlike `loader`, which resolves once for each request, `stream` should return a signal representing a continuously updating data source. The resource uses the signal's value as its current value and updates when the signal changes.
64+
Use `stream` for these continuously updating data sources. Unlike `loader`, which resolves once for each request, `stream` returns a signal whose value can continue to update as new data becomes available.
6565

6666
Use `loader` for one-time asynchronous operations, such as fetching data from an HTTP endpoint.
6767

68-
In this example, `userUpdates` simulates an external source such as a WebSocket or SSE connection. The resource reads the signal's value and updates its own value whenever the signal changes.
68+
In this example, `userUpdates` simulates an external source such as a WebSocket or SSE connection.
6969

7070
```typescript
7171
const userUpdates = signal({value: 'Alice'});

0 commit comments

Comments
 (0)