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.
A
Andrew Clark committed
9598c41a20162c8a9d57ccf6a356aa183b00b61a
Parent: 67b05be
Committed by GitHub <noreply@github.com>
on 6/3/2024, 3:25:43 PM