Commit fe026dd
committed
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.
DiffTrain build for commit 9598c41.1 parent bf759bd commit fe026dd
File tree
14 files changed
+321
-291
lines changed- compiled-rn
- facebook-fbsource/xplat/js
- RKJSModules/vendor/react
- react-test-renderer/cjs
- react/cjs
- react-native-github/Libraries/Renderer
- implementations
14 files changed
+321
-291
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
Lines changed: 21 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
8612 | 8612 | | |
8613 | 8613 | | |
8614 | 8614 | | |
| 8615 | + | |
| 8616 | + | |
| 8617 | + | |
| 8618 | + | |
| 8619 | + | |
| 8620 | + | |
| 8621 | + | |
8615 | 8622 | | |
8616 | 8623 | | |
8617 | | - | |
| 8624 | + | |
8618 | 8625 | | |
8619 | 8626 | | |
8620 | 8627 | | |
| |||
8773 | 8780 | | |
8774 | 8781 | | |
8775 | 8782 | | |
8776 | | - | |
8777 | | - | |
8778 | | - | |
8779 | | - | |
8780 | | - | |
8781 | | - | |
| 8783 | + | |
8782 | 8784 | | |
| 8785 | + | |
8783 | 8786 | | |
8784 | 8787 | | |
8785 | 8788 | | |
8786 | 8789 | | |
8787 | | - | |
8788 | | - | |
8789 | | - | |
8790 | | - | |
8791 | | - | |
8792 | | - | |
8793 | | - | |
| 8790 | + | |
| 8791 | + | |
| 8792 | + | |
| 8793 | + | |
| 8794 | + | |
| 8795 | + | |
| 8796 | + | |
8794 | 8797 | | |
8795 | | - | |
8796 | | - | |
8797 | | - | |
| 8798 | + | |
| 8799 | + | |
8798 | 8800 | | |
8799 | 8801 | | |
8800 | 8802 | | |
| |||
23568 | 23570 | | |
23569 | 23571 | | |
23570 | 23572 | | |
23571 | | - | |
| 23573 | + | |
23572 | 23574 | | |
23573 | 23575 | | |
23574 | 23576 | | |
| |||
Lines changed: 41 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
2776 | 2776 | | |
2777 | 2777 | | |
2778 | 2778 | | |
2779 | | - | |
2780 | | - | |
2781 | | - | |
2782 | | - | |
2783 | | - | |
2784 | | - | |
2785 | | - | |
2786 | | - | |
2787 | | - | |
2788 | | - | |
2789 | | - | |
2790 | | - | |
2791 | | - | |
2792 | | - | |
2793 | | - | |
2794 | | - | |
2795 | | - | |
2796 | | - | |
2797 | | - | |
2798 | | - | |
2799 | | - | |
2800 | | - | |
2801 | | - | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
2802 | 2805 | | |
2803 | 2806 | | |
2804 | 2807 | | |
| |||
2856 | 2859 | | |
2857 | 2860 | | |
2858 | 2861 | | |
2859 | | - | |
2860 | | - | |
2861 | | - | |
2862 | | - | |
2863 | | - | |
2864 | | - | |
2865 | | - | |
2866 | | - | |
2867 | | - | |
2868 | | - | |
2869 | | - | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
2870 | 2874 | | |
2871 | 2875 | | |
2872 | 2876 | | |
| |||
9332 | 9336 | | |
9333 | 9337 | | |
9334 | 9338 | | |
9335 | | - | |
| 9339 | + | |
9336 | 9340 | | |
9337 | 9341 | | |
9338 | 9342 | | |
| |||
9363 | 9367 | | |
9364 | 9368 | | |
9365 | 9369 | | |
9366 | | - | |
| 9370 | + | |
9367 | 9371 | | |
9368 | 9372 | | |
9369 | 9373 | | |
| |||
Lines changed: 41 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
2864 | 2864 | | |
2865 | 2865 | | |
2866 | 2866 | | |
2867 | | - | |
2868 | | - | |
2869 | | - | |
2870 | | - | |
2871 | | - | |
2872 | | - | |
2873 | | - | |
2874 | | - | |
2875 | | - | |
2876 | | - | |
2877 | | - | |
2878 | | - | |
2879 | | - | |
2880 | | - | |
2881 | | - | |
2882 | | - | |
2883 | | - | |
2884 | | - | |
2885 | | - | |
2886 | | - | |
2887 | | - | |
2888 | | - | |
2889 | | - | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
2890 | 2893 | | |
2891 | 2894 | | |
2892 | 2895 | | |
| |||
2944 | 2947 | | |
2945 | 2948 | | |
2946 | 2949 | | |
2947 | | - | |
2948 | | - | |
2949 | | - | |
2950 | | - | |
2951 | | - | |
2952 | | - | |
2953 | | - | |
2954 | | - | |
2955 | | - | |
2956 | | - | |
2957 | | - | |
| 2950 | + | |
| 2951 | + | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
| 2956 | + | |
| 2957 | + | |
| 2958 | + | |
| 2959 | + | |
| 2960 | + | |
| 2961 | + | |
2958 | 2962 | | |
2959 | 2963 | | |
2960 | 2964 | | |
| |||
9954 | 9958 | | |
9955 | 9959 | | |
9956 | 9960 | | |
9957 | | - | |
| 9961 | + | |
9958 | 9962 | | |
9959 | 9963 | | |
9960 | 9964 | | |
| |||
9998 | 10002 | | |
9999 | 10003 | | |
10000 | 10004 | | |
10001 | | - | |
| 10005 | + | |
10002 | 10006 | | |
10003 | 10007 | | |
10004 | 10008 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
604 | 604 | | |
605 | 605 | | |
606 | 606 | | |
607 | | - | |
| 607 | + | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
611 | | - | |
| 611 | + | |
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
0 commit comments