Commit 2eac58a
committed
Move unwind after error into main work loop
I need to be able to yield to the main thread in between when an error
is thrown and when the stack is unwound. (This is the motivation behind
the refactor, but it isn't implemented in this commit.) Currently the
unwind is inlined directly into `handleError`.
Instead, I've moved the unwind logic into the main work loop. At the
very beginning of the function, we check to see if the work-in-progress
is in a "suspended" state — that is, whether it needs to be unwound. If
it is, we will enter the unwind phase instead of the begin phase.
We only need to perform this check when we first enter the work loop:
at the beginning of a Scheduler chunk, or after something throws. We
don't need to perform it after every unit of work.1 parent fbb94d3 commit 2eac58a
File tree
2 files changed
+70
-4
lines changed- packages/react-reconciler/src
2 files changed
+70
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
283 | 289 | | |
284 | 290 | | |
285 | 291 | | |
| |||
1548 | 1554 | | |
1549 | 1555 | | |
1550 | 1556 | | |
| 1557 | + | |
1551 | 1558 | | |
1552 | 1559 | | |
1553 | 1560 | | |
| |||
1632 | 1639 | | |
1633 | 1640 | | |
1634 | 1641 | | |
1635 | | - | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
1636 | 1647 | | |
1637 | 1648 | | |
1638 | 1649 | | |
| |||
1810 | 1821 | | |
1811 | 1822 | | |
1812 | 1823 | | |
1813 | | - | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
1814 | 1832 | | |
1815 | 1833 | | |
1816 | 1834 | | |
| |||
1899 | 1917 | | |
1900 | 1918 | | |
1901 | 1919 | | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
1902 | 1927 | | |
1903 | 1928 | | |
1904 | 1929 | | |
| |||
1932 | 1957 | | |
1933 | 1958 | | |
1934 | 1959 | | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
1935 | 1968 | | |
1936 | 1969 | | |
1937 | 1970 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
283 | 289 | | |
284 | 290 | | |
285 | 291 | | |
| |||
1548 | 1554 | | |
1549 | 1555 | | |
1550 | 1556 | | |
| 1557 | + | |
1551 | 1558 | | |
1552 | 1559 | | |
1553 | 1560 | | |
| |||
1632 | 1639 | | |
1633 | 1640 | | |
1634 | 1641 | | |
1635 | | - | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
1636 | 1647 | | |
1637 | 1648 | | |
1638 | 1649 | | |
| |||
1810 | 1821 | | |
1811 | 1822 | | |
1812 | 1823 | | |
1813 | | - | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
1814 | 1832 | | |
1815 | 1833 | | |
1816 | 1834 | | |
| |||
1899 | 1917 | | |
1900 | 1918 | | |
1901 | 1919 | | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
1902 | 1927 | | |
1903 | 1928 | | |
1904 | 1929 | | |
| |||
1932 | 1957 | | |
1933 | 1958 | | |
1934 | 1959 | | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
1935 | 1968 | | |
1936 | 1969 | | |
1937 | 1970 | | |
| |||
0 commit comments