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

Extra fields in action creator breaks detection of promise(?) #27

Open
oltsa opened this issue Feb 4, 2016 · 2 comments
Open

Extra fields in action creator breaks detection of promise(?) #27

oltsa opened this issue Feb 4, 2016 · 2 comments

Comments

@oltsa
Copy link

oltsa commented Feb 4, 2016

I bumped into a problem and i'm not sure if it's because of axios or this middleware,
but when I'm trying to return an updated array of elements, I need to pass index to the reducer

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

either it's not detecting it or i'm doing something wrong (bets on the ladder) as with
only type and payload I can hook into with with .then from the component where I dispatch the action, but with adding extra field I cannot

@oltsa oltsa changed the title Adding extra fields to action creator Extra fields in action creator breaks detection of promise(?) Feb 5, 2016
@adriancooney
Copy link

redux-promise depends on flux-standard-actions's isFSA method which defines a standard action to have four valid keys: type, payload, error, meta. Since your promise uses the payload property (otherwise redux-promise won't detect it), you have to stick the index into the meta object on the action.

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

@oltsa
Copy link
Author

oltsa commented Feb 9, 2016

Aah thank you!

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