abc123s / redux-batch-enhancer

Batch subscriber notification for an array of actions (including complex actions, e.g. thunks).
25 stars 8 forks source link

Application would stop working in case of a reducer error #7

Open arieh opened 7 years ago

arieh commented 7 years ago

Current implementation would make the dispatch function stop working in case of a broken reducer within a batch, since the batch counter would never reset properly:

Example:

/*
this would make redux throw an error, which would also freeze `batchDepth` at 1. 
Subsequent dispatches will never reach the listeners.
*/
store.dispatch(["foo"]);

Although redux already wraps the reducers in a try block, if any other middleware overrides dispatch in a way that doesn't produce 100% breakage, or if user has a broken action, application would stop working completely until a refresh.