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

Radio buttons stringify object values when clicked

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

Bug report

### What is the current behavior?

If a radio button's `value` property is an object, then clicking that radio button will cause the string `"[object Object]"` to be stored to the form values.

### What is the expected behavior?

The [FieldProps documentation](https://final-form.org/docs/react-final-form/types/FieldProps) states that the `value` property may be `any` type for checkboxes and radio buttons. I would expect that the object should be stored to the form without being converted to a string.

### Sandbox Link

https://codesandbox.io/s/react-final-form-radio-object-values-bug-c927j?file=/index.js

### What's your environment?

node: 14.16.1
react: 16.14.0
final-form: 4.20.2
react-final-form: 6.5.3
OS: macOS 10.14.6
Browser: Chrome 90.0.4430.212

### Other information

The initial value and value comparison works properly. The bug is only triggered when the selected radio button changes.

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.