reducer
is not executed immediately and in order of calls to dispatch
#54
Labels
good first issue
Good for newcomers
Calls to
dispatch
currently results in deferred execution of thereducer
and does not guarantee that messages are processed in the order they were dispatched. This can cause subtle bugs when the reducer has side-effects that depend on ordering.I understand the motivation for this is to have potentially blocking calls in the reducer not block the UI thread. As I understand it, the deferred execution of
reducer
is still run on the UI thread however, but even if it wasn't I think it would be better to have a separate mechanism for deferring side-effects and dispatching messages back to thereducer
to update state. Similarly to how ReasonReact has thereducer
return a variantUpdate | SideEffect
, or how Elm has theupdate
function return a tuple of the state and aCmd
.I therefore propose first changing the reducer to execute immediately, but still have the rendering deferred, and then to consider a separate mechanism for async side-effects to be implemented later.
The text was updated successfully, but these errors were encountered: