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

Different behaviors of input object provided to custom component (BC break in minor)

Open
#776 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**?

BC break, but I'm not sure if it was meant to be used that way

### What is the current behavior?

Starting from version 6.3.1, `'checked' in props.input` is `true` inside the custom component provided to ``, no matter the `type`.

Until 6.3.0, `'checked' in props.input` was `true` for `` and ``, and `false` for ``.

### What is the expected behavior?

Do not break code that rely on `'checked' in props.input` inside a custom component when upgrading a minor version, even if it should maybe use `props.input.type` instead.

It's a bit of a question, do you think it's good to use `'checked' in props.input` to check if the input is "checkable", or should I rather do something like `input.props.type === 'checkbox' || input.props.type === 'radio'` ?

### Sandbox Link

Version 6.3.0 : https://codesandbox.io/s/suspicious-surf-ib88c?file=/index.js
Version 6.3.1 (same behavior to the latest version 6.4.0) : https://codesandbox.io/s/objective-worker-2x8q0?file=/index.js

### What's your environment?

See sandbox dependencies

### Other information

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.