Commit fcc18f8
committed
Implement experimental_useFormStatus (#26722)
This hook reads the status of its ancestor form component, if it exists.
```js
const {pending, data, action, method} = useFormStatus();
```
It can be used to implement a loading indicator, for example. You can
think of it as a shortcut for implementing a loading state with the
useTransition hook.
For now, it's only available in the experimental channel. We'll share
docs once its closer to being stable. There are additional APIs that
will ship alongside it.
Internally it's implemented using startTransition + a context object.
That's a good way to think about its behavior, but the actual
implementation details may change in the future.
Because form elements cannot be nested, the implementation in the
reconciler does not bother to keep track of multiple nested "transition
providers". So although it's implemented using generic Fiber config
methods, it does currently make some assumptions based on React DOM's
requirements.
DiffTrain build for commit 540bab0.1 parent 2c417e2 commit fcc18f8
File tree
13 files changed
+96
-105
lines changed- compiled-rn/facebook-fbsource/xplat/js
- RKJSModules/vendor
- react-test-renderer/cjs
- react/cjs
- react-native-github/Libraries/Renderer
- implementations
13 files changed
+96
-105
lines changedLines changed: 14 additions & 17 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 | | |
| |||
2587 | 2587 | | |
2588 | 2588 | | |
2589 | 2589 | | |
2590 | | - | |
| 2590 | + | |
2591 | 2591 | | |
2592 | 2592 | | |
2593 | 2593 | | |
| |||
2641 | 2641 | | |
2642 | 2642 | | |
2643 | 2643 | | |
2644 | | - | |
2645 | | - | |
2646 | | - | |
2647 | | - | |
2648 | | - | |
2649 | | - | |
2650 | | - | |
| 2644 | + | |
| 2645 | + | |
| 2646 | + | |
| 2647 | + | |
| 2648 | + | |
| 2649 | + | |
2651 | 2650 | | |
2652 | 2651 | | |
2653 | 2652 | | |
2654 | | - | |
2655 | | - | |
2656 | | - | |
2657 | | - | |
| 2653 | + | |
| 2654 | + | |
| 2655 | + | |
| 2656 | + | |
| 2657 | + | |
2658 | 2658 | | |
2659 | | - | |
2660 | | - | |
2661 | | - | |
2662 | 2659 | | |
2663 | 2660 | | |
2664 | 2661 | | |
| |||
23895 | 23892 | | |
23896 | 23893 | | |
23897 | 23894 | | |
23898 | | - | |
| 23895 | + | |
23899 | 23896 | | |
23900 | 23897 | | |
23901 | 23898 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8601 | 8601 | | |
8602 | 8602 | | |
8603 | 8603 | | |
8604 | | - | |
| 8604 | + | |
8605 | 8605 | | |
8606 | 8606 | | |
8607 | 8607 | | |
| |||
8632 | 8632 | | |
8633 | 8633 | | |
8634 | 8634 | | |
8635 | | - | |
| 8635 | + | |
8636 | 8636 | | |
8637 | 8637 | | |
8638 | 8638 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9027 | 9027 | | |
9028 | 9028 | | |
9029 | 9029 | | |
9030 | | - | |
| 9030 | + | |
9031 | 9031 | | |
9032 | 9032 | | |
9033 | 9033 | | |
| |||
9058 | 9058 | | |
9059 | 9059 | | |
9060 | 9060 | | |
9061 | | - | |
| 9061 | + | |
9062 | 9062 | | |
9063 | 9063 | | |
9064 | 9064 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
639 | 639 | | |
640 | 640 | | |
641 | 641 | | |
642 | | - | |
| 642 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
642 | 642 | | |
643 | 643 | | |
644 | 644 | | |
645 | | - | |
| 645 | + | |
646 | 646 | | |
647 | 647 | | |
648 | 648 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
Lines changed: 17 additions & 20 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 | | |
| |||
6268 | 6268 | | |
6269 | 6269 | | |
6270 | 6270 | | |
6271 | | - | |
| 6271 | + | |
6272 | 6272 | | |
6273 | 6273 | | |
6274 | 6274 | | |
| |||
6322 | 6322 | | |
6323 | 6323 | | |
6324 | 6324 | | |
6325 | | - | |
6326 | | - | |
6327 | | - | |
6328 | | - | |
6329 | | - | |
6330 | | - | |
6331 | | - | |
| 6325 | + | |
| 6326 | + | |
| 6327 | + | |
| 6328 | + | |
| 6329 | + | |
| 6330 | + | |
6332 | 6331 | | |
6333 | 6332 | | |
6334 | 6333 | | |
6335 | | - | |
6336 | | - | |
6337 | | - | |
6338 | | - | |
| 6334 | + | |
| 6335 | + | |
| 6336 | + | |
| 6337 | + | |
| 6338 | + | |
6339 | 6339 | | |
6340 | | - | |
6341 | | - | |
6342 | | - | |
6343 | 6340 | | |
6344 | 6341 | | |
6345 | 6342 | | |
| |||
11376 | 11373 | | |
11377 | 11374 | | |
11378 | 11375 | | |
11379 | | - | |
| 11376 | + | |
11380 | 11377 | | |
11381 | 11378 | | |
11382 | | - | |
11383 | | - | |
| 11379 | + | |
| 11380 | + | |
11384 | 11381 | | |
11385 | 11382 | | |
11386 | 11383 | | |
| |||
27205 | 27202 | | |
27206 | 27203 | | |
27207 | 27204 | | |
27208 | | - | |
| 27205 | + | |
27209 | 27206 | | |
27210 | 27207 | | |
27211 | 27208 | | |
| |||
Lines changed: 10 additions & 10 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 | | |
| |||
3869 | 3869 | | |
3870 | 3870 | | |
3871 | 3871 | | |
3872 | | - | |
| 3872 | + | |
3873 | 3873 | | |
3874 | 3874 | | |
3875 | | - | |
3876 | | - | |
3877 | | - | |
| 3875 | + | |
| 3876 | + | |
| 3877 | + | |
3878 | 3878 | | |
3879 | 3879 | | |
3880 | 3880 | | |
| |||
3927 | 3927 | | |
3928 | 3928 | | |
3929 | 3929 | | |
3930 | | - | |
3931 | | - | |
| 3930 | + | |
| 3931 | + | |
3932 | 3932 | | |
3933 | | - | |
| 3933 | + | |
3934 | 3934 | | |
3935 | 3935 | | |
3936 | 3936 | | |
| |||
9472 | 9472 | | |
9473 | 9473 | | |
9474 | 9474 | | |
9475 | | - | |
| 9475 | + | |
9476 | 9476 | | |
9477 | 9477 | | |
9478 | 9478 | | |
| |||
9514 | 9514 | | |
9515 | 9515 | | |
9516 | 9516 | | |
9517 | | - | |
| 9517 | + | |
9518 | 9518 | | |
9519 | 9519 | | |
9520 | 9520 | | |
| |||
Lines changed: 10 additions & 10 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 | | |
| |||
3999 | 3999 | | |
4000 | 4000 | | |
4001 | 4001 | | |
4002 | | - | |
| 4002 | + | |
4003 | 4003 | | |
4004 | 4004 | | |
4005 | | - | |
4006 | | - | |
4007 | | - | |
| 4005 | + | |
| 4006 | + | |
| 4007 | + | |
4008 | 4008 | | |
4009 | 4009 | | |
4010 | 4010 | | |
| |||
4057 | 4057 | | |
4058 | 4058 | | |
4059 | 4059 | | |
4060 | | - | |
4061 | | - | |
| 4060 | + | |
| 4061 | + | |
4062 | 4062 | | |
4063 | | - | |
| 4063 | + | |
4064 | 4064 | | |
4065 | 4065 | | |
4066 | 4066 | | |
| |||
10181 | 10181 | | |
10182 | 10182 | | |
10183 | 10183 | | |
10184 | | - | |
| 10184 | + | |
10185 | 10185 | | |
10186 | 10186 | | |
10187 | 10187 | | |
| |||
10236 | 10236 | | |
10237 | 10237 | | |
10238 | 10238 | | |
10239 | | - | |
| 10239 | + | |
10240 | 10240 | | |
10241 | 10241 | | |
10242 | 10242 | | |
| |||
0 commit comments