final-form / final-form/react-final-form
Bug: form instance created by createForm, call submit function doesn't meet expectations
- 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
Assessment
This issue has not been assessed yet.