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

[React 19] form.requestSubmit() resets input value/defaultValue after transition #30532

Closed
andrematulionis-nomad opened this issue Jul 30, 2024 · 1 comment

Comments

@andrematulionis-nomad
Copy link

Summary

When form is submitted through form.requestSubmit() the input displays the older value instead of the current state.

Peek.2024-07-30.12-45.mp4

I tested using value and defaultValue props, and both leads to the same issue. When the form is submitted through <button type="submit"> it works fine, and form.submit() also has no problem, the issue is only using form.requestSubmit().
I suspect that this is an issue in react-dom reconciler. The state is correct in the log, but the actual <input> value is not.
In the repro there is an useOptimistic but this happens without it too.

Repro: https://stackblitz.com/edit/vitejs-vite-i9sbuj?file=src%2FApp.tsx

Version:

"react": "^19.0.0-rc-941e1b4a-20240729",
"react-dom": "^19.0.0-rc-941e1b4a-20240729"

To make sure this wasn't reported, I tried searching for transition state reset, useActionState and requestSubmit, didn't find anything related.

@eps1lon
Copy link
Collaborator

eps1lon commented Aug 1, 2024

This is intended behavior when using Form Actions to match the default HTML behavior which is also the behavior you'd get before hydration.

Closing as a duplicate of #29034

@eps1lon eps1lon closed this as not planned Won't fix, can't repro, duplicate, stale Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants