react-dom 19.1.0-canary-d46b04a2-20250117 → 19.1.0-canary-18eaf51b-20250118

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.
@@ -329,6 +329,9 @@ function createResumableState(
329
329
  moduleScriptResources: {}
330
330
  };
331
331
  }
332
+ function createPreambleState() {
333
+ return { htmlChunks: null, headChunks: null, bodyChunks: null };
334
+ }
332
335
  function createFormatContext(insertionMode, selectedValue, tagScope) {
333
336
  return {
334
337
  insertionMode: insertionMode,
@@ -347,33 +350,34 @@ function getChildFormatContext(parentContext, type, props) {
347
350
  parentContext.tagScope
348
351
  );
349
352
  case "svg":
350
- return createFormatContext(3, null, parentContext.tagScope);
353
+ return createFormatContext(4, null, parentContext.tagScope);
351
354
  case "picture":
352
355
  return createFormatContext(2, null, parentContext.tagScope | 2);
353
356
  case "math":
354
- return createFormatContext(4, null, parentContext.tagScope);
357
+ return createFormatContext(5, null, parentContext.tagScope);
355
358
  case "foreignObject":
356
359
  return createFormatContext(2, null, parentContext.tagScope);
357
360
  case "table":
358
- return createFormatContext(5, null, parentContext.tagScope);
361
+ return createFormatContext(6, null, parentContext.tagScope);
359
362
  case "thead":
360
363
  case "tbody":
361
364
  case "tfoot":
362
- return createFormatContext(6, null, parentContext.tagScope);
365
+ return createFormatContext(7, null, parentContext.tagScope);
363
366
  case "colgroup":
364
- return createFormatContext(8, null, parentContext.tagScope);
367
+ return createFormatContext(9, null, parentContext.tagScope);
365
368
  case "tr":
366
- return createFormatContext(7, null, parentContext.tagScope);
369
+ return createFormatContext(8, null, parentContext.tagScope);
370
+ case "head":
371
+ if (2 > parentContext.insertionMode)
372
+ return createFormatContext(3, null, parentContext.tagScope);
373
+ break;
374
+ case "html":
375
+ if (0 === parentContext.insertionMode)
376
+ return createFormatContext(1, null, parentContext.tagScope);
367
377
  }
368
- return 5 <= parentContext.insertionMode
378
+ return 6 <= parentContext.insertionMode || 2 > parentContext.insertionMode
369
379
  ? createFormatContext(2, null, parentContext.tagScope)
370
- : 0 === parentContext.insertionMode
371
- ? "html" === type
372
- ? createFormatContext(1, null, parentContext.tagScope)
373
- : createFormatContext(2, null, parentContext.tagScope)
374
- : 1 === parentContext.insertionMode
375
- ? createFormatContext(2, null, parentContext.tagScope)
376
- : parentContext;
380
+ : parentContext;
377
381
  }
378
382
  var styleNameCache = new Map();
379
383
  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,
@@ -1294,7 +1299,7 @@ function pushStartInstance(
1294
1299
  return JSCompiler_inline_result$jscomp$2;
1295
1300
  case "title":
1296
1301
  if (
1297
- 3 === formatContext.insertionMode ||
1302
+ 4 === formatContext.insertionMode ||
1298
1303
  formatContext.tagScope & 1 ||
1299
1304
  null != props.itemProp
1300
1305
  )
@@ -1313,7 +1318,7 @@ function pushStartInstance(
1313
1318
  href = props.href,
1314
1319
  precedence = props.precedence;
1315
1320
  if (
1316
- 3 === formatContext.insertionMode ||
1321
+ 4 === formatContext.insertionMode ||
1317
1322
  formatContext.tagScope & 1 ||
1318
1323
  null != props.itemProp ||
1319
1324
  "string" !== typeof rel ||
@@ -1395,7 +1400,7 @@ function pushStartInstance(
1395
1400
  "symbol" === typeof asyncProp ||
1396
1401
  props.onLoad ||
1397
1402
  props.onError ||
1398
- 3 === formatContext.insertionMode ||
1403
+ 4 === formatContext.insertionMode ||
1399
1404
  formatContext.tagScope & 1 ||
1400
1405
  null != props.itemProp
1401
1406
  )
@@ -1436,7 +1441,7 @@ function pushStartInstance(
1436
1441
  var precedence$jscomp$0 = props.precedence,
1437
1442
  href$jscomp$0 = props.href;
1438
1443
  if (
1439
- 3 === formatContext.insertionMode ||
1444
+ 4 === formatContext.insertionMode ||
1440
1445
  formatContext.tagScope & 1 ||
1441
1446
  null != props.itemProp ||
1442
1447
  "string" !== typeof precedence$jscomp$0 ||
@@ -1539,7 +1544,7 @@ function pushStartInstance(
1539
1544
  return JSCompiler_inline_result$jscomp$6;
1540
1545
  case "meta":
1541
1546
  if (
1542
- 3 === formatContext.insertionMode ||
1547
+ 4 === formatContext.insertionMode ||
1543
1548
  formatContext.tagScope & 1 ||
1544
1549
  null != props.itemProp
1545
1550
  )
@@ -1712,10 +1717,13 @@ function pushStartInstance(
1712
1717
  case "missing-glyph":
1713
1718
  break;
1714
1719
  case "head":
1715
- if (2 > formatContext.insertionMode && null === renderState.headChunks) {
1716
- renderState.headChunks = [];
1720
+ if (2 > formatContext.insertionMode) {
1721
+ var preamble = preambleState || renderState.preamble;
1722
+ if (preamble.headChunks)
1723
+ throw Error(formatProdErrorMessage(545, "`<head>`"));
1724
+ preamble.headChunks = [];
1717
1725
  var JSCompiler_inline_result$jscomp$9 = pushStartGenericElement(
1718
- renderState.headChunks,
1726
+ preamble.headChunks,
1719
1727
  props,
1720
1728
  "head"
1721
1729
  );
@@ -1726,24 +1734,42 @@ function pushStartInstance(
1726
1734
  "head"
1727
1735
  );
1728
1736
  return JSCompiler_inline_result$jscomp$9;
1729
- case "html":
1730
- if (
1731
- 0 === formatContext.insertionMode &&
1732
- null === renderState.htmlChunks
1733
- ) {
1734
- renderState.htmlChunks = [""];
1737
+ case "body":
1738
+ if (2 > formatContext.insertionMode) {
1739
+ var preamble$jscomp$0 = preambleState || renderState.preamble;
1740
+ if (preamble$jscomp$0.bodyChunks)
1741
+ throw Error(formatProdErrorMessage(545, "`<body>`"));
1742
+ preamble$jscomp$0.bodyChunks = [];
1735
1743
  var JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
1736
- renderState.htmlChunks,
1744
+ preamble$jscomp$0.bodyChunks,
1737
1745
  props,
1738
- "html"
1746
+ "body"
1739
1747
  );
1740
1748
  } else
1741
1749
  JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
1742
1750
  target$jscomp$0,
1743
1751
  props,
1744
- "html"
1752
+ "body"
1745
1753
  );
1746
1754
  return JSCompiler_inline_result$jscomp$10;
1755
+ case "html":
1756
+ if (0 === formatContext.insertionMode) {
1757
+ var preamble$jscomp$1 = preambleState || renderState.preamble;
1758
+ if (preamble$jscomp$1.htmlChunks)
1759
+ throw Error(formatProdErrorMessage(545, "`<html>`"));
1760
+ preamble$jscomp$1.htmlChunks = [""];
1761
+ var JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
1762
+ preamble$jscomp$1.htmlChunks,
1763
+ props,
1764
+ "html"
1765
+ );
1766
+ } else
1767
+ JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
1768
+ target$jscomp$0,
1769
+ props,
1770
+ "html"
1771
+ );
1772
+ return JSCompiler_inline_result$jscomp$11;
1747
1773
  default:
1748
1774
  if (-1 !== type.indexOf("-")) {
1749
1775
  target$jscomp$0.push(startChunkForTag(type));
@@ -1804,6 +1830,15 @@ function endChunkForTag(tag) {
1804
1830
  void 0 === chunk && ((chunk = "</" + tag + ">"), endTagCache.set(tag, chunk));
1805
1831
  return chunk;
1806
1832
  }
1833
+ function hoistPreambleState(renderState, preambleState) {
1834
+ renderState = renderState.preamble;
1835
+ null === renderState.htmlChunks &&
1836
+ (renderState.htmlChunks = preambleState.htmlChunks);
1837
+ null === renderState.headChunks &&
1838
+ (renderState.headChunks = preambleState.headChunks);
1839
+ null === renderState.bodyChunks &&
1840
+ (renderState.bodyChunks = preambleState.bodyChunks);
1841
+ }
1807
1842
  function writeBootstrap(destination, renderState) {
1808
1843
  renderState = renderState.bootstrapChunks;
1809
1844
  for (var i = 0; i < renderState.length - 1; i++)
@@ -1824,6 +1859,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1824
1859
  switch (formatContext.insertionMode) {
1825
1860
  case 0:
1826
1861
  case 1:
1862
+ case 3:
1827
1863
  case 2:
1828
1864
  return (
1829
1865
  destination.push('<div hidden id="'),
@@ -1832,7 +1868,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1832
1868
  destination.push(renderState),
1833
1869
  destination.push('">')
1834
1870
  );
1835
- case 3:
1871
+ case 4:
1836
1872
  return (
1837
1873
  destination.push('<svg aria-hidden="true" style="display:none" id="'),
1838
1874
  destination.push(renderState.segmentPrefix),
@@ -1840,7 +1876,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1840
1876
  destination.push(renderState),
1841
1877
  destination.push('">')
1842
1878
  );
1843
- case 4:
1879
+ case 5:
1844
1880
  return (
1845
1881
  destination.push('<math aria-hidden="true" style="display:none" id="'),
1846
1882
  destination.push(renderState.segmentPrefix),
@@ -1848,7 +1884,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1848
1884
  destination.push(renderState),
1849
1885
  destination.push('">')
1850
1886
  );
1851
- case 5:
1887
+ case 6:
1852
1888
  return (
1853
1889
  destination.push('<table hidden id="'),
1854
1890
  destination.push(renderState.segmentPrefix),
@@ -1856,7 +1892,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1856
1892
  destination.push(renderState),
1857
1893
  destination.push('">')
1858
1894
  );
1859
- case 6:
1895
+ case 7:
1860
1896
  return (
1861
1897
  destination.push('<table hidden><tbody id="'),
1862
1898
  destination.push(renderState.segmentPrefix),
@@ -1864,7 +1900,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1864
1900
  destination.push(renderState),
1865
1901
  destination.push('">')
1866
1902
  );
1867
- case 7:
1903
+ case 8:
1868
1904
  return (
1869
1905
  destination.push('<table hidden><tr id="'),
1870
1906
  destination.push(renderState.segmentPrefix),
@@ -1872,7 +1908,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1872
1908
  destination.push(renderState),
1873
1909
  destination.push('">')
1874
1910
  );
1875
- case 8:
1911
+ case 9:
1876
1912
  return (
1877
1913
  destination.push('<table hidden><colgroup id="'),
1878
1914
  destination.push(renderState.segmentPrefix),
@@ -1888,19 +1924,20 @@ function writeEndSegment(destination, formatContext) {
1888
1924
  switch (formatContext.insertionMode) {
1889
1925
  case 0:
1890
1926
  case 1:
1927
+ case 3:
1891
1928
  case 2:
1892
1929
  return destination.push("</div>");
1893
- case 3:
1894
- return destination.push("</svg>");
1895
1930
  case 4:
1896
- return destination.push("</math>");
1931
+ return destination.push("</svg>");
1897
1932
  case 5:
1898
- return destination.push("</table>");
1933
+ return destination.push("</math>");
1899
1934
  case 6:
1900
- return destination.push("</tbody></table>");
1935
+ return destination.push("</table>");
1901
1936
  case 7:
1902
- return destination.push("</tr></table>");
1937
+ return destination.push("</tbody></table>");
1903
1938
  case 8:
1939
+ return destination.push("</tr></table>");
1940
+ case 9:
1904
1941
  return destination.push("</colgroup></table>");
1905
1942
  default:
1906
1943
  throw Error(formatProdErrorMessage(397));
@@ -2566,16 +2603,17 @@ function createRenderState(resumableState, generateStaticMarkup) {
2566
2603
  "\x3c/script>"
2567
2604
  );
2568
2605
  bootstrapScriptContent = idPrefix + "P:";
2569
- var JSCompiler_object_inline_segmentPrefix_1479 = idPrefix + "S:";
2606
+ var JSCompiler_object_inline_segmentPrefix_1521 = idPrefix + "S:";
2570
2607
  idPrefix += "B:";
2571
- var JSCompiler_object_inline_preconnects_1493 = new Set(),
2572
- JSCompiler_object_inline_fontPreloads_1494 = new Set(),
2573
- JSCompiler_object_inline_highImagePreloads_1495 = new Set(),
2574
- JSCompiler_object_inline_styles_1496 = new Map(),
2575
- JSCompiler_object_inline_bootstrapScripts_1497 = new Set(),
2576
- JSCompiler_object_inline_scripts_1498 = new Set(),
2577
- JSCompiler_object_inline_bulkPreloads_1499 = new Set(),
2578
- JSCompiler_object_inline_preloads_1500 = {
2608
+ var JSCompiler_object_inline_preamble_1524 = createPreambleState(),
2609
+ JSCompiler_object_inline_preconnects_1534 = new Set(),
2610
+ JSCompiler_object_inline_fontPreloads_1535 = new Set(),
2611
+ JSCompiler_object_inline_highImagePreloads_1536 = new Set(),
2612
+ JSCompiler_object_inline_styles_1537 = new Map(),
2613
+ JSCompiler_object_inline_bootstrapScripts_1538 = new Set(),
2614
+ JSCompiler_object_inline_scripts_1539 = new Set(),
2615
+ JSCompiler_object_inline_bulkPreloads_1540 = new Set(),
2616
+ JSCompiler_object_inline_preloads_1541 = {
2579
2617
  images: new Map(),
2580
2618
  stylesheets: new Map(),
2581
2619
  scripts: new Map(),
@@ -2612,7 +2650,7 @@ function createRenderState(resumableState, generateStaticMarkup) {
2612
2650
  scriptConfig.moduleScriptResources[href] = null;
2613
2651
  scriptConfig = [];
2614
2652
  pushLinkImpl(scriptConfig, props);
2615
- JSCompiler_object_inline_bootstrapScripts_1497.add(scriptConfig);
2653
+ JSCompiler_object_inline_bootstrapScripts_1538.add(scriptConfig);
2616
2654
  bootstrapChunks.push('<script src="', escapeTextForBrowser(src));
2617
2655
  "string" === typeof integrity &&
2618
2656
  bootstrapChunks.push('" integrity="', escapeTextForBrowser(integrity));
@@ -2653,7 +2691,7 @@ function createRenderState(resumableState, generateStaticMarkup) {
2653
2691
  (props.moduleScriptResources[scriptConfig] = null),
2654
2692
  (props = []),
2655
2693
  pushLinkImpl(props, integrity),
2656
- JSCompiler_object_inline_bootstrapScripts_1497.add(props),
2694
+ JSCompiler_object_inline_bootstrapScripts_1538.add(props),
2657
2695
  bootstrapChunks.push(
2658
2696
  '<script type="module" src="',
2659
2697
  escapeTextForBrowser(i)
@@ -2668,11 +2706,10 @@ function createRenderState(resumableState, generateStaticMarkup) {
2668
2706
  bootstrapChunks.push('" async="">\x3c/script>');
2669
2707
  return {
2670
2708
  placeholderPrefix: bootstrapScriptContent,
2671
- segmentPrefix: JSCompiler_object_inline_segmentPrefix_1479,
2709
+ segmentPrefix: JSCompiler_object_inline_segmentPrefix_1521,
2672
2710
  boundaryPrefix: idPrefix,
2673
2711
  startInlineScript: "<script>",
2674
- htmlChunks: null,
2675
- headChunks: null,
2712
+ preamble: JSCompiler_object_inline_preamble_1524,
2676
2713
  externalRuntimeScript: null,
2677
2714
  bootstrapChunks: bootstrapChunks,
2678
2715
  importMapChunks: [],
@@ -2688,14 +2725,14 @@ function createRenderState(resumableState, generateStaticMarkup) {
2688
2725
  charsetChunks: [],
2689
2726
  viewportChunks: [],
2690
2727
  hoistableChunks: [],
2691
- preconnects: JSCompiler_object_inline_preconnects_1493,
2692
- fontPreloads: JSCompiler_object_inline_fontPreloads_1494,
2693
- highImagePreloads: JSCompiler_object_inline_highImagePreloads_1495,
2694
- styles: JSCompiler_object_inline_styles_1496,
2695
- bootstrapScripts: JSCompiler_object_inline_bootstrapScripts_1497,
2696
- scripts: JSCompiler_object_inline_scripts_1498,
2697
- bulkPreloads: JSCompiler_object_inline_bulkPreloads_1499,
2698
- preloads: JSCompiler_object_inline_preloads_1500,
2728
+ preconnects: JSCompiler_object_inline_preconnects_1534,
2729
+ fontPreloads: JSCompiler_object_inline_fontPreloads_1535,
2730
+ highImagePreloads: JSCompiler_object_inline_highImagePreloads_1536,
2731
+ styles: JSCompiler_object_inline_styles_1537,
2732
+ bootstrapScripts: JSCompiler_object_inline_bootstrapScripts_1538,
2733
+ scripts: JSCompiler_object_inline_scripts_1539,
2734
+ bulkPreloads: JSCompiler_object_inline_bulkPreloads_1540,
2735
+ preloads: JSCompiler_object_inline_preloads_1541,
2699
2736
  stylesToHoist: !1,
2700
2737
  generateStaticMarkup: generateStaticMarkup
2701
2738
  };
@@ -3466,7 +3503,7 @@ function RequestInstance(
3466
3503
  this.status = 10;
3467
3504
  this.fatalError = null;
3468
3505
  this.pendingRootTasks = this.allPendingTasks = this.nextSegmentId = 0;
3469
- this.completedRootSegment = null;
3506
+ this.completedPreambleSegments = this.completedRootSegment = null;
3470
3507
  this.abortableTasks = abortSet;
3471
3508
  this.pingedTasks = [];
3472
3509
  this.clientRenderedBoundaries = [];
@@ -3525,6 +3562,7 @@ function createRequest(
3525
3562
  null,
3526
3563
  renderState,
3527
3564
  null,
3565
+ null,
3528
3566
  resumableState.abortableTasks,
3529
3567
  null,
3530
3568
  rootFormatContext,
@@ -3544,7 +3582,12 @@ function pingTask(request, task) {
3544
3582
  ((request.flushScheduled = null !== request.destination),
3545
3583
  performWork(request));
3546
3584
  }
3547
- function createSuspenseBoundary(request, fallbackAbortableTasks) {
3585
+ function createSuspenseBoundary(
3586
+ request,
3587
+ fallbackAbortableTasks,
3588
+ contentPreamble,
3589
+ fallbackPreamble
3590
+ ) {
3548
3591
  return {
3549
3592
  status: 0,
3550
3593
  rootSegmentID: -1,
@@ -3556,6 +3599,8 @@ function createSuspenseBoundary(request, fallbackAbortableTasks) {
3556
3599
  errorDigest: null,
3557
3600
  contentState: createHoistableState(),
3558
3601
  fallbackState: createHoistableState(),
3602
+ contentPreamble: contentPreamble,
3603
+ fallbackPreamble: fallbackPreamble,
3559
3604
  trackedContentKeyPath: null,
3560
3605
  trackedFallbackNode: null
3561
3606
  };
@@ -3567,6 +3612,7 @@ function createRenderTask(
3567
3612
  childIndex,
3568
3613
  blockedBoundary,
3569
3614
  blockedSegment,
3615
+ blockedPreamble,
3570
3616
  hoistableState,
3571
3617
  abortSet,
3572
3618
  keyPath,
@@ -3589,6 +3635,7 @@ function createRenderTask(
3589
3635
  },
3590
3636
  blockedBoundary: blockedBoundary,
3591
3637
  blockedSegment: blockedSegment,
3638
+ blockedPreamble: blockedPreamble,
3592
3639
  hoistableState: hoistableState,
3593
3640
  abortSet: abortSet,
3594
3641
  keyPath: keyPath,
@@ -3632,6 +3679,7 @@ function createReplayTask(
3632
3679
  },
3633
3680
  blockedBoundary: blockedBoundary,
3634
3681
  blockedSegment: null,
3682
+ blockedPreamble: null,
3635
3683
  hoistableState: hoistableState,
3636
3684
  abortSet: abortSet,
3637
3685
  keyPath: keyPath,
@@ -3655,11 +3703,12 @@ function createPendingSegment(
3655
3703
  ) {
3656
3704
  return {
3657
3705
  status: 0,
3706
+ parentFlushed: !1,
3658
3707
  id: -1,
3659
3708
  index: index,
3660
- parentFlushed: !1,
3661
3709
  chunks: [],
3662
3710
  children: [],
3711
+ preambleChildren: [],
3663
3712
  parentFormatContext: parentFormatContext,
3664
3713
  boundary: boundary,
3665
3714
  lastPushedText: lastPushedText,
@@ -3887,12 +3936,13 @@ function renderElement(request, task, keyPath, type, props, ref) {
3887
3936
  (task.formatContext = defaultProps),
3888
3937
  (task.keyPath = initialState);
3889
3938
  else {
3890
- initialState = pushStartInstance(
3939
+ ref = pushStartInstance(
3891
3940
  newProps.chunks,
3892
3941
  type,
3893
3942
  props,
3894
3943
  request.resumableState,
3895
3944
  request.renderState,
3945
+ task.blockedPreamble,
3896
3946
  task.hoistableState,
3897
3947
  task.formatContext,
3898
3948
  newProps.lastPushedText,
@@ -3900,12 +3950,42 @@ function renderElement(request, task, keyPath, type, props, ref) {
3900
3950
  );
3901
3951
  newProps.lastPushedText = !1;
3902
3952
  defaultProps = task.formatContext;
3903
- ref = task.keyPath;
3904
- task.formatContext = getChildFormatContext(defaultProps, type, props);
3953
+ initialState = task.keyPath;
3905
3954
  task.keyPath = keyPath;
3906
- renderNode(request, task, initialState, -1);
3955
+ 3 ===
3956
+ (task.formatContext = getChildFormatContext(defaultProps, type, props))
3957
+ .insertionMode
3958
+ ? ((keyPath = createPendingSegment(
3959
+ request,
3960
+ 0,
3961
+ null,
3962
+ task.formatContext,
3963
+ !1,
3964
+ !1
3965
+ )),
3966
+ newProps.preambleChildren.push(keyPath),
3967
+ (keyPath = createRenderTask(
3968
+ request,
3969
+ null,
3970
+ ref,
3971
+ -1,
3972
+ task.blockedBoundary,
3973
+ keyPath,
3974
+ task.blockedPreamble,
3975
+ task.hoistableState,
3976
+ request.abortableTasks,
3977
+ task.keyPath,
3978
+ task.formatContext,
3979
+ task.context,
3980
+ task.treeContext,
3981
+ task.componentStack,
3982
+ task.isFallback
3983
+ )),
3984
+ pushComponentStack(keyPath),
3985
+ request.pingedTasks.push(keyPath))
3986
+ : renderNode(request, task, ref, -1);
3907
3987
  task.formatContext = defaultProps;
3908
- task.keyPath = ref;
3988
+ task.keyPath = initialState;
3909
3989
  a: {
3910
3990
  task = newProps.chunks;
3911
3991
  request = request.resumableState;
@@ -3940,6 +4020,9 @@ function renderElement(request, task, keyPath, type, props, ref) {
3940
4020
  request.hasHtml = !0;
3941
4021
  break a;
3942
4022
  }
4023
+ break;
4024
+ case "head":
4025
+ if (1 >= defaultProps.insertionMode) break a;
3943
4026
  }
3944
4027
  task.push(endChunkForTag(type));
3945
4028
  }
@@ -3984,25 +4067,34 @@ function renderElement(request, task, keyPath, type, props, ref) {
3984
4067
  }
3985
4068
  } else {
3986
4069
  type = task.keyPath;
3987
- var parentBoundary = task.blockedBoundary,
3988
- parentHoistableState = task.hoistableState;
3989
- ref = task.blockedSegment;
3990
- propName$33 = props.fallback;
4070
+ var parentBoundary = task.blockedBoundary;
4071
+ ref = task.blockedPreamble;
4072
+ var parentHoistableState = task.hoistableState;
4073
+ propName$33 = task.blockedSegment;
4074
+ propName = props.fallback;
3991
4075
  props = props.children;
3992
4076
  var fallbackAbortSet = new Set();
3993
- propName = createSuspenseBoundary(request, fallbackAbortSet);
4077
+ var newBoundary =
4078
+ 2 > task.formatContext.insertionMode
4079
+ ? createSuspenseBoundary(
4080
+ request,
4081
+ fallbackAbortSet,
4082
+ createPreambleState(),
4083
+ createPreambleState()
4084
+ )
4085
+ : createSuspenseBoundary(request, fallbackAbortSet, null, null);
3994
4086
  null !== request.trackedPostpones &&
3995
- (propName.trackedContentKeyPath = keyPath);
4087
+ (newBoundary.trackedContentKeyPath = keyPath);
3996
4088
  var boundarySegment = createPendingSegment(
3997
4089
  request,
3998
- ref.chunks.length,
3999
- propName,
4090
+ propName$33.chunks.length,
4091
+ newBoundary,
4000
4092
  task.formatContext,
4001
4093
  !1,
4002
4094
  !1
4003
4095
  );
4004
- ref.children.push(boundarySegment);
4005
- ref.lastPushedText = !1;
4096
+ propName$33.children.push(boundarySegment);
4097
+ propName$33.lastPushedText = !1;
4006
4098
  var contentRootSegment = createPendingSegment(
4007
4099
  request,
4008
4100
  0,
@@ -4016,12 +4108,13 @@ function renderElement(request, task, keyPath, type, props, ref) {
4016
4108
  newProps = [keyPath[0], "Suspense Fallback", keyPath[2]];
4017
4109
  defaultProps = [newProps[1], newProps[2], [], null];
4018
4110
  request.trackedPostpones.workingMap.set(newProps, defaultProps);
4019
- propName.trackedFallbackNode = defaultProps;
4111
+ newBoundary.trackedFallbackNode = defaultProps;
4020
4112
  task.blockedSegment = boundarySegment;
4113
+ task.blockedPreamble = newBoundary.fallbackPreamble;
4021
4114
  task.keyPath = newProps;
4022
4115
  boundarySegment.status = 6;
4023
4116
  try {
4024
- renderNode(request, task, propName$33, -1),
4117
+ renderNode(request, task, propName, -1),
4025
4118
  pushSegmentFinale(
4026
4119
  boundarySegment.chunks,
4027
4120
  request.renderState,
@@ -4035,16 +4128,19 @@ function renderElement(request, task, keyPath, type, props, ref) {
4035
4128
  thrownValue)
4036
4129
  );
4037
4130
  } finally {
4038
- (task.blockedSegment = ref), (task.keyPath = type);
4131
+ (task.blockedSegment = propName$33),
4132
+ (task.blockedPreamble = ref),
4133
+ (task.keyPath = type);
4039
4134
  }
4040
4135
  task = createRenderTask(
4041
4136
  request,
4042
4137
  null,
4043
4138
  props,
4044
4139
  -1,
4045
- propName,
4140
+ newBoundary,
4046
4141
  contentRootSegment,
4047
- propName.contentState,
4142
+ newBoundary.contentPreamble,
4143
+ newBoundary.contentState,
4048
4144
  task.abortSet,
4049
4145
  keyPath,
4050
4146
  task.formatContext,
@@ -4056,8 +4152,9 @@ function renderElement(request, task, keyPath, type, props, ref) {
4056
4152
  pushComponentStack(task);
4057
4153
  request.pingedTasks.push(task);
4058
4154
  } else {
4059
- task.blockedBoundary = propName;
4060
- task.hoistableState = propName.contentState;
4155
+ task.blockedBoundary = newBoundary;
4156
+ task.blockedPreamble = newBoundary.contentPreamble;
4157
+ task.hoistableState = newBoundary.contentState;
4061
4158
  task.blockedSegment = contentRootSegment;
4062
4159
  task.keyPath = keyPath;
4063
4160
  contentRootSegment.status = 6;
@@ -4071,14 +4168,17 @@ function renderElement(request, task, keyPath, type, props, ref) {
4071
4168
  contentRootSegment.textEmbedded
4072
4169
  ),
4073
4170
  (contentRootSegment.status = 1),
4074
- queueCompletedSegment(propName, contentRootSegment),
4075
- 0 === propName.pendingTasks && 0 === propName.status)
4171
+ queueCompletedSegment(newBoundary, contentRootSegment),
4172
+ 0 === newBoundary.pendingTasks && 0 === newBoundary.status)
4076
4173
  ) {
4077
- propName.status = 1;
4174
+ newBoundary.status = 1;
4175
+ 0 === request.pendingRootTasks &&
4176
+ task.blockedPreamble &&
4177
+ preparePreamble(request);
4078
4178
  break a;
4079
4179
  }
4080
4180
  } catch (thrownValue$28) {
4081
- (propName.status = 4),
4181
+ (newBoundary.status = 4),
4082
4182
  12 === request.status
4083
4183
  ? ((contentRootSegment.status = 3),
4084
4184
  (newProps = request.fatalError))
@@ -4090,22 +4190,24 @@ function renderElement(request, task, keyPath, type, props, ref) {
4090
4190
  newProps,
4091
4191
  defaultProps
4092
4192
  )),
4093
- (propName.errorDigest = initialState),
4094
- untrackBoundary(request, propName);
4193
+ (newBoundary.errorDigest = initialState),
4194
+ untrackBoundary(request, newBoundary);
4095
4195
  } finally {
4096
4196
  (task.blockedBoundary = parentBoundary),
4197
+ (task.blockedPreamble = ref),
4097
4198
  (task.hoistableState = parentHoistableState),
4098
- (task.blockedSegment = ref),
4199
+ (task.blockedSegment = propName$33),
4099
4200
  (task.keyPath = type);
4100
4201
  }
4101
4202
  task = createRenderTask(
4102
4203
  request,
4103
4204
  null,
4104
- propName$33,
4205
+ propName,
4105
4206
  -1,
4106
4207
  parentBoundary,
4107
4208
  boundarySegment,
4108
- propName.fallbackState,
4209
+ newBoundary.fallbackPreamble,
4210
+ newBoundary.fallbackState,
4109
4211
  fallbackAbortSet,
4110
4212
  [keyPath[0], "Suspense Fallback", keyPath[2]],
4111
4213
  task.formatContext,
@@ -4124,9 +4226,9 @@ function renderElement(request, task, keyPath, type, props, ref) {
4124
4226
  switch (type.$$typeof) {
4125
4227
  case REACT_FORWARD_REF_TYPE:
4126
4228
  if ("ref" in props)
4127
- for (boundarySegment in ((newProps = {}), props))
4128
- "ref" !== boundarySegment &&
4129
- (newProps[boundarySegment] = props[boundarySegment]);
4229
+ for (newBoundary in ((newProps = {}), props))
4230
+ "ref" !== newBoundary &&
4231
+ (newProps[newBoundary] = props[newBoundary]);
4130
4232
  else newProps = props;
4131
4233
  type = renderWithHooks(
4132
4234
  request,
@@ -4323,17 +4425,27 @@ function retryNode(request, task) {
4323
4425
  previousReplaySet = task.replay,
4324
4426
  parentBoundary = task.blockedBoundary,
4325
4427
  parentHoistableState = task.hoistableState,
4326
- content = props.children;
4327
- props = props.fallback;
4328
- var fallbackAbortSet = new Set(),
4329
- resumedBoundary = createSuspenseBoundary(
4330
- request,
4331
- fallbackAbortSet
4332
- );
4333
- resumedBoundary.parentFlushed = !0;
4334
- resumedBoundary.rootSegmentID = type;
4335
- task.blockedBoundary = resumedBoundary;
4336
- task.hoistableState = resumedBoundary.contentState;
4428
+ content = props.children,
4429
+ fallback = props.fallback,
4430
+ fallbackAbortSet = new Set();
4431
+ props =
4432
+ 2 > task.formatContext.insertionMode
4433
+ ? createSuspenseBoundary(
4434
+ request,
4435
+ fallbackAbortSet,
4436
+ createPreambleState(),
4437
+ createPreambleState()
4438
+ )
4439
+ : createSuspenseBoundary(
4440
+ request,
4441
+ fallbackAbortSet,
4442
+ null,
4443
+ null
4444
+ );
4445
+ props.parentFlushed = !0;
4446
+ props.rootSegmentID = type;
4447
+ task.blockedBoundary = props;
4448
+ task.hoistableState = props.contentState;
4337
4449
  task.keyPath = key;
4338
4450
  task.replay = {
4339
4451
  nodes: ref,
@@ -4348,27 +4460,22 @@ function retryNode(request, task) {
4348
4460
  )
4349
4461
  throw Error(formatProdErrorMessage(488));
4350
4462
  task.replay.pendingTasks--;
4351
- if (
4352
- 0 === resumedBoundary.pendingTasks &&
4353
- 0 === resumedBoundary.status
4354
- ) {
4355
- resumedBoundary.status = 1;
4356
- request.completedBoundaries.push(resumedBoundary);
4463
+ if (0 === props.pendingTasks && 0 === props.status) {
4464
+ props.status = 1;
4465
+ request.completedBoundaries.push(props);
4357
4466
  break b;
4358
4467
  }
4359
4468
  } catch (error) {
4360
- (resumedBoundary.status = 4),
4469
+ (props.status = 4),
4361
4470
  (childNodes = getThrownInfo(task.componentStack)),
4362
4471
  (replay = logRecoverableError(
4363
4472
  request,
4364
4473
  error,
4365
4474
  childNodes
4366
4475
  )),
4367
- (resumedBoundary.errorDigest = replay),
4476
+ (props.errorDigest = replay),
4368
4477
  task.replay.pendingTasks--,
4369
- request.clientRenderedBoundaries.push(
4370
- resumedBoundary
4371
- );
4478
+ request.clientRenderedBoundaries.push(props);
4372
4479
  } finally {
4373
4480
  (task.blockedBoundary = parentBoundary),
4374
4481
  (task.hoistableState = parentHoistableState),
@@ -4383,10 +4490,10 @@ function retryNode(request, task) {
4383
4490
  slots: node$jscomp$0,
4384
4491
  pendingTasks: 0
4385
4492
  },
4386
- props,
4493
+ fallback,
4387
4494
  -1,
4388
4495
  parentBoundary,
4389
- resumedBoundary.fallbackState,
4496
+ props.fallbackState,
4390
4497
  fallbackAbortSet,
4391
4498
  [key[0], "Suspense Fallback", key[2]],
4392
4499
  task.formatContext,
@@ -4599,6 +4706,7 @@ function spawnNewSuspendedRenderTask(request, task, thenableState) {
4599
4706
  task.childIndex,
4600
4707
  task.blockedBoundary,
4601
4708
  newSegment,
4709
+ task.blockedPreamble,
4602
4710
  task.hoistableState,
4603
4711
  task.abortSet,
4604
4712
  task.keyPath,
@@ -4732,7 +4840,12 @@ function abortRemainingReplayNodes(
4732
4840
  node = node[5];
4733
4841
  var request = request$jscomp$0,
4734
4842
  errorDigest = errorDigest$jscomp$0,
4735
- resumedBoundary = createSuspenseBoundary(request, new Set());
4843
+ resumedBoundary = createSuspenseBoundary(
4844
+ request,
4845
+ new Set(),
4846
+ null,
4847
+ null
4848
+ );
4736
4849
  resumedBoundary.parentFlushed = !0;
4737
4850
  resumedBoundary.rootSegmentID = node;
4738
4851
  resumedBoundary.status = 4;
@@ -4863,6 +4976,7 @@ function safelyEmitEarlyPreloads(request, shellComplete) {
4863
4976
  }
4864
4977
  function completeShell(request) {
4865
4978
  null === request.trackedPostpones && safelyEmitEarlyPreloads(request, !0);
4979
+ null === request.trackedPostpones && preparePreamble(request);
4866
4980
  request.onShellError = noop;
4867
4981
  request = request.onShellReady;
4868
4982
  request();
@@ -4875,6 +4989,7 @@ function completeAll(request) {
4875
4989
  : null === request.completedRootSegment ||
4876
4990
  5 !== request.completedRootSegment.status
4877
4991
  );
4992
+ preparePreamble(request);
4878
4993
  request = request.onAllReady;
4879
4994
  request();
4880
4995
  }
@@ -4913,7 +5028,11 @@ function finishedTask(request, boundary, segment) {
4913
5028
  request.completedBoundaries.push(boundary),
4914
5029
  1 === boundary.status &&
4915
5030
  (boundary.fallbackAbortableTasks.forEach(abortTaskSoft, request),
4916
- boundary.fallbackAbortableTasks.clear()))
5031
+ boundary.fallbackAbortableTasks.clear(),
5032
+ 0 === request.pendingRootTasks &&
5033
+ null === request.trackedPostpones &&
5034
+ null !== boundary.contentPreamble &&
5035
+ preparePreamble(request)))
4917
5036
  : null !== segment &&
4918
5037
  segment.parentFlushed &&
4919
5038
  1 === segment.status &&
@@ -5071,9 +5190,11 @@ function performWork(request$jscomp$2) {
5071
5190
  (boundary$jscomp$0.errorDigest = request$jscomp$0),
5072
5191
  untrackBoundary(request, boundary$jscomp$0),
5073
5192
  boundary$jscomp$0.parentFlushed &&
5074
- request.clientRenderedBoundaries.push(
5075
- boundary$jscomp$0
5076
- )));
5193
+ request.clientRenderedBoundaries.push(boundary$jscomp$0),
5194
+ 0 === request.pendingRootTasks &&
5195
+ null === request.trackedPostpones &&
5196
+ null !== boundary$jscomp$0.contentPreamble &&
5197
+ preparePreamble(request)));
5077
5198
  request.allPendingTasks--;
5078
5199
  0 === request.allPendingTasks && completeAll(request);
5079
5200
  }
@@ -5096,6 +5217,82 @@ function performWork(request$jscomp$2) {
5096
5217
  }
5097
5218
  }
5098
5219
  }
5220
+ function preparePreambleFromSubtree(
5221
+ request,
5222
+ segment,
5223
+ collectedPreambleSegments
5224
+ ) {
5225
+ segment.preambleChildren.length &&
5226
+ collectedPreambleSegments.push(segment.preambleChildren);
5227
+ for (var pendingPreambles = !1, i = 0; i < segment.children.length; i++)
5228
+ pendingPreambles =
5229
+ preparePreambleFromSegment(
5230
+ request,
5231
+ segment.children[i],
5232
+ collectedPreambleSegments
5233
+ ) || pendingPreambles;
5234
+ return pendingPreambles;
5235
+ }
5236
+ function preparePreambleFromSegment(
5237
+ request,
5238
+ segment,
5239
+ collectedPreambleSegments
5240
+ ) {
5241
+ var boundary = segment.boundary;
5242
+ if (null === boundary)
5243
+ return preparePreambleFromSubtree(
5244
+ request,
5245
+ segment,
5246
+ collectedPreambleSegments
5247
+ );
5248
+ var preamble = boundary.contentPreamble,
5249
+ fallbackPreamble = boundary.fallbackPreamble;
5250
+ if (null === preamble || null === fallbackPreamble) return !1;
5251
+ switch (boundary.status) {
5252
+ case 1:
5253
+ hoistPreambleState(request.renderState, preamble);
5254
+ segment = boundary.completedSegments[0];
5255
+ if (!segment) throw Error(formatProdErrorMessage(391));
5256
+ return preparePreambleFromSubtree(
5257
+ request,
5258
+ segment,
5259
+ collectedPreambleSegments
5260
+ );
5261
+ case 5:
5262
+ if (null !== request.trackedPostpones) return !0;
5263
+ case 4:
5264
+ if (1 === segment.status)
5265
+ return (
5266
+ hoistPreambleState(request.renderState, fallbackPreamble),
5267
+ preparePreambleFromSubtree(
5268
+ request,
5269
+ segment,
5270
+ collectedPreambleSegments
5271
+ )
5272
+ );
5273
+ default:
5274
+ return !0;
5275
+ }
5276
+ }
5277
+ function preparePreamble(request) {
5278
+ if (
5279
+ request.completedRootSegment &&
5280
+ null === request.completedPreambleSegments
5281
+ ) {
5282
+ var collectedPreambleSegments = [],
5283
+ hasPendingPreambles = preparePreambleFromSegment(
5284
+ request,
5285
+ request.completedRootSegment,
5286
+ collectedPreambleSegments
5287
+ ),
5288
+ preamble = request.renderState.preamble;
5289
+ if (
5290
+ !1 === hasPendingPreambles ||
5291
+ (preamble.headChunks && preamble.bodyChunks)
5292
+ )
5293
+ request.completedPreambleSegments = collectedPreambleSegments;
5294
+ }
5295
+ }
5099
5296
  function flushSubtree(request, destination, segment, hoistableState) {
5100
5297
  segment.parentFlushed = !0;
5101
5298
  switch (segment.status) {
@@ -5310,9 +5507,12 @@ function flushCompletedQueues(request, destination) {
5310
5507
  completedRootSegment = request.completedRootSegment;
5311
5508
  if (null !== completedRootSegment) {
5312
5509
  if (5 === completedRootSegment.status) return;
5510
+ var completedPreambleSegments = request.completedPreambleSegments;
5511
+ if (null === completedPreambleSegments) return;
5313
5512
  var renderState = request.renderState,
5314
- htmlChunks = renderState.htmlChunks,
5315
- headChunks = renderState.headChunks,
5513
+ preamble = renderState.preamble,
5514
+ htmlChunks = preamble.htmlChunks,
5515
+ headChunks = preamble.headChunks,
5316
5516
  i$jscomp$0;
5317
5517
  if (htmlChunks) {
5318
5518
  for (i$jscomp$0 = 0; i$jscomp$0 < htmlChunks.length; i$jscomp$0++)
@@ -5355,11 +5555,29 @@ function flushCompletedQueues(request, destination) {
5355
5555
  var hoistableChunks = renderState.hoistableChunks;
5356
5556
  for (i$jscomp$0 = 0; i$jscomp$0 < hoistableChunks.length; i$jscomp$0++)
5357
5557
  destination.push(hoistableChunks[i$jscomp$0]);
5358
- hoistableChunks.length = 0;
5359
- if (htmlChunks && null === headChunks) {
5558
+ for (
5559
+ renderState = hoistableChunks.length = 0;
5560
+ renderState < completedPreambleSegments.length;
5561
+ renderState++
5562
+ ) {
5563
+ var segments = completedPreambleSegments[renderState];
5564
+ for (preamble = 0; preamble < segments.length; preamble++)
5565
+ flushSegment(request, destination, segments[preamble], null);
5566
+ }
5567
+ var preamble$jscomp$0 = request.renderState.preamble,
5568
+ headChunks$jscomp$0 = preamble$jscomp$0.headChunks;
5569
+ if (preamble$jscomp$0.htmlChunks || headChunks$jscomp$0) {
5360
5570
  var chunk$jscomp$0 = endChunkForTag("head");
5361
5571
  destination.push(chunk$jscomp$0);
5362
5572
  }
5573
+ var bodyChunks = preamble$jscomp$0.bodyChunks;
5574
+ if (bodyChunks)
5575
+ for (
5576
+ completedPreambleSegments = 0;
5577
+ completedPreambleSegments < bodyChunks.length;
5578
+ completedPreambleSegments++
5579
+ )
5580
+ destination.push(bodyChunks[completedPreambleSegments]);
5363
5581
  flushSegment(request, destination, completedRootSegment, null);
5364
5582
  request.completedRootSegment = null;
5365
5583
  writeBootstrap(destination, request.renderState);
@@ -5622,4 +5840,4 @@ exports.renderToString = function (children, options) {
5622
5840
  '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 "renderToReadableStream" which supports Suspense on the server'
5623
5841
  );
5624
5842
  };
5625
- exports.version = "19.1.0-canary-d46b04a2-20250117";
5843
+ exports.version = "19.1.0-canary-18eaf51b-20250118";