Commit 40363db
committed
[Fiber] Use hydration lanes when scheduling hydration work (#31751)
When scheduling the initial root and when using
`unstable_scheduleHydration` we should use the Hydration Lanes rather
than the raw update lane. This ensures that we're always hydrating using
a Hydration Lane or the Offscreen Lane rather than other lanes getting
some random hydration in it.
This fixes an issue where updating a root while it is still hydrating
causes it to trigger client rendering when it could just hydrate and
then apply the update on top of that.
It also fixes a potential performance issue where
`unstable_scheduleHydration` gets batched with an update that then ends
up forcing an update of a boundary that requires it to rewind to do the
hydration lane anyway. Might as well just start with the hydration
without the update applied first.
I added a kill switch (`enableHydrationLaneScheduling`) just in case but
seems very safe given that using `unstable_scheduleHydration` at all is
very rare and updating the root before the shell hydrates is extremely
rare (and used to trigger a recoverable error).
DiffTrain build for [d5e8f79](d5e8f79)1 parent 95e5f95 commit 40363db
File tree
23 files changed
+496
-438
lines changed- compiled-rn
- facebook-fbsource/xplat/js
- RKJSModules/vendor/react
- react-dom/cjs
- react-test-renderer/cjs
- react/cjs
- react-native-github/Libraries/Renderer
- implementations
23 files changed
+496
-438
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
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 | | |
| |||
420 | 420 | | |
421 | 421 | | |
422 | 422 | | |
423 | | - | |
| 423 | + | |
424 | 424 | | |
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 | | |
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
| 206 | + | |
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 | | |
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
| 206 | + | |
Lines changed: 83 additions & 72 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 | | |
| |||
1310 | 1310 | | |
1311 | 1311 | | |
1312 | 1312 | | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
1313 | 1353 | | |
1314 | 1354 | | |
1315 | 1355 | | |
| |||
9526 | 9566 | | |
9527 | 9567 | | |
9528 | 9568 | | |
9529 | | - | |
9530 | | - | |
9531 | | - | |
9532 | | - | |
9533 | | - | |
9534 | | - | |
9535 | | - | |
9536 | | - | |
9537 | | - | |
9538 | | - | |
9539 | | - | |
9540 | | - | |
9541 | | - | |
9542 | | - | |
9543 | | - | |
9544 | | - | |
9545 | | - | |
9546 | | - | |
9547 | | - | |
9548 | | - | |
9549 | | - | |
9550 | | - | |
9551 | | - | |
9552 | | - | |
9553 | | - | |
9554 | | - | |
9555 | | - | |
9556 | | - | |
9557 | | - | |
9558 | | - | |
9559 | | - | |
9560 | | - | |
9561 | | - | |
9562 | | - | |
9563 | | - | |
9564 | | - | |
9565 | | - | |
9566 | | - | |
9567 | | - | |
9568 | | - | |
9569 | | - | |
9570 | | - | |
9571 | | - | |
| 9569 | + | |
| 9570 | + | |
| 9571 | + | |
| 9572 | + | |
| 9573 | + | |
| 9574 | + | |
| 9575 | + | |
| 9576 | + | |
| 9577 | + | |
| 9578 | + | |
9572 | 9579 | | |
9573 | 9580 | | |
9574 | 9581 | | |
9575 | 9582 | | |
9576 | 9583 | | |
9577 | | - | |
9578 | | - | |
9579 | | - | |
9580 | | - | |
9581 | | - | |
9582 | | - | |
9583 | | - | |
9584 | | - | |
9585 | | - | |
9586 | | - | |
9587 | | - | |
9588 | | - | |
9589 | | - | |
9590 | | - | |
9591 | | - | |
9592 | | - | |
9593 | | - | |
9594 | | - | |
9595 | | - | |
| 9584 | + | |
| 9585 | + | |
| 9586 | + | |
| 9587 | + | |
| 9588 | + | |
| 9589 | + | |
| 9590 | + | |
| 9591 | + | |
| 9592 | + | |
| 9593 | + | |
| 9594 | + | |
| 9595 | + | |
| 9596 | + | |
| 9597 | + | |
| 9598 | + | |
| 9599 | + | |
| 9600 | + | |
9596 | 9601 | | |
9597 | 9602 | | |
9598 | 9603 | | |
| |||
21917 | 21922 | | |
21918 | 21923 | | |
21919 | 21924 | | |
21920 | | - | |
21921 | | - | |
| 21925 | + | |
| 21926 | + | |
| 21927 | + | |
| 21928 | + | |
| 21929 | + | |
| 21930 | + | |
21922 | 21931 | | |
21923 | 21932 | | |
21924 | 21933 | | |
| |||
25936 | 25945 | | |
25937 | 25946 | | |
25938 | 25947 | | |
25939 | | - | |
| 25948 | + | |
25940 | 25949 | | |
25941 | 25950 | | |
25942 | 25951 | | |
25943 | | - | |
| 25952 | + | |
25944 | 25953 | | |
25945 | 25954 | | |
25946 | 25955 | | |
| |||
25977 | 25986 | | |
25978 | 25987 | | |
25979 | 25988 | | |
25980 | | - | |
| 25989 | + | |
25981 | 25990 | | |
25982 | 25991 | | |
25983 | | - | |
| 25992 | + | |
25984 | 25993 | | |
25985 | 25994 | | |
25986 | 25995 | | |
| |||
26114 | 26123 | | |
26115 | 26124 | | |
26116 | 26125 | | |
| 26126 | + | |
26117 | 26127 | | |
26118 | 26128 | | |
26119 | 26129 | | |
26120 | | - | |
26121 | | - | |
| 26130 | + | |
| 26131 | + | |
| 26132 | + | |
26122 | 26133 | | |
26123 | 26134 | | |
26124 | 26135 | | |
26125 | 26136 | | |
26126 | 26137 | | |
26127 | | - | |
| 26138 | + | |
26128 | 26139 | | |
0 commit comments