I'm having tough time figuring out why this is happening, but essentially Redux Promise was working fine for me while returning something like:
return {
type: STORY_ACTIONS.STORY_SPOTIFY_REQUEST,
payload: request
}
However, I now need to pass another information with it like so
return {
order: 0, // New field
type: STORY_ACTIONS.STORY_SPOTIFY_REQUEST,
payload: request
}
This results in an unresolved promise instead of data. I tried renaming order
to something like position
or index
... still nothing.
You should use the meta
field, which is required by Redux Promise. Redux Promise uses Flux Standard Actions (FSA), which validates the action with this code:
import isPlainObject from 'lodash.isplainobject';
const validKeys = [
'type',
'payload',
'error',
'meta'
];
function isValidKey(key) {
return validKeys.indexOf(key) > -1;
}
export function isFSA(action) {
return (
isPlainObject(action) &&
typeof action.type !== 'undefined' &&
Object.keys(action).every(isValidKey)
);
}
export function isError(action) {
return action.error === true;
}
As you can see, there are only four reserved words for valid keys. So you should add the order property to the 'payload' or maybe 'meta' instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With