final-form / react-final-form

🏁 High performance subscription-based form state management for React
https://final-form.org/react
MIT License
7.38k stars 480 forks source link

fire onChange after field mount doesn't reflect field state #638

Open More4ever opened 5 years ago

More4ever commented 5 years ago

bug report

What is the current behavior?

We have a form with custom input component. Component fire onChange event right on mount Changed value visible in form.values but missing in field input.value

What is the expected behavior?

Value should be visible in both field and form

Sandbox Link

https://codesandbox.io/s/react-final-form-on-mount-value-issue-9f92v?fontsize=14

What's your environment?

final-form: 4.18.5 react-final-form: 6.3.0

bsadecki commented 4 years ago

Can confirm this behavior on 6.3.3.

Also, an older duplicate of this ticket: https://github.com/final-form/react-final-form/issues/259

Titozzz commented 4 years ago

Can confirm this still happens with 6.5.0

I though I was going crazy. When getting value form useField input.value it's the old value When getting value form useFormState values["name"] it's the newer value