This PR changes the type of effects to be async generator functions yielding/returning Msg. Yield receives the current state, allowing multi-step effects to sample state and make decisions about how to proceed.
Since the store and effects are a feedback loop, this is functionally equivalent to using Promise-based effects and recursion. However, it may open up more familiar control flow opportunities. YMMV.
Example
Basic example of a single side-effect. Not all that different from using async functions.
Status: speculative.
This PR changes the type of effects to be async generator functions yielding/returning Msg. Yield receives the current state, allowing multi-step effects to sample state and make decisions about how to proceed.
Since the store and effects are a feedback loop, this is functionally equivalent to using Promise-based effects and recursion. However, it may open up more familiar control flow opportunities. YMMV.
Example
Basic example of a single side-effect. Not all that different from using async functions.
A more complex multi-step example: