2.2.2
版本发布时间: 2015-11-27 02:21:45
pburtchaell/redux-promise-middleware最新发布版本:6.2.0(2023-12-28 03:07:18)
With the previous release, dispatched actions are set through the entire stack of middleware.
const actionCreator = () => ({
type: 'EXAMPLE_TYPE',
payload: {
promise: Promise.resolve({
type: 'RESOLVED_ACTION'
payload: ...
})
}
});
However, this middleware does not check to see if the resolved or rejected parameter is a function. This release adds a check for thunk /function before resolving or rejecting as payload.
For example, now the following will also work:
const actionCreator = () => ({
type: 'EXAMPLE_TYPE',
payload: {
promise: Promise.resolve((dispatch, getState) => {
dispatch({ type: 'RESOLVED_ACTION', payload: '' })
dispatch(someActionCreatorThatMaybeUpdatesTheRoute())
doSomethingNaughtyAfterDispatchingEverything(getState())
})
}
});
This is not a breaking change.