You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In your documentation, it is stated: "Because all mutations are centralized and happen one by one in a strict order, there are no subtle race conditions to watch out for"
Can you please give an example of how a race condition can occur? Given that JS is single threaded, every 'action' on the model will operate in a strict order (the execution order). Obviously, asynchronous functions can delay when a mutation occurs, but this is the same as an async action creator 'waiting' before dispatching an action (actions are processed synchronously).
Ive struggled to see how any flux implementation helps in this respect. All they do is allow for a 'change' event after the mutation.
Any help with what i'm conceptually missing would be great!
The text was updated successfully, but these errors were encountered:
Obviously, asynchronous functions can delay when a mutation occurs, but this is the same as an async action creator 'waiting' before dispatching an action (actions are processed synchronously).
Yes. But even async action creator leaves a trace: a synchronous dispatch. If you log them, you can see how a race condition has occurred, if it has, and you can reproduce the exact same state if you replay actions in this order. Flux-when-you-don't-do-AJAX-from-Stores has the same benefits.
By contrast, with something like Backbone or Flux-when-you-call-AJAX-from-Stores, there is no way to reproduce a race condition. You might have a subtle bug due to requests sometimes coming in the wrong order, but unless there is a single synchronous point where everything has to be described as a plain object actions, there is no way for you to reliably reproduce such race conditions.
Of course we can't magically solve the race conditions, as any program is asynchronous (even user input is :-). But Redux makes them explicit, so if you ever get them, you know how to debug, log, and reproduce them.
In your documentation, it is stated: "Because all mutations are centralized and happen one by one in a strict order, there are no subtle race conditions to watch out for"
Can you please give an example of how a race condition can occur? Given that JS is single threaded, every 'action' on the model will operate in a strict order (the execution order). Obviously, asynchronous functions can delay when a mutation occurs, but this is the same as an async action creator 'waiting' before dispatching an action (actions are processed synchronously).
Ive struggled to see how any flux implementation helps in this respect. All they do is allow for a 'change' event after the mutation.
Any help with what i'm conceptually missing would be great!
The text was updated successfully, but these errors were encountered: