Commit 9cedfe5
committed
useId: Remove unnecessary try/finally blocks (#27340)
To generate IDs for useId, we modify a context variable whenever
multiple siblings are rendered, or when a component includes a useId
hook.
When this happens, we must ensure that the context is reset properly on
unwind if something errors or suspends. When I originally implemented
this, I did this by wrapping the child's rendering with a try/finally
block. But a better way to do this is by using the non-destructive
renderNode path instead of renderNodeDestructive.
DiffTrain build for [ee7f9c9](ee7f9c9)1 parent 3be7229 commit 9cedfe5
File tree
8 files changed
+198
-205
lines changed- compiled/facebook-www
8 files changed
+198
-205
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
10434 | 10434 | | |
10435 | 10435 | | |
10436 | 10436 | | |
10437 | | - | |
| 10437 | + | |
| 10438 | + | |
| 10439 | + | |
10438 | 10440 | | |
| 10441 | + | |
| 10442 | + | |
10439 | 10443 | | |
10440 | | - | |
10441 | | - | |
10442 | | - | |
10443 | | - | |
10444 | | - | |
| 10444 | + | |
10445 | 10445 | | |
10446 | 10446 | | |
10447 | 10447 | | |
| |||
10541 | 10541 | | |
10542 | 10542 | | |
10543 | 10543 | | |
10544 | | - | |
10545 | | - | |
| 10544 | + | |
| 10545 | + | |
10546 | 10546 | | |
10547 | | - | |
10548 | | - | |
10549 | | - | |
10550 | | - | |
10551 | | - | |
| 10547 | + | |
| 10548 | + | |
| 10549 | + | |
10552 | 10550 | | |
10553 | 10551 | | |
10554 | 10552 | | |
| |||
11048 | 11046 | | |
11049 | 11047 | | |
11050 | 11048 | | |
11051 | | - | |
| 11049 | + | |
11052 | 11050 | | |
11053 | 11051 | | |
11054 | 11052 | | |
11055 | | - | |
| 11053 | + | |
11056 | 11054 | | |
11057 | 11055 | | |
11058 | | - | |
11059 | | - | |
11060 | | - | |
11061 | | - | |
11062 | | - | |
11063 | | - | |
11064 | | - | |
11065 | | - | |
11066 | | - | |
11067 | | - | |
| 11056 | + | |
| 11057 | + | |
| 11058 | + | |
| 11059 | + | |
| 11060 | + | |
11068 | 11061 | | |
11069 | | - | |
11070 | | - | |
11071 | 11062 | | |
| 11063 | + | |
| 11064 | + | |
| 11065 | + | |
| 11066 | + | |
11072 | 11067 | | |
11073 | | - | |
| 11068 | + | |
| 11069 | + | |
| 11070 | + | |
| 11071 | + | |
11074 | 11072 | | |
11075 | 11073 | | |
11076 | 11074 | | |
| |||
11127 | 11125 | | |
11128 | 11126 | | |
11129 | 11127 | | |
| 11128 | + | |
11130 | 11129 | | |
11131 | 11130 | | |
11132 | 11131 | | |
| |||
11160 | 11159 | | |
11161 | 11160 | | |
11162 | 11161 | | |
11163 | | - | |
| 11162 | + | |
| 11163 | + | |
11164 | 11164 | | |
11165 | 11165 | | |
11166 | 11166 | | |
| |||
11176 | 11176 | | |
11177 | 11177 | | |
11178 | 11178 | | |
11179 | | - | |
| 11179 | + | |
| 11180 | + | |
11180 | 11181 | | |
11181 | 11182 | | |
11182 | 11183 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
10182 | 10182 | | |
10183 | 10183 | | |
10184 | 10184 | | |
10185 | | - | |
| 10185 | + | |
| 10186 | + | |
| 10187 | + | |
10186 | 10188 | | |
| 10189 | + | |
| 10190 | + | |
10187 | 10191 | | |
10188 | | - | |
10189 | | - | |
10190 | | - | |
10191 | | - | |
10192 | | - | |
| 10192 | + | |
10193 | 10193 | | |
10194 | 10194 | | |
10195 | 10195 | | |
| |||
10289 | 10289 | | |
10290 | 10290 | | |
10291 | 10291 | | |
10292 | | - | |
10293 | | - | |
| 10292 | + | |
| 10293 | + | |
10294 | 10294 | | |
10295 | | - | |
10296 | | - | |
10297 | | - | |
10298 | | - | |
10299 | | - | |
| 10295 | + | |
| 10296 | + | |
| 10297 | + | |
10300 | 10298 | | |
10301 | 10299 | | |
10302 | 10300 | | |
| |||
10796 | 10794 | | |
10797 | 10795 | | |
10798 | 10796 | | |
10799 | | - | |
| 10797 | + | |
10800 | 10798 | | |
10801 | 10799 | | |
10802 | 10800 | | |
10803 | | - | |
| 10801 | + | |
10804 | 10802 | | |
10805 | 10803 | | |
10806 | | - | |
10807 | | - | |
10808 | | - | |
10809 | | - | |
10810 | | - | |
10811 | | - | |
10812 | | - | |
10813 | | - | |
10814 | | - | |
10815 | | - | |
| 10804 | + | |
| 10805 | + | |
| 10806 | + | |
| 10807 | + | |
| 10808 | + | |
10816 | 10809 | | |
10817 | | - | |
10818 | | - | |
10819 | 10810 | | |
| 10811 | + | |
| 10812 | + | |
| 10813 | + | |
| 10814 | + | |
10820 | 10815 | | |
10821 | | - | |
| 10816 | + | |
| 10817 | + | |
| 10818 | + | |
| 10819 | + | |
10822 | 10820 | | |
10823 | 10821 | | |
10824 | 10822 | | |
| |||
10875 | 10873 | | |
10876 | 10874 | | |
10877 | 10875 | | |
| 10876 | + | |
10878 | 10877 | | |
10879 | 10878 | | |
10880 | 10879 | | |
| |||
10908 | 10907 | | |
10909 | 10908 | | |
10910 | 10909 | | |
10911 | | - | |
| 10910 | + | |
| 10911 | + | |
10912 | 10912 | | |
10913 | 10913 | | |
10914 | 10914 | | |
| |||
10924 | 10924 | | |
10925 | 10925 | | |
10926 | 10926 | | |
10927 | | - | |
| 10927 | + | |
| 10928 | + | |
10928 | 10929 | | |
10929 | 10930 | | |
10930 | 10931 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3174 | 3174 | | |
3175 | 3175 | | |
3176 | 3176 | | |
3177 | | - | |
3178 | | - | |
3179 | | - | |
3180 | | - | |
3181 | | - | |
3182 | | - | |
3183 | | - | |
3184 | | - | |
3185 | | - | |
3186 | | - | |
3187 | | - | |
3188 | | - | |
3189 | | - | |
3190 | | - | |
3191 | | - | |
3192 | | - | |
3193 | | - | |
3194 | | - | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
| 3189 | + | |
| 3190 | + | |
| 3191 | + | |
| 3192 | + | |
| 3193 | + | |
| 3194 | + | |
| 3195 | + | |
3195 | 3196 | | |
3196 | 3197 | | |
3197 | 3198 | | |
| |||
3365 | 3366 | | |
3366 | 3367 | | |
3367 | 3368 | | |
3368 | | - | |
3369 | | - | |
3370 | | - | |
3371 | | - | |
3372 | | - | |
3373 | | - | |
3374 | | - | |
3375 | | - | |
3376 | | - | |
| 3369 | + | |
| 3370 | + | |
| 3371 | + | |
| 3372 | + | |
3377 | 3373 | | |
3378 | 3374 | | |
3379 | 3375 | | |
| |||
3515 | 3511 | | |
3516 | 3512 | | |
3517 | 3513 | | |
3518 | | - | |
| 3514 | + | |
| 3515 | + | |
| 3516 | + | |
3519 | 3517 | | |
3520 | 3518 | | |
3521 | 3519 | | |
3522 | | - | |
| 3520 | + | |
3523 | 3521 | | |
3524 | | - | |
3525 | | - | |
3526 | | - | |
3527 | | - | |
| 3522 | + | |
| 3523 | + | |
| 3524 | + | |
3528 | 3525 | | |
3529 | | - | |
3530 | | - | |
3531 | | - | |
| 3526 | + | |
| 3527 | + | |
3532 | 3528 | | |
| 3529 | + | |
3533 | 3530 | | |
3534 | 3531 | | |
3535 | 3532 | | |
| |||
3538 | 3535 | | |
3539 | 3536 | | |
3540 | 3537 | | |
3541 | | - | |
| 3538 | + | |
| 3539 | + | |
3542 | 3540 | | |
3543 | 3541 | | |
3544 | 3542 | | |
| |||
3584 | 3582 | | |
3585 | 3583 | | |
3586 | 3584 | | |
| 3585 | + | |
3587 | 3586 | | |
3588 | 3587 | | |
3589 | 3588 | | |
3590 | 3589 | | |
3591 | 3590 | | |
3592 | 3591 | | |
3593 | 3592 | | |
| 3593 | + | |
3594 | 3594 | | |
3595 | 3595 | | |
3596 | 3596 | | |
| |||
4431 | 4431 | | |
4432 | 4432 | | |
4433 | 4433 | | |
4434 | | - | |
| 4434 | + | |
0 commit comments