Skip to content

Commit 2af37ff

Browse files
authored
Avoid infinite dispatching if error is a promise that rejects with itself. Fixes redux-utilities#33.
Doing this with quick editing, without testing. Sorry, don't have much time now.
1 parent ae01607 commit 2af37ff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function promiseMiddleware({ dispatch }) {
1212
: next(action);
1313
}
1414

15-
return isPromise(action.payload)
15+
return isPromise(action.payload) && !action.error
1616
? action.payload.then(
1717
result => dispatch({ ...action, payload: result }),
1818
error => {

0 commit comments

Comments
 (0)