mirror of
https://github.com/facebook/react.git
synced 2026-02-23 20:23:02 +00:00
Rethrow errors from form actions (#26689)
This is the next step toward full support for async form actions. Errors thrown inside form actions should cause the form to re-render and throw the error so it can be captured by an error boundary. The behavior is the same if the `<form />` had an internal useTransition hook, which is pretty much exactly how we implement it, too. The first time an action is called, the form's HostComponent is "upgraded" to become stateful, by lazily mounting a list of hooks. The rest of the implementation for function components can be shared. Because the error handling behavior added in this commit is just using useTransition under-the-hood, it also handles pending states, too. However, this pending state can't be observed until we add a new hook for that purpose. I'll add this next.
This commit is contained in:
@@ -460,5 +460,6 @@
|
||||
"472": "Type %s is not supported as an argument to a Server Function.",
|
||||
"473": "React doesn't accept base64 encoded file uploads because we don't except form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it.",
|
||||
"474": "Suspense Exception: This is not a real error, and should not leak into userspace. If you're seeing this, it's likely a bug in React.",
|
||||
"475": "Internal React Error: suspendedState null when it was expected to exists. Please report this as a React bug."
|
||||
"475": "Internal React Error: suspendedState null when it was expected to exists. Please report this as a React bug.",
|
||||
"476": "Expected the form instance to be a HostComponent. This is a bug in React."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user