score:3

Accepted answer

I think I know what you mean.

You can change that behavior by setting returnRejectedPromiseOnError in middleware config.

Note that promise is returned only to chain actions. If you set this option you will have to always apply catch callback or you will be getting unhandled rejection when calling Promise errors. And this might be causing some issues when handled in components, because these callbacks may be fired when component is already unmounted.

Im my code I try to avoid then as much as possible to avoid these side effects but when I have to I do it like:

fetchSomething.then(action => {
  if(action.type.endsWith('SUCCESS')) {
      ....
  }

})

Related Query

More Query from same tag