prevent setState after submitting the form
This commit is contained in:
parent
2e8b3543b0
commit
749a6bd4f6
|
@ -78,8 +78,14 @@ const AddCustomToken = (props: Props) => {
|
|||
|
||||
const formSpyOnChangeHandler = async (state) => {
|
||||
const {
|
||||
errors, validating, values, dirty,
|
||||
errors, validating, values, dirty, submitSucceeded,
|
||||
} = state
|
||||
// for some reason this is called after submitting, we don't need to update the values
|
||||
// after submit
|
||||
if (submitSucceeded) {
|
||||
return
|
||||
}
|
||||
|
||||
if (dirty && !validating && errors.address) {
|
||||
setFormValues(INITIAL_FORM_STATE)
|
||||
}
|
||||
|
@ -122,6 +128,7 @@ const AddCustomToken = (props: Props) => {
|
|||
errors: true,
|
||||
validating: true,
|
||||
dirty: true,
|
||||
submitSucceeded: true,
|
||||
}}
|
||||
onChange={formSpyOnChangeHandler}
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue