Skip to content

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

@olslash

Description

@olslash

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; 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions