You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[React 19] Controlled checkboxes are reset by form submission and form.reset() #31695
After a form is submitted with an action, if one of the form's fields is a checkbox or radio input controlled by its checked prop, that element is reset as if it were uncontrolled. The same happens when the reset() method is called on the form. (Expected behavior: those fields are not reset.)
import{useState}from"react"exportdefaultfunctionPage(){const[isChecked,setIsChecked]=useState(false);return(<formaction={()=>{console.log("hello world!");}}><label>
Some checkbox
<inputtype="checkbox"checked={isChecked}onChange={(e)=>{setIsChecked(e.target.checked);}}/></label><button>Submit form</button></form>);}
Reacted by ray-marr-ho, Tomáš Hauser, Michał Filipiec, Joshua J., Billy Janitsch, Afzal Faisal, oli, John Lovén, Miguel Stevens, Fred KISSIE and 3 more
Reacted by Karl Horky
Reacted by MiroslavPetrik, Jake Taylor, Billy Janitsch, John Lovén and Karl Horky
changed the title [-][React 19] Controlled checkboxes are reset automatically after form submission[/-][+][React 19] Controlled checkboxes are reset by form submission and form.reset()[/+]on Dec 8, 2024
@eps1lon is there any chance this issue (as well as #30580) could be given the normal bug tags ("status:unconfirmed" or "type:bug"), since it's a bug in stable React?
I'm worried that this issue (as well as many others) isn't being triaged because the "React 19" issue tag was supposed to refer to the React 19 beta, even though it's mostly now being used to tag problems with stable React.
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
I've spent three days trying to understand what I was doing wrong, but turns out it was a React bug affecting very essential functionality, and it's over a year old!
Just ran into this issue. I did not expect this to be a bug with React, but here we are.
My current workaround is to create my own checkbox component that uses a button and a hidden input. The boolean is just cast a string for the value of the hidden input. This does mean your form data will pass as a string, but that happens already normally with checkboxes as they get passed as "on" typically.
@LeonBlade My workaround was to simply add a completely redundant setRememberMe(rememberMe) at the end of the useEffect that interpreted formState after the server call returned. You don't have to send the actual value to the server. Apparently then it behaves like other controlled fields.
@kirilledelman It's a simple solution. I don't think I'll be using it though because it means having to add this logic to any form that might use checkboxes. That's why I opted to modify my component instead. Hopefully this can be addressed at some point.
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
Still reproduces on React 19.3.1 (react-dom 19.3.1, Chromium 156).
A form with action={formAction} from useActionState, a controlled checkbox (checked={values.isAgreed}) and controlled radios (checked={values.delivery === "pickup"}). When the action returns validation errors, the checkbox and the radio in the DOM go back to their default state, while React state still holds isAgreed: true and delivery: "pickup". A submit button with disabled={!values.isAgreed} stays enabled next to an unchecked box. Controlled text inputs keep their values. A controlled <select> is reset the same way after a successful action (#30580).
uncontrolled fields + defaultChecked from the action state
kept
We ran into this in a React course: students hit it in a form exercise and asked why the checkbox "drops". #37668 targets this issue and is waiting for review.
Activity
[-][React 19] Controlled checkboxes are reset automatically after form submission[/-][+][React 19] Controlled checkboxes are reset by form submission and form.reset()[/+]ray-marr-ho commentedon Dec 17, 2024
I'm seeing the same issue using latest Next15 version.
Code sandbox:
https://codesandbox.io/p/devbox/cocky-shannon-forked-8qlwzy?file=%2Fapp%2Fform%2Fcomponent.tsx%3A11%2C15&workspaceId=ws_YJunuyU6avBk8pMTbNjaGv
jeremy-deutsch commentedon Feb 13, 2025
@eps1lon is there any chance this issue (as well as #30580) could be given the normal bug tags ("status:unconfirmed" or "type:bug"), since it's a bug in stable React?
I'm worried that this issue (as well as many others) isn't being triaged because the "React 19" issue tag was supposed to refer to the React 19 beta, even though it's mostly now being used to tag problems with stable React.
github-actions commentedon Jun 7, 2025
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
jrenjilian commentedon Jun 9, 2025
This is still an issue! We've needed to remember to manually reset controlled inputs when we use the form action system.
AleTopp commentedon Jun 30, 2025
bump!
ortin779 commentedon Jul 3, 2025
I am seeing the same issue : https://github.com/ortin779/react-form-actions-reset
kirilledelman commentedon Jul 18, 2025
I've spent three days trying to understand what I was doing wrong, but turns out it was a React bug affecting very essential functionality, and it's over a year old!
LeonBlade commentedon Jul 23, 2025
Just ran into this issue. I did not expect this to be a bug with React, but here we are.
My current workaround is to create my own checkbox component that uses a button and a hidden input. The boolean is just cast a string for the value of the hidden input. This does mean your form data will pass as a string, but that happens already normally with checkboxes as they get passed as "on" typically.
kirilledelman commentedon Jul 24, 2025
@LeonBlade My workaround was to simply add a completely redundant
setRememberMe(rememberMe)at the end of the useEffect that interpreted formState after the server call returned. You don't have to send the actual value to the server. Apparently then it behaves like other controlled fields.LeonBlade commentedon Jul 24, 2025
@kirilledelman It's a simple solution. I don't think I'll be using it though because it means having to add this logic to any form that might use checkboxes. That's why I opted to modify my component instead. Hopefully this can be addressed at some point.
johnloven commentedon Aug 14, 2025
Bumping this since it's still very much an issue, which is pretty insane.
16 remaining items
karlhorky commentedon Jun 10, 2026
@eps1lon I guess this one should stay open and wait for your followup, right?
fix(products): make the Status select uncontrolled to stop the post-s…
fix(forms): opt out of React's auto form-reset so controlled fields d…
fix(forms): opt out of React's auto form-reset so controlled fields d…
fix(forms): opt out of React's auto form-reset so controlled fields d…
fix(data-connections): keep auth_type select after save (form-reset o…
fix(data-connections): admin form-reset, redirect, and prefix-templat…
github-actions commentedon Sep 8, 2026
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
mizdra commentedon Sep 8, 2026
bump
fix: own the Add Exercise draft in one controlled panel state (PR #14)
Milestone 11 (#14)
fey commentedon Oct 30, 2026
Still reproduces on React 19.3.1 (react-dom 19.3.1, Chromium 156).
A form with
action={formAction}fromuseActionState, a controlled checkbox (checked={values.isAgreed}) and controlled radios (checked={values.delivery === "pickup"}). When the action returns validation errors, the checkbox and the radio in the DOM go back to their default state, while React state still holdsisAgreed: trueanddelivery: "pickup". A submit button withdisabled={!values.isAgreed}stays enabled next to an unchecked box. Controlled text inputs keep their values. A controlled<select>is reset the same way after a successful action (#30580).What we tried:
actionkeyon erroronSubmit+startTransition(() => formAction(formData))defaultCheckedfrom the action stateWe ran into this in a React course: students hit it in a form exercise and asked why the checkbox "drops". #37668 targets this issue and is waiting for review.