final-form / final-form/react-final-form

Bug: form instance created by createForm, call submit function doesn't meet expectations

Open
#901 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.4k
Forks
497
PR merge metrics
No merged PRs in 30d

Description

### Are you submitting a **bug report** or a **feature request**?
**bug report**
I use `createForm` API create a form instance, and is used by `Form` Component, example is here:
```ts
const formInstance = createForm({
onSubmit: (values) => { alert(JSON.stringify(values)) }
})

{
({ handleSubmit }) => (



{
({ input }) => (

)
}


internalSubmit

)
}
{
formInstance.submit()
}}>externalSubmit

```
Load for the first time, fill `name` field, click **internalSubmit** and **externalSubmit** button all alert `{name: '...'}`, But after i change something in codebase, such as add `console.log` to `onSubmit`, click **internalSubmit** button can alert `{name: '...'}`, **externalSubmit** button can't alert it.

### Sandbox Link
[react-final-form-bug](https://codesandbox.io/s/react-final-form-bug-9iio8?file=/src/bug1/App.js)

### What's your environment?
MacOS: 10.15.5
Google Chrome: 89.0.4389.90
final-form / react-final-form: lastest

Looking forward to your reply! thank you!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.