-
Notifications
You must be signed in to change notification settings - Fork 47.8k
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
Bug: select field value resets to the first option after form submission with useActionState
#32362
Comments
Thanks for the input @joshua-ots, I discovered the same bug yesterday. |
I can confirm this happens too. It's very annoying |
I come here after spending the whole morning debugging why the select element in a form behaved so differently from other inputs. Tried to replace |
I asked about that bug 2 weeks ago on StackOverflow. Hope we find a solution 😄 . |
can this be only worked upon when the label |
Why, is it solved ? |
When using a
<select>
field within a form that usesuseActionState
, the selected value resets to the first option after the form is submitted, even though the value should persist asdefaultValue
is set. This behavior occurs only with the<select>
field; other form fields (e.g., text inputs) retain their values correctly after submission.React version: 19
Steps To Reproduce
select
fieldLink to code example: https://codesandbox.io/p/sandbox/sweet-swirles-l8f2j6?file=%2Fsrc%2FApp.js&from-embed=
The current behavior
After submission, the selected value resets to the first option (value='1').
The expected behavior
The selected value should persist.
The text was updated successfully, but these errors were encountered: