Skip to content

[Checkbox] Reset checkbox checked state when form is reset #1733

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

Merged
merged 6 commits into from
Jan 30, 2023

Conversation

raulburigo
Copy link
Contributor

Implements #983

Copy link
Contributor

@benoitgrelard benoitgrelard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution @raulburigo!

Copy link
Contributor

@benoitgrelard benoitgrelard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great @raulburigo, only a few small tweaks and we can get this merged!

Copy link
Contributor

@benoitgrelard benoitgrelard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Congrats on landing your first PR!

@benoitgrelard benoitgrelard merged commit 7491b1e into radix-ui:main Jan 30, 2023
@raulburigo raulburigo deleted the checkbox_reset_with_form branch February 4, 2023 12:26
@matthova
Copy link

@raulburigo with React v19, submitting a form with a defaultValue and then on reset setting to the initial value causes some weird race-condition behavior

See the related discussion here: facebook/react#29034

I'm proposing a potential backwards-compatible next-move: Introduce an opt-in new prop, like dontResetStateOnSubmit to not reset the checkbox to its initial value on form reset

wdyt?

@matthova
Copy link

@benoitgrelard 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants