Odonno / ReduxSimple

Simple Stupid Redux Store using Reactive Extensions
http://www.nuget.org/packages/ReduxSimple/
MIT License
144 stars 20 forks source link

ObserveAction with current state #95

Closed akaegi closed 2 years ago

akaegi commented 3 years ago

Overload for ObserveAction that allows the observers to get the state at the point when the action was dispatched.

Use case: Action ChangeNameAction Action observer that persists the user object with the new changed name into a file. The handler needs the state at the point in time when the action was dispatched.

Note that the handler cannot just simply get Store.State because it might have changed in the meanwhile (action observers might get called asynchronously or on different threads).

I added an overload so that previous usages of ObserveAction remain valid (backwards compatibility).

Odonno commented 2 years ago

Sorry for the delay Andreas (see what I did there).

Your feature seems like a nice addition to this lib. I also really like the removal of Task.Delay in the unit tests. So thank you very much. Will publish a new version asap.