final-form / react-final-form

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

Field type="checkbox" no longer passes an input.value in FieldRenderProps #994

Closed ChipElavon closed 2 years ago

ChipElavon commented 2 years ago

Are you submitting a bug report or a feature request?

bug report

What is the current behavior?

Starting in 6.3.1, input.value is no longer included in the FieldRenderProps if the Field has type="checkbox". This change was not mentioned in the release notes of 6.3.1, and breaks at least one of the examples in the codebase, strongly-typed-values-typescript (see ./examples/strongly-typed-values-typescript/components/CheckboxInput.tsx).

See Sandbox Link for the issue in action.

What is the expected behavior?

FieldRenderProps includes input.value whether the Field is type="checkbox" or not. This aligns with the behavior from at least 3.6.5 up to 6.3.0.

Sandbox Link

Here's a codesandbox showing the issue, switch the react-final-form version between 6.3.0 and 6.3.1 to see the issue. https://codesandbox.io/s/angry-fire-0hrw0k

What's your environment?

See above

Other information

I searched around for an existing issue or something in docs about this and came up empty. Apologies if it's addressed somewhere that I missed.

I'm not entirely convinced this wasn't an intentional change, wanted to check before I begin tracking down what commit broke this and looking for a fix. Let me know if this change was intentional and I'll change my integration rather than pursuing fixing a bug in react-final-form. Thank you!

ChipElavon commented 2 years ago

After looking into this some I see that the new behavior is closer in line with how standard <input type="checkbox /> controls work, so I updated my integration to use input.checked instead of input.value.

The issue with the strongly-typed-values examples persists, but that probably deserves its own issue as fixing that example wasn't the point of this issue.