Reffects is a Javascript framework for developing SPAs using an event-driven unidirectional flow architecture with a synchronous event bus with effects and coeffects.
Is your feature request related to a problem? Please describe.
Nowadays when we want to ensure the order of execution of certain effects we can't do it unless we use auxiliary event handlers to encapsulate them and then use {{dispatchMany}} (which ensure us the order of dispatch).
For example, maybe I want to mutate state, but at the same time do a side effect (dispatching another event) which relies that this state mutation happened before of this effect handler execution.
Describe the solution you'd like
I propose to have a reverse compatible implementation which supports returning an array in an event handler being possible to do:
The first one will ensure you the effect handler execution order in the sequence you declare the effects.
Also, you avoid using spread operator.
Describe alternatives you've considered
You also can pass to the state effect and the dispatched event in the payload the same value and ignore the execution order in some scenarios (is the solution I've use).
I think, the alternative you described "passing to the state effect and the dispatched event in the payload the same value"
should be preferred, because it avoids the temporal coupling altogether.
Feature request
Is your feature request related to a problem? Please describe. Nowadays when we want to ensure the order of execution of certain effects we can't do it unless we use auxiliary event handlers to encapsulate them and then use {{dispatchMany}} (which ensure us the order of dispatch).
For example, maybe I want to mutate state, but at the same time do a side effect (dispatching another event) which relies that this state mutation happened before of this effect handler execution.
Describe the solution you'd like I propose to have a reverse compatible implementation which supports returning an array in an event handler being possible to do:
Instead of:
The first one will ensure you the effect handler execution order in the sequence you declare the effects.
Also, you avoid using spread operator.
Describe alternatives you've considered You also can pass to the state effect and the dispatched event in the payload the same value and ignore the execution order in some scenarios (is the solution I've use).