Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Checkbox do not update if all values exist at the start #5262

Closed
SimeonC opened this issue May 20, 2021 · 1 comment
Closed

Multiple Checkbox do not update if all values exist at the start #5262

SimeonC opened this issue May 20, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@SimeonC
Copy link

SimeonC commented May 20, 2021

Describe the bug
When using the non array version of multiple checkboxes, (<input type="checkbox" {...register('sharedName')} />), if values are set using defaultValues then they cannot be reliably unset. This only seems to occur in the v7.6 version.

To Reproduce
Use this sandbox for the following scenarios; https://codesandbox.io/s/youthful-haze-rx39o

All selected as default scenario:

  1. Using meal1, try to deselect any of the checkboxes
  2. The watcher doesn't remove the values from the array
  3. Submitting the form doesn't remove values from the array

Some selected as default scenario:

  1. Using meal2, try to toggle the checkboxes
  2. In the watcher, lunch and supper are always present ignoring any other values
  3. Breakfast and dinner can be toggled correctly.
  4. Submitting the form gives the same results as the watcher

No values selected as default:
meal3 ([]) and meal4 (undefined) work correctly and are there for counter examples.

Codesandbox link (Required)
https://codesandbox.io/s/youthful-haze-rx39o

Expected behavior
All default value combinations should work consistently allowing default selected checkboxes to be deselected.

Desktop (please complete the following information):
(I think this is unrelated to at least browser)

  • OS: OSX
  • Browser safari, chrome
  • Version 7.6
@SimeonC
Copy link
Author

SimeonC commented May 20, 2021

This only occurs in version 7.6, version <= 7.5 works fine.

@bluebill1049 bluebill1049 added status: under investigation aware of this issue and pending for investigation bug Something isn't working labels May 20, 2021
@bluebill1049 bluebill1049 removed the status: under investigation aware of this issue and pending for investigation label May 20, 2021
bluebill1049 added a commit that referenced this issue May 20, 2021
bluebill1049 added a commit that referenced this issue May 20, 2021
bluebill1049 added a commit that referenced this issue May 20, 2021
* unit test for #5262

* close #5234 with unit test and return isValid
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants