redux-utilities / redux-promise

FSA-compliant promise middleware for Redux.
MIT License
2.67k stars 120 forks source link

Returns promise instead of data if more than 2 return items are specified in action #28

Open xzilja opened 8 years ago

xzilja commented 8 years ago

I'm not sure why this happens, but essentially inside my reducer I receive correct expected data when my action returns:

    return {
      type: STORY_ACTIONS.STORY_SPOTIFY_REQUEST,
      payload: request
    }

and I receive unresolved promise if I add another item to action, like so

    return {
      type: STORY_ACTIONS.STORY_SPOTIFY_REQUEST,
      index: index,
      payload: request
    }

I need to pass index, in order to know which array item to update

ssilve1989 commented 8 years ago

I am also running into this issue.

If I comment the following like so /*if (!_fluxStandardAction.isFSA(action)) { return isPromise(action) ? action.then(dispatch) : next(action); } */

it works. This is from what I've pulled from npm, version 0.5.1. In the current repo it looks like the import for FSA has been changed to import the method directly however. That shouldn't make a difference though.

ColadaFF commented 8 years ago

As specified in https://github.com/acdlite/redux-promise/issues/27 you need to return another params in the metaproperty, like:

return {
  type: ActionTypes.SOMETHING,
  payload: promiseInstance,
  meta: { index }
}