react-dom 19.1.0-canary-d46b04a2-20250117 → 19.1.0-canary-9b62ee71-20250122

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -314,6 +314,9 @@ function createResumableState(
314
314
  moduleScriptResources: {}
315
315
  };
316
316
  }
317
+ function createPreambleState() {
318
+ return { htmlChunks: null, headChunks: null, bodyChunks: null };
319
+ }
317
320
  function createFormatContext(insertionMode, selectedValue, tagScope) {
318
321
  return {
319
322
  insertionMode: insertionMode,
@@ -332,33 +335,34 @@ function getChildFormatContext(parentContext, type, props) {
332
335
  parentContext.tagScope
333
336
  );
334
337
  case "svg":
335
- return createFormatContext(3, null, parentContext.tagScope);
338
+ return createFormatContext(4, null, parentContext.tagScope);
336
339
  case "picture":
337
340
  return createFormatContext(2, null, parentContext.tagScope | 2);
338
341
  case "math":
339
- return createFormatContext(4, null, parentContext.tagScope);
342
+ return createFormatContext(5, null, parentContext.tagScope);
340
343
  case "foreignObject":
341
344
  return createFormatContext(2, null, parentContext.tagScope);
342
345
  case "table":
343
- return createFormatContext(5, null, parentContext.tagScope);
346
+ return createFormatContext(6, null, parentContext.tagScope);
344
347
  case "thead":
345
348
  case "tbody":
346
349
  case "tfoot":
347
- return createFormatContext(6, null, parentContext.tagScope);
350
+ return createFormatContext(7, null, parentContext.tagScope);
348
351
  case "colgroup":
349
- return createFormatContext(8, null, parentContext.tagScope);
352
+ return createFormatContext(9, null, parentContext.tagScope);
350
353
  case "tr":
351
- return createFormatContext(7, null, parentContext.tagScope);
354
+ return createFormatContext(8, null, parentContext.tagScope);
355
+ case "head":
356
+ if (2 > parentContext.insertionMode)
357
+ return createFormatContext(3, null, parentContext.tagScope);
358
+ break;
359
+ case "html":
360
+ if (0 === parentContext.insertionMode)
361
+ return createFormatContext(1, null, parentContext.tagScope);
352
362
  }
353
- return 5 <= parentContext.insertionMode
363
+ return 6 <= parentContext.insertionMode || 2 > parentContext.insertionMode
354
364
  ? createFormatContext(2, null, parentContext.tagScope)
355
- : 0 === parentContext.insertionMode
356
- ? "html" === type
357
- ? createFormatContext(1, null, parentContext.tagScope)
358
- : createFormatContext(2, null, parentContext.tagScope)
359
- : 1 === parentContext.insertionMode
360
- ? createFormatContext(2, null, parentContext.tagScope)
361
- : parentContext;
365
+ : parentContext;
362
366
  }
363
367
  var styleNameCache = new Map();
364
368
  function pushStyleAttribute(target, style) {
@@ -824,6 +828,7 @@ function pushStartInstance(
824
828
  props,
825
829
  resumableState,
826
830
  renderState,
831
+ preambleState,
827
832
  hoistableState,
828
833
  formatContext,
829
834
  textEmbedded,
@@ -1303,7 +1308,7 @@ function pushStartInstance(
1303
1308
  return JSCompiler_inline_result$jscomp$2;
1304
1309
  case "title":
1305
1310
  if (
1306
- 3 === formatContext.insertionMode ||
1311
+ 4 === formatContext.insertionMode ||
1307
1312
  formatContext.tagScope & 1 ||
1308
1313
  null != props.itemProp
1309
1314
  )
@@ -1322,7 +1327,7 @@ function pushStartInstance(
1322
1327
  href = props.href,
1323
1328
  precedence = props.precedence;
1324
1329
  if (
1325
- 3 === formatContext.insertionMode ||
1330
+ 4 === formatContext.insertionMode ||
1326
1331
  formatContext.tagScope & 1 ||
1327
1332
  null != props.itemProp ||
1328
1333
  "string" !== typeof rel ||
@@ -1404,7 +1409,7 @@ function pushStartInstance(
1404
1409
  "symbol" === typeof asyncProp ||
1405
1410
  props.onLoad ||
1406
1411
  props.onError ||
1407
- 3 === formatContext.insertionMode ||
1412
+ 4 === formatContext.insertionMode ||
1408
1413
  formatContext.tagScope & 1 ||
1409
1414
  null != props.itemProp
1410
1415
  )
@@ -1445,7 +1450,7 @@ function pushStartInstance(
1445
1450
  var precedence$jscomp$0 = props.precedence,
1446
1451
  href$jscomp$0 = props.href;
1447
1452
  if (
1448
- 3 === formatContext.insertionMode ||
1453
+ 4 === formatContext.insertionMode ||
1449
1454
  formatContext.tagScope & 1 ||
1450
1455
  null != props.itemProp ||
1451
1456
  "string" !== typeof precedence$jscomp$0 ||
@@ -1548,7 +1553,7 @@ function pushStartInstance(
1548
1553
  return JSCompiler_inline_result$jscomp$6;
1549
1554
  case "meta":
1550
1555
  if (
1551
- 3 === formatContext.insertionMode ||
1556
+ 4 === formatContext.insertionMode ||
1552
1557
  formatContext.tagScope & 1 ||
1553
1558
  null != props.itemProp
1554
1559
  )
@@ -1726,10 +1731,13 @@ function pushStartInstance(
1726
1731
  case "missing-glyph":
1727
1732
  break;
1728
1733
  case "head":
1729
- if (2 > formatContext.insertionMode && null === renderState.headChunks) {
1730
- renderState.headChunks = [];
1734
+ if (2 > formatContext.insertionMode) {
1735
+ var preamble = preambleState || renderState.preamble;
1736
+ if (preamble.headChunks)
1737
+ throw Error("The `<head>` tag may only be rendered once.");
1738
+ preamble.headChunks = [];
1731
1739
  var JSCompiler_inline_result$jscomp$9 = pushStartGenericElement(
1732
- renderState.headChunks,
1740
+ preamble.headChunks,
1733
1741
  props,
1734
1742
  "head"
1735
1743
  );
@@ -1740,24 +1748,42 @@ function pushStartInstance(
1740
1748
  "head"
1741
1749
  );
1742
1750
  return JSCompiler_inline_result$jscomp$9;
1743
- case "html":
1744
- if (
1745
- 0 === formatContext.insertionMode &&
1746
- null === renderState.htmlChunks
1747
- ) {
1748
- renderState.htmlChunks = [""];
1751
+ case "body":
1752
+ if (2 > formatContext.insertionMode) {
1753
+ var preamble$jscomp$0 = preambleState || renderState.preamble;
1754
+ if (preamble$jscomp$0.bodyChunks)
1755
+ throw Error("The `<body>` tag may only be rendered once.");
1756
+ preamble$jscomp$0.bodyChunks = [];
1749
1757
  var JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
1750
- renderState.htmlChunks,
1758
+ preamble$jscomp$0.bodyChunks,
1751
1759
  props,
1752
- "html"
1760
+ "body"
1753
1761
  );
1754
1762
  } else
1755
1763
  JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
1756
1764
  target$jscomp$0,
1757
1765
  props,
1758
- "html"
1766
+ "body"
1759
1767
  );
1760
1768
  return JSCompiler_inline_result$jscomp$10;
1769
+ case "html":
1770
+ if (0 === formatContext.insertionMode) {
1771
+ var preamble$jscomp$1 = preambleState || renderState.preamble;
1772
+ if (preamble$jscomp$1.htmlChunks)
1773
+ throw Error("The `<html>` tag may only be rendered once.");
1774
+ preamble$jscomp$1.htmlChunks = [""];
1775
+ var JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
1776
+ preamble$jscomp$1.htmlChunks,
1777
+ props,
1778
+ "html"
1779
+ );
1780
+ } else
1781
+ JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
1782
+ target$jscomp$0,
1783
+ props,
1784
+ "html"
1785
+ );
1786
+ return JSCompiler_inline_result$jscomp$11;
1761
1787
  default:
1762
1788
  if (-1 !== type.indexOf("-")) {
1763
1789
  target$jscomp$0.push(startChunkForTag(type));
@@ -1818,6 +1844,15 @@ function endChunkForTag(tag) {
1818
1844
  void 0 === chunk && ((chunk = "</" + tag + ">"), endTagCache.set(tag, chunk));
1819
1845
  return chunk;
1820
1846
  }
1847
+ function hoistPreambleState(renderState, preambleState) {
1848
+ renderState = renderState.preamble;
1849
+ null === renderState.htmlChunks &&
1850
+ (renderState.htmlChunks = preambleState.htmlChunks);
1851
+ null === renderState.headChunks &&
1852
+ (renderState.headChunks = preambleState.headChunks);
1853
+ null === renderState.bodyChunks &&
1854
+ (renderState.bodyChunks = preambleState.bodyChunks);
1855
+ }
1821
1856
  function writeBootstrap(destination, renderState) {
1822
1857
  renderState = renderState.bootstrapChunks;
1823
1858
  for (var i = 0; i < renderState.length - 1; i++)
@@ -1841,6 +1876,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1841
1876
  switch (formatContext.insertionMode) {
1842
1877
  case 0:
1843
1878
  case 1:
1879
+ case 3:
1844
1880
  case 2:
1845
1881
  return (
1846
1882
  destination.push('<div hidden id="'),
@@ -1849,7 +1885,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1849
1885
  destination.push(renderState),
1850
1886
  destination.push('">')
1851
1887
  );
1852
- case 3:
1888
+ case 4:
1853
1889
  return (
1854
1890
  destination.push('<svg aria-hidden="true" style="display:none" id="'),
1855
1891
  destination.push(renderState.segmentPrefix),
@@ -1857,7 +1893,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1857
1893
  destination.push(renderState),
1858
1894
  destination.push('">')
1859
1895
  );
1860
- case 4:
1896
+ case 5:
1861
1897
  return (
1862
1898
  destination.push('<math aria-hidden="true" style="display:none" id="'),
1863
1899
  destination.push(renderState.segmentPrefix),
@@ -1865,7 +1901,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1865
1901
  destination.push(renderState),
1866
1902
  destination.push('">')
1867
1903
  );
1868
- case 5:
1904
+ case 6:
1869
1905
  return (
1870
1906
  destination.push('<table hidden id="'),
1871
1907
  destination.push(renderState.segmentPrefix),
@@ -1873,7 +1909,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1873
1909
  destination.push(renderState),
1874
1910
  destination.push('">')
1875
1911
  );
1876
- case 6:
1912
+ case 7:
1877
1913
  return (
1878
1914
  destination.push('<table hidden><tbody id="'),
1879
1915
  destination.push(renderState.segmentPrefix),
@@ -1881,7 +1917,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1881
1917
  destination.push(renderState),
1882
1918
  destination.push('">')
1883
1919
  );
1884
- case 7:
1920
+ case 8:
1885
1921
  return (
1886
1922
  destination.push('<table hidden><tr id="'),
1887
1923
  destination.push(renderState.segmentPrefix),
@@ -1889,7 +1925,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1889
1925
  destination.push(renderState),
1890
1926
  destination.push('">')
1891
1927
  );
1892
- case 8:
1928
+ case 9:
1893
1929
  return (
1894
1930
  destination.push('<table hidden><colgroup id="'),
1895
1931
  destination.push(renderState.segmentPrefix),
@@ -1905,19 +1941,20 @@ function writeEndSegment(destination, formatContext) {
1905
1941
  switch (formatContext.insertionMode) {
1906
1942
  case 0:
1907
1943
  case 1:
1944
+ case 3:
1908
1945
  case 2:
1909
1946
  return destination.push("</div>");
1910
- case 3:
1911
- return destination.push("</svg>");
1912
1947
  case 4:
1913
- return destination.push("</math>");
1948
+ return destination.push("</svg>");
1914
1949
  case 5:
1915
- return destination.push("</table>");
1950
+ return destination.push("</math>");
1916
1951
  case 6:
1917
- return destination.push("</tbody></table>");
1952
+ return destination.push("</table>");
1918
1953
  case 7:
1919
- return destination.push("</tr></table>");
1954
+ return destination.push("</tbody></table>");
1920
1955
  case 8:
1956
+ return destination.push("</tr></table>");
1957
+ case 9:
1921
1958
  return destination.push("</colgroup></table>");
1922
1959
  default:
1923
1960
  throw Error("Unknown insertion mode. This is a bug in React.");
@@ -2585,16 +2622,17 @@ function createRenderState(resumableState, generateStaticMarkup) {
2585
2622
  "\x3c/script>"
2586
2623
  );
2587
2624
  bootstrapScriptContent = idPrefix + "P:";
2588
- var JSCompiler_object_inline_segmentPrefix_1479 = idPrefix + "S:";
2625
+ var JSCompiler_object_inline_segmentPrefix_1521 = idPrefix + "S:";
2589
2626
  idPrefix += "B:";
2590
- var JSCompiler_object_inline_preconnects_1493 = new Set(),
2591
- JSCompiler_object_inline_fontPreloads_1494 = new Set(),
2592
- JSCompiler_object_inline_highImagePreloads_1495 = new Set(),
2593
- JSCompiler_object_inline_styles_1496 = new Map(),
2594
- JSCompiler_object_inline_bootstrapScripts_1497 = new Set(),
2595
- JSCompiler_object_inline_scripts_1498 = new Set(),
2596
- JSCompiler_object_inline_bulkPreloads_1499 = new Set(),
2597
- JSCompiler_object_inline_preloads_1500 = {
2627
+ var JSCompiler_object_inline_preamble_1524 = createPreambleState(),
2628
+ JSCompiler_object_inline_preconnects_1534 = new Set(),
2629
+ JSCompiler_object_inline_fontPreloads_1535 = new Set(),
2630
+ JSCompiler_object_inline_highImagePreloads_1536 = new Set(),
2631
+ JSCompiler_object_inline_styles_1537 = new Map(),
2632
+ JSCompiler_object_inline_bootstrapScripts_1538 = new Set(),
2633
+ JSCompiler_object_inline_scripts_1539 = new Set(),
2634
+ JSCompiler_object_inline_bulkPreloads_1540 = new Set(),
2635
+ JSCompiler_object_inline_preloads_1541 = {
2598
2636
  images: new Map(),
2599
2637
  stylesheets: new Map(),
2600
2638
  scripts: new Map(),
@@ -2631,7 +2669,7 @@ function createRenderState(resumableState, generateStaticMarkup) {
2631
2669
  scriptConfig.moduleScriptResources[href] = null;
2632
2670
  scriptConfig = [];
2633
2671
  pushLinkImpl(scriptConfig, props);
2634
- JSCompiler_object_inline_bootstrapScripts_1497.add(scriptConfig);
2672
+ JSCompiler_object_inline_bootstrapScripts_1538.add(scriptConfig);
2635
2673
  bootstrapChunks.push('<script src="', escapeTextForBrowser(src));
2636
2674
  "string" === typeof integrity &&
2637
2675
  bootstrapChunks.push('" integrity="', escapeTextForBrowser(integrity));
@@ -2672,7 +2710,7 @@ function createRenderState(resumableState, generateStaticMarkup) {
2672
2710
  (props.moduleScriptResources[scriptConfig] = null),
2673
2711
  (props = []),
2674
2712
  pushLinkImpl(props, integrity),
2675
- JSCompiler_object_inline_bootstrapScripts_1497.add(props),
2713
+ JSCompiler_object_inline_bootstrapScripts_1538.add(props),
2676
2714
  bootstrapChunks.push(
2677
2715
  '<script type="module" src="',
2678
2716
  escapeTextForBrowser(i)
@@ -2687,11 +2725,10 @@ function createRenderState(resumableState, generateStaticMarkup) {
2687
2725
  bootstrapChunks.push('" async="">\x3c/script>');
2688
2726
  return {
2689
2727
  placeholderPrefix: bootstrapScriptContent,
2690
- segmentPrefix: JSCompiler_object_inline_segmentPrefix_1479,
2728
+ segmentPrefix: JSCompiler_object_inline_segmentPrefix_1521,
2691
2729
  boundaryPrefix: idPrefix,
2692
2730
  startInlineScript: "<script>",
2693
- htmlChunks: null,
2694
- headChunks: null,
2731
+ preamble: JSCompiler_object_inline_preamble_1524,
2695
2732
  externalRuntimeScript: null,
2696
2733
  bootstrapChunks: bootstrapChunks,
2697
2734
  importMapChunks: [],
@@ -2707,14 +2744,14 @@ function createRenderState(resumableState, generateStaticMarkup) {
2707
2744
  charsetChunks: [],
2708
2745
  viewportChunks: [],
2709
2746
  hoistableChunks: [],
2710
- preconnects: JSCompiler_object_inline_preconnects_1493,
2711
- fontPreloads: JSCompiler_object_inline_fontPreloads_1494,
2712
- highImagePreloads: JSCompiler_object_inline_highImagePreloads_1495,
2713
- styles: JSCompiler_object_inline_styles_1496,
2714
- bootstrapScripts: JSCompiler_object_inline_bootstrapScripts_1497,
2715
- scripts: JSCompiler_object_inline_scripts_1498,
2716
- bulkPreloads: JSCompiler_object_inline_bulkPreloads_1499,
2717
- preloads: JSCompiler_object_inline_preloads_1500,
2747
+ preconnects: JSCompiler_object_inline_preconnects_1534,
2748
+ fontPreloads: JSCompiler_object_inline_fontPreloads_1535,
2749
+ highImagePreloads: JSCompiler_object_inline_highImagePreloads_1536,
2750
+ styles: JSCompiler_object_inline_styles_1537,
2751
+ bootstrapScripts: JSCompiler_object_inline_bootstrapScripts_1538,
2752
+ scripts: JSCompiler_object_inline_scripts_1539,
2753
+ bulkPreloads: JSCompiler_object_inline_bulkPreloads_1540,
2754
+ preloads: JSCompiler_object_inline_preloads_1541,
2718
2755
  stylesToHoist: !1,
2719
2756
  generateStaticMarkup: generateStaticMarkup
2720
2757
  };
@@ -3513,7 +3550,7 @@ function RequestInstance(
3513
3550
  this.status = 10;
3514
3551
  this.fatalError = null;
3515
3552
  this.pendingRootTasks = this.allPendingTasks = this.nextSegmentId = 0;
3516
- this.completedRootSegment = null;
3553
+ this.completedPreambleSegments = this.completedRootSegment = null;
3517
3554
  this.abortableTasks = abortSet;
3518
3555
  this.pingedTasks = [];
3519
3556
  this.clientRenderedBoundaries = [];
@@ -3572,6 +3609,7 @@ function createRequest(
3572
3609
  null,
3573
3610
  renderState,
3574
3611
  null,
3612
+ null,
3575
3613
  resumableState.abortableTasks,
3576
3614
  null,
3577
3615
  rootFormatContext,
@@ -3591,7 +3629,12 @@ function pingTask(request, task) {
3591
3629
  ((request.flushScheduled = null !== request.destination),
3592
3630
  performWork(request));
3593
3631
  }
3594
- function createSuspenseBoundary(request, fallbackAbortableTasks) {
3632
+ function createSuspenseBoundary(
3633
+ request,
3634
+ fallbackAbortableTasks,
3635
+ contentPreamble,
3636
+ fallbackPreamble
3637
+ ) {
3595
3638
  return {
3596
3639
  status: 0,
3597
3640
  rootSegmentID: -1,
@@ -3603,6 +3646,8 @@ function createSuspenseBoundary(request, fallbackAbortableTasks) {
3603
3646
  errorDigest: null,
3604
3647
  contentState: createHoistableState(),
3605
3648
  fallbackState: createHoistableState(),
3649
+ contentPreamble: contentPreamble,
3650
+ fallbackPreamble: fallbackPreamble,
3606
3651
  trackedContentKeyPath: null,
3607
3652
  trackedFallbackNode: null
3608
3653
  };
@@ -3614,6 +3659,7 @@ function createRenderTask(
3614
3659
  childIndex,
3615
3660
  blockedBoundary,
3616
3661
  blockedSegment,
3662
+ blockedPreamble,
3617
3663
  hoistableState,
3618
3664
  abortSet,
3619
3665
  keyPath,
@@ -3636,6 +3682,7 @@ function createRenderTask(
3636
3682
  },
3637
3683
  blockedBoundary: blockedBoundary,
3638
3684
  blockedSegment: blockedSegment,
3685
+ blockedPreamble: blockedPreamble,
3639
3686
  hoistableState: hoistableState,
3640
3687
  abortSet: abortSet,
3641
3688
  keyPath: keyPath,
@@ -3679,6 +3726,7 @@ function createReplayTask(
3679
3726
  },
3680
3727
  blockedBoundary: blockedBoundary,
3681
3728
  blockedSegment: null,
3729
+ blockedPreamble: null,
3682
3730
  hoistableState: hoistableState,
3683
3731
  abortSet: abortSet,
3684
3732
  keyPath: keyPath,
@@ -3702,11 +3750,12 @@ function createPendingSegment(
3702
3750
  ) {
3703
3751
  return {
3704
3752
  status: 0,
3753
+ parentFlushed: !1,
3705
3754
  id: -1,
3706
3755
  index: index,
3707
- parentFlushed: !1,
3708
3756
  chunks: [],
3709
3757
  children: [],
3758
+ preambleChildren: [],
3710
3759
  parentFormatContext: parentFormatContext,
3711
3760
  boundary: boundary,
3712
3761
  lastPushedText: lastPushedText,
@@ -3934,12 +3983,13 @@ function renderElement(request, task, keyPath, type, props, ref) {
3934
3983
  (task.formatContext = defaultProps),
3935
3984
  (task.keyPath = initialState);
3936
3985
  else {
3937
- initialState = pushStartInstance(
3986
+ ref = pushStartInstance(
3938
3987
  newProps.chunks,
3939
3988
  type,
3940
3989
  props,
3941
3990
  request.resumableState,
3942
3991
  request.renderState,
3992
+ task.blockedPreamble,
3943
3993
  task.hoistableState,
3944
3994
  task.formatContext,
3945
3995
  newProps.lastPushedText,
@@ -3947,12 +3997,42 @@ function renderElement(request, task, keyPath, type, props, ref) {
3947
3997
  );
3948
3998
  newProps.lastPushedText = !1;
3949
3999
  defaultProps = task.formatContext;
3950
- ref = task.keyPath;
3951
- task.formatContext = getChildFormatContext(defaultProps, type, props);
4000
+ initialState = task.keyPath;
3952
4001
  task.keyPath = keyPath;
3953
- renderNode(request, task, initialState, -1);
4002
+ 3 ===
4003
+ (task.formatContext = getChildFormatContext(defaultProps, type, props))
4004
+ .insertionMode
4005
+ ? ((keyPath = createPendingSegment(
4006
+ request,
4007
+ 0,
4008
+ null,
4009
+ task.formatContext,
4010
+ !1,
4011
+ !1
4012
+ )),
4013
+ newProps.preambleChildren.push(keyPath),
4014
+ (keyPath = createRenderTask(
4015
+ request,
4016
+ null,
4017
+ ref,
4018
+ -1,
4019
+ task.blockedBoundary,
4020
+ keyPath,
4021
+ task.blockedPreamble,
4022
+ task.hoistableState,
4023
+ request.abortableTasks,
4024
+ task.keyPath,
4025
+ task.formatContext,
4026
+ task.context,
4027
+ task.treeContext,
4028
+ task.componentStack,
4029
+ task.isFallback
4030
+ )),
4031
+ pushComponentStack(keyPath),
4032
+ request.pingedTasks.push(keyPath))
4033
+ : renderNode(request, task, ref, -1);
3954
4034
  task.formatContext = defaultProps;
3955
- task.keyPath = ref;
4035
+ task.keyPath = initialState;
3956
4036
  a: {
3957
4037
  task = newProps.chunks;
3958
4038
  request = request.resumableState;
@@ -3987,6 +4067,9 @@ function renderElement(request, task, keyPath, type, props, ref) {
3987
4067
  request.hasHtml = !0;
3988
4068
  break a;
3989
4069
  }
4070
+ break;
4071
+ case "head":
4072
+ if (1 >= defaultProps.insertionMode) break a;
3990
4073
  }
3991
4074
  task.push(endChunkForTag(type));
3992
4075
  }
@@ -4031,25 +4114,34 @@ function renderElement(request, task, keyPath, type, props, ref) {
4031
4114
  }
4032
4115
  } else {
4033
4116
  type = task.keyPath;
4034
- var parentBoundary = task.blockedBoundary,
4035
- parentHoistableState = task.hoistableState;
4036
- ref = task.blockedSegment;
4037
- propName$33 = props.fallback;
4117
+ var parentBoundary = task.blockedBoundary;
4118
+ ref = task.blockedPreamble;
4119
+ var parentHoistableState = task.hoistableState;
4120
+ propName$33 = task.blockedSegment;
4121
+ propName = props.fallback;
4038
4122
  props = props.children;
4039
4123
  var fallbackAbortSet = new Set();
4040
- propName = createSuspenseBoundary(request, fallbackAbortSet);
4124
+ var newBoundary =
4125
+ 2 > task.formatContext.insertionMode
4126
+ ? createSuspenseBoundary(
4127
+ request,
4128
+ fallbackAbortSet,
4129
+ createPreambleState(),
4130
+ createPreambleState()
4131
+ )
4132
+ : createSuspenseBoundary(request, fallbackAbortSet, null, null);
4041
4133
  null !== request.trackedPostpones &&
4042
- (propName.trackedContentKeyPath = keyPath);
4134
+ (newBoundary.trackedContentKeyPath = keyPath);
4043
4135
  var boundarySegment = createPendingSegment(
4044
4136
  request,
4045
- ref.chunks.length,
4046
- propName,
4137
+ propName$33.chunks.length,
4138
+ newBoundary,
4047
4139
  task.formatContext,
4048
4140
  !1,
4049
4141
  !1
4050
4142
  );
4051
- ref.children.push(boundarySegment);
4052
- ref.lastPushedText = !1;
4143
+ propName$33.children.push(boundarySegment);
4144
+ propName$33.lastPushedText = !1;
4053
4145
  var contentRootSegment = createPendingSegment(
4054
4146
  request,
4055
4147
  0,
@@ -4063,12 +4155,13 @@ function renderElement(request, task, keyPath, type, props, ref) {
4063
4155
  newProps = [keyPath[0], "Suspense Fallback", keyPath[2]];
4064
4156
  defaultProps = [newProps[1], newProps[2], [], null];
4065
4157
  request.trackedPostpones.workingMap.set(newProps, defaultProps);
4066
- propName.trackedFallbackNode = defaultProps;
4158
+ newBoundary.trackedFallbackNode = defaultProps;
4067
4159
  task.blockedSegment = boundarySegment;
4160
+ task.blockedPreamble = newBoundary.fallbackPreamble;
4068
4161
  task.keyPath = newProps;
4069
4162
  boundarySegment.status = 6;
4070
4163
  try {
4071
- renderNode(request, task, propName$33, -1),
4164
+ renderNode(request, task, propName, -1),
4072
4165
  pushSegmentFinale(
4073
4166
  boundarySegment.chunks,
4074
4167
  request.renderState,
@@ -4082,16 +4175,19 @@ function renderElement(request, task, keyPath, type, props, ref) {
4082
4175
  thrownValue)
4083
4176
  );
4084
4177
  } finally {
4085
- (task.blockedSegment = ref), (task.keyPath = type);
4178
+ (task.blockedSegment = propName$33),
4179
+ (task.blockedPreamble = ref),
4180
+ (task.keyPath = type);
4086
4181
  }
4087
4182
  task = createRenderTask(
4088
4183
  request,
4089
4184
  null,
4090
4185
  props,
4091
4186
  -1,
4092
- propName,
4187
+ newBoundary,
4093
4188
  contentRootSegment,
4094
- propName.contentState,
4189
+ newBoundary.contentPreamble,
4190
+ newBoundary.contentState,
4095
4191
  task.abortSet,
4096
4192
  keyPath,
4097
4193
  task.formatContext,
@@ -4103,8 +4199,9 @@ function renderElement(request, task, keyPath, type, props, ref) {
4103
4199
  pushComponentStack(task);
4104
4200
  request.pingedTasks.push(task);
4105
4201
  } else {
4106
- task.blockedBoundary = propName;
4107
- task.hoistableState = propName.contentState;
4202
+ task.blockedBoundary = newBoundary;
4203
+ task.blockedPreamble = newBoundary.contentPreamble;
4204
+ task.hoistableState = newBoundary.contentState;
4108
4205
  task.blockedSegment = contentRootSegment;
4109
4206
  task.keyPath = keyPath;
4110
4207
  contentRootSegment.status = 6;
@@ -4118,14 +4215,17 @@ function renderElement(request, task, keyPath, type, props, ref) {
4118
4215
  contentRootSegment.textEmbedded
4119
4216
  ),
4120
4217
  (contentRootSegment.status = 1),
4121
- queueCompletedSegment(propName, contentRootSegment),
4122
- 0 === propName.pendingTasks && 0 === propName.status)
4218
+ queueCompletedSegment(newBoundary, contentRootSegment),
4219
+ 0 === newBoundary.pendingTasks && 0 === newBoundary.status)
4123
4220
  ) {
4124
- propName.status = 1;
4221
+ newBoundary.status = 1;
4222
+ 0 === request.pendingRootTasks &&
4223
+ task.blockedPreamble &&
4224
+ preparePreamble(request);
4125
4225
  break a;
4126
4226
  }
4127
4227
  } catch (thrownValue$28) {
4128
- (propName.status = 4),
4228
+ (newBoundary.status = 4),
4129
4229
  12 === request.status
4130
4230
  ? ((contentRootSegment.status = 3),
4131
4231
  (newProps = request.fatalError))
@@ -4137,22 +4237,24 @@ function renderElement(request, task, keyPath, type, props, ref) {
4137
4237
  newProps,
4138
4238
  defaultProps
4139
4239
  )),
4140
- (propName.errorDigest = initialState),
4141
- untrackBoundary(request, propName);
4240
+ (newBoundary.errorDigest = initialState),
4241
+ untrackBoundary(request, newBoundary);
4142
4242
  } finally {
4143
4243
  (task.blockedBoundary = parentBoundary),
4244
+ (task.blockedPreamble = ref),
4144
4245
  (task.hoistableState = parentHoistableState),
4145
- (task.blockedSegment = ref),
4246
+ (task.blockedSegment = propName$33),
4146
4247
  (task.keyPath = type);
4147
4248
  }
4148
4249
  task = createRenderTask(
4149
4250
  request,
4150
4251
  null,
4151
- propName$33,
4252
+ propName,
4152
4253
  -1,
4153
4254
  parentBoundary,
4154
4255
  boundarySegment,
4155
- propName.fallbackState,
4256
+ newBoundary.fallbackPreamble,
4257
+ newBoundary.fallbackState,
4156
4258
  fallbackAbortSet,
4157
4259
  [keyPath[0], "Suspense Fallback", keyPath[2]],
4158
4260
  task.formatContext,
@@ -4171,9 +4273,9 @@ function renderElement(request, task, keyPath, type, props, ref) {
4171
4273
  switch (type.$$typeof) {
4172
4274
  case REACT_FORWARD_REF_TYPE:
4173
4275
  if ("ref" in props)
4174
- for (boundarySegment in ((newProps = {}), props))
4175
- "ref" !== boundarySegment &&
4176
- (newProps[boundarySegment] = props[boundarySegment]);
4276
+ for (newBoundary in ((newProps = {}), props))
4277
+ "ref" !== newBoundary &&
4278
+ (newProps[newBoundary] = props[newBoundary]);
4177
4279
  else newProps = props;
4178
4280
  type = renderWithHooks(
4179
4281
  request,
@@ -4378,17 +4480,27 @@ function retryNode(request, task) {
4378
4480
  previousReplaySet = task.replay,
4379
4481
  parentBoundary = task.blockedBoundary,
4380
4482
  parentHoistableState = task.hoistableState,
4381
- content = props.children;
4382
- props = props.fallback;
4383
- var fallbackAbortSet = new Set(),
4384
- resumedBoundary = createSuspenseBoundary(
4385
- request,
4386
- fallbackAbortSet
4387
- );
4388
- resumedBoundary.parentFlushed = !0;
4389
- resumedBoundary.rootSegmentID = type;
4390
- task.blockedBoundary = resumedBoundary;
4391
- task.hoistableState = resumedBoundary.contentState;
4483
+ content = props.children,
4484
+ fallback = props.fallback,
4485
+ fallbackAbortSet = new Set();
4486
+ props =
4487
+ 2 > task.formatContext.insertionMode
4488
+ ? createSuspenseBoundary(
4489
+ request,
4490
+ fallbackAbortSet,
4491
+ createPreambleState(),
4492
+ createPreambleState()
4493
+ )
4494
+ : createSuspenseBoundary(
4495
+ request,
4496
+ fallbackAbortSet,
4497
+ null,
4498
+ null
4499
+ );
4500
+ props.parentFlushed = !0;
4501
+ props.rootSegmentID = type;
4502
+ task.blockedBoundary = props;
4503
+ task.hoistableState = props.contentState;
4392
4504
  task.keyPath = key;
4393
4505
  task.replay = {
4394
4506
  nodes: ref,
@@ -4405,27 +4517,22 @@ function retryNode(request, task) {
4405
4517
  "Couldn't find all resumable slots by key/index during replaying. The tree doesn't match so React will fallback to client rendering."
4406
4518
  );
4407
4519
  task.replay.pendingTasks--;
4408
- if (
4409
- 0 === resumedBoundary.pendingTasks &&
4410
- 0 === resumedBoundary.status
4411
- ) {
4412
- resumedBoundary.status = 1;
4413
- request.completedBoundaries.push(resumedBoundary);
4520
+ if (0 === props.pendingTasks && 0 === props.status) {
4521
+ props.status = 1;
4522
+ request.completedBoundaries.push(props);
4414
4523
  break b;
4415
4524
  }
4416
4525
  } catch (error) {
4417
- (resumedBoundary.status = 4),
4526
+ (props.status = 4),
4418
4527
  (childNodes = getThrownInfo(task.componentStack)),
4419
4528
  (replay = logRecoverableError(
4420
4529
  request,
4421
4530
  error,
4422
4531
  childNodes
4423
4532
  )),
4424
- (resumedBoundary.errorDigest = replay),
4533
+ (props.errorDigest = replay),
4425
4534
  task.replay.pendingTasks--,
4426
- request.clientRenderedBoundaries.push(
4427
- resumedBoundary
4428
- );
4535
+ request.clientRenderedBoundaries.push(props);
4429
4536
  } finally {
4430
4537
  (task.blockedBoundary = parentBoundary),
4431
4538
  (task.hoistableState = parentHoistableState),
@@ -4440,10 +4547,10 @@ function retryNode(request, task) {
4440
4547
  slots: node$jscomp$0,
4441
4548
  pendingTasks: 0
4442
4549
  },
4443
- props,
4550
+ fallback,
4444
4551
  -1,
4445
4552
  parentBoundary,
4446
- resumedBoundary.fallbackState,
4553
+ props.fallbackState,
4447
4554
  fallbackAbortSet,
4448
4555
  [key[0], "Suspense Fallback", key[2]],
4449
4556
  task.formatContext,
@@ -4659,6 +4766,7 @@ function spawnNewSuspendedRenderTask(request, task, thenableState) {
4659
4766
  task.childIndex,
4660
4767
  task.blockedBoundary,
4661
4768
  newSegment,
4769
+ task.blockedPreamble,
4662
4770
  task.hoistableState,
4663
4771
  task.abortSet,
4664
4772
  task.keyPath,
@@ -4792,7 +4900,12 @@ function abortRemainingReplayNodes(
4792
4900
  node = node[5];
4793
4901
  var request = request$jscomp$0,
4794
4902
  errorDigest = errorDigest$jscomp$0,
4795
- resumedBoundary = createSuspenseBoundary(request, new Set());
4903
+ resumedBoundary = createSuspenseBoundary(
4904
+ request,
4905
+ new Set(),
4906
+ null,
4907
+ null
4908
+ );
4796
4909
  resumedBoundary.parentFlushed = !0;
4797
4910
  resumedBoundary.rootSegmentID = node;
4798
4911
  resumedBoundary.status = 4;
@@ -4926,6 +5039,7 @@ function safelyEmitEarlyPreloads(request, shellComplete) {
4926
5039
  }
4927
5040
  function completeShell(request) {
4928
5041
  null === request.trackedPostpones && safelyEmitEarlyPreloads(request, !0);
5042
+ null === request.trackedPostpones && preparePreamble(request);
4929
5043
  request.onShellError = noop;
4930
5044
  request = request.onShellReady;
4931
5045
  request();
@@ -4938,6 +5052,7 @@ function completeAll(request) {
4938
5052
  : null === request.completedRootSegment ||
4939
5053
  5 !== request.completedRootSegment.status
4940
5054
  );
5055
+ preparePreamble(request);
4941
5056
  request = request.onAllReady;
4942
5057
  request();
4943
5058
  }
@@ -4978,7 +5093,11 @@ function finishedTask(request, boundary, segment) {
4978
5093
  request.completedBoundaries.push(boundary),
4979
5094
  1 === boundary.status &&
4980
5095
  (boundary.fallbackAbortableTasks.forEach(abortTaskSoft, request),
4981
- boundary.fallbackAbortableTasks.clear()))
5096
+ boundary.fallbackAbortableTasks.clear(),
5097
+ 0 === request.pendingRootTasks &&
5098
+ null === request.trackedPostpones &&
5099
+ null !== boundary.contentPreamble &&
5100
+ preparePreamble(request)))
4982
5101
  : null !== segment &&
4983
5102
  segment.parentFlushed &&
4984
5103
  1 === segment.status &&
@@ -5138,9 +5257,11 @@ function performWork(request$jscomp$2) {
5138
5257
  (boundary$jscomp$0.errorDigest = request$jscomp$0),
5139
5258
  untrackBoundary(request, boundary$jscomp$0),
5140
5259
  boundary$jscomp$0.parentFlushed &&
5141
- request.clientRenderedBoundaries.push(
5142
- boundary$jscomp$0
5143
- )));
5260
+ request.clientRenderedBoundaries.push(boundary$jscomp$0),
5261
+ 0 === request.pendingRootTasks &&
5262
+ null === request.trackedPostpones &&
5263
+ null !== boundary$jscomp$0.contentPreamble &&
5264
+ preparePreamble(request)));
5144
5265
  request.allPendingTasks--;
5145
5266
  0 === request.allPendingTasks && completeAll(request);
5146
5267
  }
@@ -5163,6 +5284,85 @@ function performWork(request$jscomp$2) {
5163
5284
  }
5164
5285
  }
5165
5286
  }
5287
+ function preparePreambleFromSubtree(
5288
+ request,
5289
+ segment,
5290
+ collectedPreambleSegments
5291
+ ) {
5292
+ segment.preambleChildren.length &&
5293
+ collectedPreambleSegments.push(segment.preambleChildren);
5294
+ for (var pendingPreambles = !1, i = 0; i < segment.children.length; i++)
5295
+ pendingPreambles =
5296
+ preparePreambleFromSegment(
5297
+ request,
5298
+ segment.children[i],
5299
+ collectedPreambleSegments
5300
+ ) || pendingPreambles;
5301
+ return pendingPreambles;
5302
+ }
5303
+ function preparePreambleFromSegment(
5304
+ request,
5305
+ segment,
5306
+ collectedPreambleSegments
5307
+ ) {
5308
+ var boundary = segment.boundary;
5309
+ if (null === boundary)
5310
+ return preparePreambleFromSubtree(
5311
+ request,
5312
+ segment,
5313
+ collectedPreambleSegments
5314
+ );
5315
+ var preamble = boundary.contentPreamble,
5316
+ fallbackPreamble = boundary.fallbackPreamble;
5317
+ if (null === preamble || null === fallbackPreamble) return !1;
5318
+ switch (boundary.status) {
5319
+ case 1:
5320
+ hoistPreambleState(request.renderState, preamble);
5321
+ segment = boundary.completedSegments[0];
5322
+ if (!segment)
5323
+ throw Error(
5324
+ "A previously unvisited boundary must have exactly one root segment. This is a bug in React."
5325
+ );
5326
+ return preparePreambleFromSubtree(
5327
+ request,
5328
+ segment,
5329
+ collectedPreambleSegments
5330
+ );
5331
+ case 5:
5332
+ if (null !== request.trackedPostpones) return !0;
5333
+ case 4:
5334
+ if (1 === segment.status)
5335
+ return (
5336
+ hoistPreambleState(request.renderState, fallbackPreamble),
5337
+ preparePreambleFromSubtree(
5338
+ request,
5339
+ segment,
5340
+ collectedPreambleSegments
5341
+ )
5342
+ );
5343
+ default:
5344
+ return !0;
5345
+ }
5346
+ }
5347
+ function preparePreamble(request) {
5348
+ if (
5349
+ request.completedRootSegment &&
5350
+ null === request.completedPreambleSegments
5351
+ ) {
5352
+ var collectedPreambleSegments = [],
5353
+ hasPendingPreambles = preparePreambleFromSegment(
5354
+ request,
5355
+ request.completedRootSegment,
5356
+ collectedPreambleSegments
5357
+ ),
5358
+ preamble = request.renderState.preamble;
5359
+ if (
5360
+ !1 === hasPendingPreambles ||
5361
+ (preamble.headChunks && preamble.bodyChunks)
5362
+ )
5363
+ request.completedPreambleSegments = collectedPreambleSegments;
5364
+ }
5365
+ }
5166
5366
  function flushSubtree(request, destination, segment, hoistableState) {
5167
5367
  segment.parentFlushed = !0;
5168
5368
  switch (segment.status) {
@@ -5384,9 +5584,12 @@ function flushCompletedQueues(request, destination) {
5384
5584
  completedRootSegment = request.completedRootSegment;
5385
5585
  if (null !== completedRootSegment) {
5386
5586
  if (5 === completedRootSegment.status) return;
5587
+ var completedPreambleSegments = request.completedPreambleSegments;
5588
+ if (null === completedPreambleSegments) return;
5387
5589
  var renderState = request.renderState,
5388
- htmlChunks = renderState.htmlChunks,
5389
- headChunks = renderState.headChunks,
5590
+ preamble = renderState.preamble,
5591
+ htmlChunks = preamble.htmlChunks,
5592
+ headChunks = preamble.headChunks,
5390
5593
  i$jscomp$0;
5391
5594
  if (htmlChunks) {
5392
5595
  for (i$jscomp$0 = 0; i$jscomp$0 < htmlChunks.length; i$jscomp$0++)
@@ -5429,11 +5632,29 @@ function flushCompletedQueues(request, destination) {
5429
5632
  var hoistableChunks = renderState.hoistableChunks;
5430
5633
  for (i$jscomp$0 = 0; i$jscomp$0 < hoistableChunks.length; i$jscomp$0++)
5431
5634
  destination.push(hoistableChunks[i$jscomp$0]);
5432
- hoistableChunks.length = 0;
5433
- if (htmlChunks && null === headChunks) {
5635
+ for (
5636
+ renderState = hoistableChunks.length = 0;
5637
+ renderState < completedPreambleSegments.length;
5638
+ renderState++
5639
+ ) {
5640
+ var segments = completedPreambleSegments[renderState];
5641
+ for (preamble = 0; preamble < segments.length; preamble++)
5642
+ flushSegment(request, destination, segments[preamble], null);
5643
+ }
5644
+ var preamble$jscomp$0 = request.renderState.preamble,
5645
+ headChunks$jscomp$0 = preamble$jscomp$0.headChunks;
5646
+ if (preamble$jscomp$0.htmlChunks || headChunks$jscomp$0) {
5434
5647
  var chunk$jscomp$0 = endChunkForTag("head");
5435
5648
  destination.push(chunk$jscomp$0);
5436
5649
  }
5650
+ var bodyChunks = preamble$jscomp$0.bodyChunks;
5651
+ if (bodyChunks)
5652
+ for (
5653
+ completedPreambleSegments = 0;
5654
+ completedPreambleSegments < bodyChunks.length;
5655
+ completedPreambleSegments++
5656
+ )
5657
+ destination.push(bodyChunks[completedPreambleSegments]);
5437
5658
  flushSegment(request, destination, completedRootSegment, null);
5438
5659
  request.completedRootSegment = null;
5439
5660
  writeBootstrap(destination, request.renderState);
@@ -5699,4 +5920,4 @@ exports.renderToString = function (children, options) {
5699
5920
  'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToPipeableStream" which supports Suspense on the server'
5700
5921
  );
5701
5922
  };
5702
- exports.version = "19.1.0-canary-d46b04a2-20250117";
5923
+ exports.version = "19.1.0-canary-9b62ee71-20250122";