Comments (7)
The automatic form reset in React 19 actually caught me off guard, where in my case, I was trying to validate the form inputs on the server, then return & display the input errors on the client, but React will reset all my uncontrolled inputs.
For context, I wrote a library just for doing server-side validation https://github.com/chungweileong94/server-act?tab=readme-ov-file#useformstate-support.
I know that you can pass the original input (FormData
#28754) back to the client, but it's not easy to reset the form based on the previously submitted FormData, especially when the form is somewhat complex, I'm talking about things like dynamic items inputs, etc.
It's easy to reset a form, but hard to restore a form.
from react.
I think you should return current values from action in such case and update the default value 😃
from react.
@adobe export issue to Jira project PWA
from react.
I think you should return current values from action in such case and update the default value. and return required!
from react.
This is very necessary in the step-by-step form, such as verifying the email in the auth form first
from react.
Be careful to handle if the action throws an error, your "returning the new default" at the end of the function will be ineffective.
from react.
Now that I have played with React 19 form reset for a while, I think this behavior kind of forces us to write a more progressive enhancement code. This means that if you manually return the form data from the server and restore the form values, the user input will persist even without JavaScript enabled. Mixed feelings, pros and cons.
from react.
Related Issues (20)
- [DevTools Bug] Cannot add node "1" because a node with that id is already in the Store. HOT 1
- Bug: Exported ReactDom.version differs from installed one
- Bug: TypeError in Rollup build: parseRequestedNames doesn't handle array input correctly
- Bug: Inaccurate Bundle Type Filtering in Rollup Build
- Compiler String Concat Constant Propagation HOT 1
- Compiler Logical Negation Constant Propagation
- [React 19]
- Bug: StrictMode: useEffect cleaned the second state instead of the first state during the first rendering HOT 1
- Bug: Error "Unsupported URL scheme" with React Developer Tools HOT 1
- [Compiler Bug]: Health check --src option only works with one file (so a glob needs to be quoted) HOT 2
- [Compiler Bug]: react native reanimated shared value mutation HOT 5
- [Compiler Bug]: eslint-plugin-react-compiler should not warn again react-native-reanimated sharedValue mutation HOT 1
- Bug: useState does not update the state. Updates only on second click HOT 4
- [React 19]
- [DevTools Bug]: devtools does not works on null origin(sandbox)
- [Compiler Bug]: Stripping curly braces breaks character escapes (breaks JSX spec 1.5.1) HOT 2
- [compiler] Add more arithmetic binary expressions to constant propagation
- [DevTools Bug]: Unable to edit props
- [React 19] custom element property vs. event handler for props beginning with "on" HOT 1
- Developer Tools extension for Chrome has "invalid manifest" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react.