redux-form: Error is undefined
According to http://redux-form.com/6.0.5/docs/api/Props.md/
error
should contain promise rejection from onSubmit
. However when I reject the promise, I see that the submisionFailed
field gets properly set to false, but error
is still undefined. When would that be the case?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 5
- Comments: 23
You will see that the error in props always return undefined
in my case i figured it out:
WRONG: { ‘data.email’:‘invalid email’ }
CORRECT (using object notation {‘data’:{‘email’:‘invalid email’}}
which gets correctly delivered to the field
*note perhaps include it in the submission error documentation how to handle dot notation?
same issue here, strangely enough the error is correctly stored in the state reduxstate.form.myform.submitErrors contains the correct field names, but the rendered field component receives field.meta.errors=undefined, but field.meta.submitFailed is True …
I think I may have identified this as a webpack / babel issue. This would explain why reproducing this in a jsfiddle is hard:
Basically, if in your app you do:
The instance of fails here:
_SubmissionError2.default !== the SubmissionError imported to user land! This issue about babel seems to highlight this: https://stackoverflow.com/questions/33870684/why-doesnt-instanceof-work-on-instances-of-error-subclasses-under-babel-node
Hmm @Ethaan I am pretty sure we are returning a promise. Still does not work.
@kylanhurt please provide a working example. Start here: https://jsfiddle.net/gustavohenke/48814zsq/