You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
extend streaming resource with {status} capability #59712
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
After playing around with the new streaming resource in 19.2.0-next.0 I thought about different usecases where I would like to use this.
First: the resource is only in "Loading" state when a new request is emitted until the promise resolves with the first (signal of) value. Afterwards, when a new value is emitted the resource will just update. This is fine!
But what if the implementation "knows" when it is fetching a value?
Example 1: Polling
Imagine some API which doesn't support streaming, so it has to be polled. The "poller" would then know when it is going to fetch the next value (even on the same request).
Example 2: Retry
Imagine some streaming resource implementation which automatically retries after an error occured. It will then know when it is "Reloading".
When the signal of the streaming resource emits a "status" the Resource<T> transitions to the given state (I don't think the other ResourceStatus values make sense here).
Alternatives considered
Currently the implementation would have to encode the (re)loading information into its value and that can't be populated to the Resource<T>'s status.
Activity
alxhub commentedon Jan 29, 2025
(whoops, wrong issue)