Commit b7cf5ba
committed
Fix: Stylesheet in error UI suspends indefinitely
This fixes the regression test added in the previous commit. The "Suspensey
commit" implementation relies on the `shouldRemainOnPreviousScreen` function to
determine whether to 1) suspend the commit 2) activate a parent fallback and
schedule a retry. The issue was that we were sometimes attempting option 2 even
when there was no parent fallback.
Part of the reason this bug landed is due to how `throwException` is structured.
In the case of Suspensey commits, we pass a special "noop" thenable to
`throwException` as a way to trigger the Suspense path. This special thenable
must never have a listener attached to it. This is not a great way to structure
the logic, it's just a consequence of how the code evolved over time. We should
refactor it into multiple functions so we can trigger a fallback directly
without having to check the type. In the meantime, I added an internal warning
to help detect similar mistakes in the future.1 parent e76a5ac commit b7cf5ba
File tree
4 files changed
+51
-40
lines changed- packages
- react-dom/src/__tests__
- react-reconciler/src
4 files changed
+51
-40
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3385 | 3385 | | |
3386 | 3386 | | |
3387 | 3387 | | |
3388 | | - | |
3389 | 3388 | | |
3390 | 3389 | | |
3391 | 3390 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
46 | 55 | | |
47 | 56 | | |
48 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
441 | 448 | | |
442 | | - | |
| 449 | + | |
443 | 450 | | |
444 | 451 | | |
445 | 452 | | |
| |||
466 | 473 | | |
467 | 474 | | |
468 | 475 | | |
| 476 | + | |
| 477 | + | |
469 | 478 | | |
470 | | - | |
| 479 | + | |
471 | 480 | | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | 481 | | |
480 | 482 | | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1687 | 1687 | | |
1688 | 1688 | | |
1689 | 1689 | | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
1690 | 1700 | | |
1691 | 1701 | | |
1692 | 1702 | | |
| |||
1705 | 1715 | | |
1706 | 1716 | | |
1707 | 1717 | | |
1708 | | - | |
1709 | | - | |
1710 | | - | |
1711 | | - | |
1712 | | - | |
1713 | | - | |
1714 | | - | |
1715 | | - | |
1716 | | - | |
1717 | | - | |
1718 | | - | |
1719 | | - | |
1720 | | - | |
1721 | | - | |
1722 | | - | |
1723 | | - | |
1724 | | - | |
1725 | | - | |
1726 | | - | |
1727 | | - | |
1728 | | - | |
1729 | | - | |
1730 | | - | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
1731 | 1734 | | |
1732 | 1735 | | |
1733 | 1736 | | |
| |||
0 commit comments