Closed tappleby closed 8 years ago
Is this going to be merged?
I agree with @Qrysto that I think we need to branch off the original promise to dispatch the actions, but ultimately return the original promise from action.payload
.
I think what's happening here is that the middleware is essentially inserting a .catch
into the promise chain, which causes the chain to "recover" and carry on with the chain. A .then
after a .catch
will receive the return value from the .catch
. You can see an example here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch#Examples
There's a related issue here: #23
I also stumbled upon this issue, and would really appreciate to see this resolved. Any plans on merging this?
Is @acdlite monitoring this pull request? We are running into the same issues the OP has and this would definitely solve those issues.
Please create a new npm version with this code! :-)
This is a big breaking change and I'm not sure why it was needed - the reducer or next middleware in the chain can easily throw back all error-actions.
With this change code that relies on rejections being transformed to error-actions and dispatched onward is broken and needs to add an additional handler for the new rejection in addition to the error-action handling.
It also takes away from the next middleware the ability to affect the return value of the dispatch.
Is it possible to at least add a configuration option to keep it the way it was?
The current behaviour might be intentional but I ran into an issue this evening where calling
then
on a dispatched promise would always result in being fulfilled:This PR will reject the error after dispatching the action.