Skip to content

Commit

Permalink
Avoid infinite dispatching if error is a promise that rejects with it…
Browse files Browse the repository at this point in the history
…self. Fixes redux-utilities#33.

Doing this with quick editing, without testing. Sorry, don't have much time now.
  • Loading branch information
rkatic committed Jul 29, 2016
1 parent ae01607 commit 2af37ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -12,7 +12,7 @@ export default function promiseMiddleware({ dispatch }) {
: next(action);
}

return isPromise(action.payload)
return isPromise(action.payload) && !action.error
? action.payload.then(
result => dispatch({ ...action, payload: result }),
error => {
Expand Down

0 comments on commit 2af37ff

Please sign in to comment.