dillon1000/react
Commit
Browse files useActionState: On error, cancel remaining actions (#29695)
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.
Changed paths2 files
First-parent comparisonpackages/react-dom/src/__tests__/ReactDOMForm-test.js ModifiedM packages/react-reconciler/src/ReactFiberHooks.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…