Commit 8bc81ca
authored
Create a root task for every Flight response (#29673)
This lets any element created from the server, to bottom out with a
client "owner" which is the creator of the Flight request. This could be
a Server Action being invoked or a router.
This is similar to how a client element bottoms out in the creator of
the root element without an owner. E.g. where the root app element was
created.
Without this, we inherit the task of whatever is currently executing
when we're parsing which can be misleading.
Before:
<img width="507" alt="Screenshot 2024-05-30 at 12 06 57 PM"
src="https://github.com/facebook/react/assets/63648/e234db7e-67f7-404c-958a-5c5500ffdf1f">
After:
<img width="555" alt="Screenshot 2024-05-30 at 4 59 04 PM"
src="https://github.com/facebook/react/assets/63648/8ba6acb4-2ffd-49d4-bd44-08228ad4200e">
The before/after doesn't show much of a difference here but that's just
because our Flight parsing loop is an async, which maybe it shouldn't be
because it can be unnecessarily deep, and it creates a hidden line for
every loop. That's what the `Promise.then` is. If the element is lazily
initialized it's worse because we can end up in an unrelated render task
as the owner - although that's its own problem.1 parent 6d3110b commit 8bc81ca
1 file changed
+34
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
| 257 | + | |
257 | 258 | | |
258 | 259 | | |
259 | 260 | | |
| |||
614 | 615 | | |
615 | 616 | | |
616 | 617 | | |
| 618 | + | |
617 | 619 | | |
618 | 620 | | |
619 | 621 | | |
| |||
697 | 699 | | |
698 | 700 | | |
699 | 701 | | |
700 | | - | |
| 702 | + | |
| 703 | + | |
701 | 704 | | |
702 | | - | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
703 | 711 | | |
704 | 712 | | |
705 | 713 | | |
| |||
1106 | 1114 | | |
1107 | 1115 | | |
1108 | 1116 | | |
| 1117 | + | |
1109 | 1118 | | |
1110 | 1119 | | |
1111 | 1120 | | |
| |||
1149 | 1158 | | |
1150 | 1159 | | |
1151 | 1160 | | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
1152 | 1169 | | |
1153 | 1170 | | |
1154 | 1171 | | |
| |||
1730 | 1747 | | |
1731 | 1748 | | |
1732 | 1749 | | |
| 1750 | + | |
1733 | 1751 | | |
1734 | 1752 | | |
1735 | 1753 | | |
| |||
1745 | 1763 | | |
1746 | 1764 | | |
1747 | 1765 | | |
1748 | | - | |
| 1766 | + | |
1749 | 1767 | | |
1750 | 1768 | | |
1751 | 1769 | | |
| |||
1755 | 1773 | | |
1756 | 1774 | | |
1757 | 1775 | | |
1758 | | - | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
1759 | 1782 | | |
1760 | 1783 | | |
1761 | 1784 | | |
| |||
1776 | 1799 | | |
1777 | 1800 | | |
1778 | 1801 | | |
1779 | | - | |
| 1802 | + | |
1780 | 1803 | | |
1781 | 1804 | | |
1782 | 1805 | | |
| |||
1813 | 1836 | | |
1814 | 1837 | | |
1815 | 1838 | | |
1816 | | - | |
| 1839 | + | |
1817 | 1840 | | |
1818 | 1841 | | |
1819 | 1842 | | |
1820 | 1843 | | |
1821 | 1844 | | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
1822 | 1850 | | |
1823 | 1851 | | |
1824 | 1852 | | |
| |||
0 commit comments