fix(number-input): preserve value on Enter with useActionState (#33667) #34977
+55
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes are being made and why?
This PR fixes the issue where a type="number" input using useActionState clears its value when pressing Enter.
Previously, the input named "From:" would get cleared, even though the defaultValue contained the typed number.
The expected behavior is that the number input should behave like other inputs (e.g., "Name"), preserving its value after hitting Enter.
This change ensures that number inputs retain the typed value after form submission via Enter.
How the changes have been QAed?
Tested locally in a React 19 environment.
Typed a number in the "From:" input and pressed Enter → value remains visible as expected.
Confirmed "Name" input behavior is unchanged.
Verified that the form submission still works correctly and useActionState continues to receive updated values.