throw new SubmissionError() causing Uncaught (in promise) error.
See original GitHub issueHello! I am using Redux Thunk and React Form to do submission validations against my signup form. I want the errors returned by my API endpoint to appear inline in my form. Hence why I need SubmissionError. Everything works great without throwing a new submission error, the form does exactly what I need it to do. The problem is, when I put in the single line to throw new SubmissionError()
I get the following error:
Here is my Action creator (using Redux Thunk):
import axios from 'axios';
import { browserHistory } from 'react-router';
import { CTAButtonUnload } from '../../buttons/CTAButton/CTAButtonUnload'
import { SubmissionError } from 'redux-form'
const ROOT_URL = 'XXXXXXXXXXXXXX';
export const signupUser = (formData) => {
return function(dispatch) {
axios.post(ROOT_URL + '/v1/user', {
firstName: formData.firstName,
lastName: formData.lastName,
email: formData.email,
password: formData.password
})
.then(response => {
dispatch({
type: 'CTAButtonUnload',
payload: {
hover: false,
click: false,
loading: false
}
})
browserHistory.push('/signup/workspace');
})
.catch(response => {
if(response.response.data.code == 403){
throw new SubmissionError({email: null, _error: response.response.data.description})
}
dispatch({
type: 'CTAButtonUnload',
payload: {
hover: false,
click: false,
loading: false
}
})
});
}
}
Could this error be caused by a promise inside of SubmissionError()
? I saw that others have had similar problems with this error, but they look to be using the Async validation option, I am not, so I am wondering if I am doing something wrong or if this is something with reduxForm?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:21
- Comments:17 (1 by maintainers)
Top Results From Across the Web
Throwing a SubmissionError of redux-form causes ...
Redux Form is expecting the error to come as the error in a rejected promise. Try this: export const searchPermissions = () =>...
Read more >Throwing a SubmissionError of redux-form causes Uncaught ...
Redux Form is expecting the error to come as the error in a rejected promise. Try this: export const searchPermissions = () =>...
Read more >SubmissionError
A throwable error that is used to return submit validation errors from onSubmit . The purpose being to distinguish promise rejection because of...
Read more >uncaught error: objects are not valid as a react child (found
renderPosts() will return a Promise not the actual data, and AFAIK Reactjs will not resolve Promises implicitly in render . You need to...
Read more >Error handling with promises
This happens for all errors, not just those caused by the throw statement. For example, a programming error: new Promise((resolve, reject) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I encountered a similar problem and managed to fix this by adding a return on the submit handler.
from
to
I’m calling
handleSignup()
from my redux form component:I had some progress on this one. As it turned out, I was using
redux-form/immutable
all over my code, except when importingSubmissionForm
, I did:But if you are using
redux-form/immutable
, you need to use:Apparently they are two different classes.