Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calls next(action) but doesn't return it #11

Closed
olslash opened this issue Apr 19, 2017 · 3 comments
Closed

calls next(action) but doesn't return it #11

olslash opened this issue Apr 19, 2017 · 3 comments

Comments

@olslash
Copy link

olslash commented Apr 19, 2017

I was running into an error where I was chaining off a promise returned by redux-api-middleware:

this.props.createThing().then((result) => ...)

Without raven-for-redux, result is the correct value (the result of the API call). With raven-for-redux, result is undefined.

I modified the middleware to remove the call here:
https://github.com/captbaritone/raven-for-redux/blob/master/index.js#L33, which calls next(action) but does not return it. I replaced it with return next(action) and my app again works as expected.

looking at http://redux.js.org/docs/advanced/Middleware.html, all the examples return next(action) at some point. I believe it's part of the contract a middleware has to fulfill.

I believe the fix for this is:

      // Set the action as context in case we crash in the reducer.
      const result = next(action)
      const extra = { lastAction: action };
      Raven.context({ extra }, () => result);

      ...

      return result; 
@captbaritone
Copy link
Owner

I've just released 0.7.0. With a fix. Can you try it and see if it resolves your problem?

@olslash
Copy link
Author

olslash commented Apr 20, 2017

Thanks for the quick turnaround @captbaritone. Yep, that fixed it!

@captbaritone
Copy link
Owner

Thanks for digging into it as far as you did. Made the fix easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants