MCPcopy
hub / github.com/facebook/react / unblockSuspenseListRow

Function unblockSuspenseListRow

packages/react-server/src/ReactFizzServer.js:1802–1840  ·  view source on GitHub ↗
(
  request: Request,
  unblockedRow: null | SuspenseListRow,
  inheritedHoistables: null | HoistableState,
)

Source from the content-addressed store, hash-verified

1800}
1801
1802function unblockSuspenseListRow(
1803 request: Request,
1804 unblockedRow: null | SuspenseListRow,
1805 inheritedHoistables: null | HoistableState,
1806): void {
1807 // We do this in a loop to avoid stack overflow for very long lists that get unblocked.
1808 while (unblockedRow !== null) {
1809 if (inheritedHoistables !== null) {
1810 // Hoist any hoistables from the previous row into the next row so that it can be
1811 // later transferred to all the rows.
1812 hoistHoistables(unblockedRow.hoistables, inheritedHoistables);
1813 // Mark the row itself for any newly discovered Suspense boundaries to inherit.
1814 // This is different from hoistables because that also includes hoistables from
1815 // all the boundaries below this row and not just previous rows.
1816 unblockedRow.inheritedHoistables = inheritedHoistables;
1817 }
1818 // Unblocking the boundaries will decrement the count of this row but we keep it above
1819 // zero so they never finish this row recursively.
1820 const unblockedBoundaries = unblockedRow.boundaries;
1821 if (unblockedBoundaries !== null) {
1822 unblockedRow.boundaries = null;
1823 for (let i = 0; i < unblockedBoundaries.length; i++) {
1824 const unblockedBoundary = unblockedBoundaries[i];
1825 if (inheritedHoistables !== null) {
1826 hoistHoistables(unblockedBoundary.contentState, inheritedHoistables);
1827 }
1828 finishedTask(request, unblockedBoundary, null, null);
1829 }
1830 }
1831 // Instead we decrement at the end to keep it all in this loop.
1832 unblockedRow.pendingTasks--;
1833 if (unblockedRow.pendingTasks > 0) {
1834 // Still blocked.
1835 break;
1836 }
1837 inheritedHoistables = unblockedRow.hoistables;
1838 unblockedRow = unblockedRow.next;
1839 }
1840}
1841
1842function trackPostponedSuspenseListRow(
1843 request: Request,

Callers 3

finishSuspenseListRowFunction · 0.85
tryToResolveTogetherRowFunction · 0.85
flushPartialBoundaryFunction · 0.85

Calls 2

hoistHoistablesFunction · 0.90
finishedTaskFunction · 0.85

Tested by

no test coverage detected