mrpmorris / Fluxor

Fluxor is a zero boilerplate Flux/Redux library for Microsoft .NET and Blazor.
MIT License
1.24k stars 141 forks source link

Documentation Suggestion on best practices around using IAsyncEnumerable<T> #316

Closed Giszpenc closed 1 year ago

Giszpenc commented 2 years ago

Hi,

There is a fairly large body of examples online on an a use case where you GetAllFoos which returns a List() and is updated on the UI. However, some functions are just GetFoos which (yied) returns a stream of Foos.

It would be great to see an example using this pattern. Microsoft itself could change the default page from getting a List to getting an IAsyncEnumerable. But with Fluxor, Is there a WeatherStreamState for Begin, (Cancel) and End the stream as well as a WeatherDataState?
Anyway, an example would be nice.

Thanks! Vlad

mrpmorris commented 2 years ago

Your effect should consume the stream and periodically dispatch actions to update the state.