Skip to content

Add autoReset prop to opt out of automatic form reset on actions #36334

Open
hassanzadeh-mj wants to merge 1 commit intofacebook:mainfrom
hassanzadeh-mj:fix/allow-opt-out-form-auto-reset-29034
Open

Add autoReset prop to opt out of automatic form reset on actions #36334
hassanzadeh-mj wants to merge 1 commit intofacebook:mainfrom
hassanzadeh-mj:fix/allow-opt-out-form-auto-reset-29034

Conversation

@hassanzadeh-mj
Copy link
Copy Markdown

Closes #29034

React 19 automatically calls form.reset() after every form action completes. This is intentional behavior, but there are legitimate cases where developers need to opt out:

  • Multi-step forms where fields shouldn't be cleared between steps
  • When a server action fails and the user's input should be preserved
  • Forms with manually managed controlled state

This PR adds an autoReset prop to <form> elements. It defaults to true (preserving current behavior), and can be set to false to disable the automatic reset.

Usage

// Default behavior — form resets after action (unchanged)
<form action={myAction}>...</form>

// Opt out of automatic reset
<form action={myAction} autoReset={false}>...</form>

…ebook#29034)

React 19 automatically calls form.reset() after every form action. This
adds an `autoReset` prop (default: true) to let users opt out by passing
`autoReset={false}` on the form element.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@meta-cla meta-cla Bot added the CLA Signed label Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[React 19] allow opting out of automatic form reset when Form Actions are used

1 participant