Commit f0d354e
authored
[Fabric] Fix reparenting bug in legacy Suspense mount (#21995)
* Add reparenting invariant to React Noop
Fabric does not allow nodes to be reparented, so I added the equivalent
invariant to React Noop's so we can catch regressions.
This causes some tests to fail, which I'll fix in the next step.
* Fix: Use getOffscreenContainerProps
The type of these props is different per renderer. An oversight
from #21960. Unfortunately wasn't caught by Flow because fiber props
are `any`-typed.
* [Fabric] Fix reparenting in legacy Suspense mount
Fixes a weird case during legacy Suspense mount where the offscreen host
container of a tree that suspends during initial mount is recreated
instead of cloned, since there's no current fiber to clone from.
Fabric considers this a reparent even though the parent from the first
pass never committed.
Instead we can override the props from the first pass before the
container completes. It's a bit of a hack, but no more so than the rest
of the legacy root Suspense implementation — the hacks are designed
to make it usable by non-strict mode-compliant trees.1 parent 6f3fcbd commit f0d354e
File tree
5 files changed
+96
-38
lines changed- packages
- react-noop-renderer/src
- react-reconciler/src
5 files changed
+96
-38
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
| |||
211 | 218 | | |
212 | 219 | | |
213 | 220 | | |
| 221 | + | |
214 | 222 | | |
215 | 223 | | |
216 | 224 | | |
| |||
223 | 231 | | |
224 | 232 | | |
225 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
226 | 238 | | |
227 | 239 | | |
228 | 240 | | |
| |||
285 | 297 | | |
286 | 298 | | |
287 | 299 | | |
| 300 | + | |
288 | 301 | | |
289 | 302 | | |
290 | 303 | | |
| |||
294 | 307 | | |
295 | 308 | | |
296 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
297 | 314 | | |
298 | 315 | | |
299 | 316 | | |
| |||
313 | 330 | | |
314 | 331 | | |
315 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
316 | 338 | | |
317 | 339 | | |
318 | 340 | | |
| |||
357 | 379 | | |
358 | 380 | | |
359 | 381 | | |
| 382 | + | |
360 | 383 | | |
361 | 384 | | |
362 | 385 | | |
363 | 386 | | |
364 | 387 | | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
365 | 392 | | |
366 | 393 | | |
367 | 394 | | |
| |||
682 | 709 | | |
683 | 710 | | |
684 | 711 | | |
| 712 | + | |
685 | 713 | | |
686 | 714 | | |
687 | 715 | | |
| |||
690 | 718 | | |
691 | 719 | | |
692 | 720 | | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
693 | 725 | | |
694 | 726 | | |
695 | 727 | | |
| |||
725 | 757 | | |
726 | 758 | | |
727 | 759 | | |
| 760 | + | |
728 | 761 | | |
729 | 762 | | |
730 | 763 | | |
| |||
735 | 768 | | |
736 | 769 | | |
737 | 770 | | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
738 | 775 | | |
739 | 776 | | |
740 | 777 | | |
| |||
754 | 791 | | |
755 | 792 | | |
756 | 793 | | |
| 794 | + | |
757 | 795 | | |
758 | 796 | | |
759 | 797 | | |
760 | 798 | | |
761 | 799 | | |
762 | 800 | | |
763 | 801 | | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
764 | 806 | | |
765 | 807 | | |
766 | 808 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2212 | 2212 | | |
2213 | 2213 | | |
2214 | 2214 | | |
2215 | | - | |
2216 | | - | |
2217 | | - | |
2218 | | - | |
2219 | | - | |
2220 | | - | |
2221 | | - | |
2222 | | - | |
2223 | | - | |
2224 | | - | |
2225 | | - | |
2226 | | - | |
2227 | | - | |
2228 | | - | |
2229 | | - | |
2230 | 2215 | | |
2231 | 2216 | | |
2232 | 2217 | | |
| |||
2373 | 2358 | | |
2374 | 2359 | | |
2375 | 2360 | | |
2376 | | - | |
2377 | 2361 | | |
2378 | 2362 | | |
2379 | | - | |
2380 | | - | |
| 2363 | + | |
| 2364 | + | |
2381 | 2365 | | |
2382 | | - | |
| 2366 | + | |
2383 | 2367 | | |
2384 | 2368 | | |
2385 | 2369 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2212 | 2212 | | |
2213 | 2213 | | |
2214 | 2214 | | |
2215 | | - | |
2216 | | - | |
2217 | | - | |
2218 | | - | |
2219 | | - | |
2220 | | - | |
2221 | | - | |
2222 | | - | |
2223 | | - | |
2224 | | - | |
2225 | | - | |
2226 | | - | |
2227 | | - | |
2228 | | - | |
2229 | | - | |
2230 | 2215 | | |
2231 | 2216 | | |
2232 | 2217 | | |
| |||
2373 | 2358 | | |
2374 | 2359 | | |
2375 | 2360 | | |
2376 | | - | |
2377 | 2361 | | |
2378 | 2362 | | |
2379 | | - | |
2380 | | - | |
| 2363 | + | |
| 2364 | + | |
2381 | 2365 | | |
2382 | | - | |
| 2366 | + | |
2383 | 2367 | | |
2384 | 2368 | | |
2385 | 2369 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
313 | 317 | | |
314 | 318 | | |
315 | 319 | | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
316 | 340 | | |
317 | 341 | | |
318 | 342 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
313 | 317 | | |
314 | 318 | | |
315 | 319 | | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
316 | 340 | | |
317 | 341 | | |
318 | 342 | | |
| |||
0 commit comments