Closed andrematulionis-nomad closed 2 months ago
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 https://github.com/facebook/react/issues/29034
Summary
When form is submitted through
form.requestSubmit()
the input displays the older value instead of the current state.https://github.com/user-attachments/assets/37bcbaaf-b680-43f0-95db-a57d276753a1
I tested using
value
anddefaultValue
props, and both leads to the same issue. When the form is submitted through<button type="submit">
it works fine, andform.submit()
also has no problem, the issue is only usingform.requestSubmit()
. I suspect that this is an issue inreact-dom
reconciler. The state is correct in the log, but the actual<input>
value is not. In the repro there is anuseOptimistic
but this happens without it too.Repro: https://stackblitz.com/edit/vitejs-vite-i9sbuj?file=src%2FApp.tsx
Version: