Open dpwrussell opened 8 years ago
In my point of view redux-batch-middleware doesn't need to be such complicated, it doesn't require a wrap to reducer, just receive arrays and dispatch them one by one is enough:
export const batch = ({ dispatch }) => {
return (next) => (action) => {
return Array.isArray(action)
? action.forEach(dispatch)
: next(action);
};
};
And in the way any thunk or other type of actions are allowed natively
Any idea if you will extend this with thunk support?
I gave it a try and dispatching an array with a thunk in it, the thunk was not executed.
One plus over
redux-batched-actions
is that at least when dispatching a thunk as normal in redux, this middleware does not swallow it. I was looking for something to batch thunks however.Cheers