mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
27402d4be2b022bc09b980b93f03f332b34baec6
Based on
- #29694
---
If an action in the useActionState queue errors, we shouldn't run any
subsequent actions. The contract of useActionState is that the actions
run in sequence, and that one action can assume that all previous
actions have completed successfully.
For example, in a shopping cart UI, you might dispatch an "Add to cart"
action followed by a "Checkout" action. If the "Add to cart" action
errors, the "Checkout" action should not run.
An implication of this change is that once useActionState falls into an
error state, the only way to recover is to reset the component tree,
i.e. by unmounting and remounting. The way to customize the error
handling behavior is to wrap the action body in a try/catch.
DiffTrain build for [9598c41a20](https://github.com/facebook/react/commit/9598c41a20162c8a9d57ccf6a356aa183b00b61a)
Please do not delete this branch
Description
Languages
JavaScript
67.1%
TypeScript
29.4%
HTML
1.5%
CSS
1.1%
C++
0.6%
Other
0.2%