final-form / final-form/react-final-form
useField always returns checked to 'false' for radio type field with parse function
- Dominant language
- JavaScript
- Stars
- 7.4k
- Forks
- 497
- PR merge metrics
- No merged PRs in 30d
Description
Hey, thanks for RFF :) I am having some troubles with a radio input:
### Are you submitting a **bug report** or a **feature request**?
**bug report**
### What is the current behavior?
I am using a parsed input field of type 'radio', managed trough useField.
It appears the value stored in the form's state has well been parsed with my parse function.
But then, when clicking on the button, the checked input prop return by useField is always false.
It seems useField is comparing the parsed value stored in the form state to the value of the radio but without parsing it first, see : https://github.com/final-form/react-final-form/blob/f3c1aea93b520c0620f1b8090f5966e0da94a798/src/useField.js#L221
I was wondering if this is deliberate ?
### What is the expected behavior?
I would expect the value to be parsed in order to determine the `checked` value
### Sandbox Link
Here is the sandbox : https://codesandbox.io/s/fervent-wright-20ngr
I would expect that clicking on "half" or "full" checks the related radio input (the example is not very usefull, but in my real case, the value of the form has to be parsed before being sent to my api and I have a "default" radio button which should be parsed to empty string '')
### What's your environment?
- React Final Form version : 6.3.3
- Final Form version : 4.18.6
- browser : chrome v80
- node : v12.4.0
Contributor guide
Assessment
This issue has not been assessed yet.