type is not what was selected
Closed this issue · 4 comments
Form:
const typePrefix = 'LOGIN';
const formAction = createFormAction(typePrefix);
const LoginForm = ({ handleSubmit, submitting }) => (
<form onSubmit={handleSubmit(formAction)}>
Results to action being dispatched: {type: "@@redux-form-saga/PROMISE", payload: Object}
Hmm I think it's because I am on redux-form 6.
I'm also seeing this - I was assuming I was doing something wrong. Have I misunderstood the docs? I have my form set up pretty much the same as here/in the docs, and all i'm seeing getting dispatched is the PROMISE action. Inside the payload I can see the request object (with my form data), but the {PREFIX}_REQUEST
action never gets dispatched.
package installs:
...
"redux-form": "^6.2.1",
"redux-form-saga": "0.0.8",
...
This is not related to the version of redux-form
. @@redux-form-saga/PROMISE
is internal action. You should add middleware that handle this kind of actions, without middleware nothing will work. It is not clearly stated in the README
, we have to update it:
Then, to enable Redux Form Saga, add
formActionSaga
in yoursagaMiddleware.run()
.
So, you have to do following:
import { formActionSaga } from 'redux-form-saga';
const sagas = [yourFirstSaga, yourOtherSaga, ..., formActionSaga];
sagas.forEach(sagaMiddleware.run);
Thank you! That was the missing piece.
For what it's worth, this also works by adding it to the rootSaga that's already getting run:
export default function* rootSaga() {
yield [
fork(formActionSaga),
...
]
}
Yes, @afitiskin that was the missing piece. Maybe we should have it more obvious to find in the REAME?