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.
@@ -252,26 +252,26 @@ function createRenderState(
252
252
  ("" + JSON.stringify(importMap)).replace(scriptRegex, scriptReplacer)
253
253
  ),
254
254
  bootstrapScriptContent.push("\x3c/script>"));
255
- importMap = {
255
+ importMap = onHeaders
256
+ ? {
257
+ preconnects: "",
258
+ fontPreloads: "",
259
+ highImagePreloads: "",
260
+ remainingCapacity:
261
+ 2 + ("number" === typeof maxHeadersLength ? maxHeadersLength : 2e3)
262
+ }
263
+ : null;
264
+ onHeaders = {
256
265
  placeholderPrefix: idPrefix + "P:",
257
266
  segmentPrefix: idPrefix + "S:",
258
267
  boundaryPrefix: idPrefix + "B:",
259
268
  startInlineScript: inlineScriptWithNonce,
260
- htmlChunks: null,
261
- headChunks: null,
269
+ preamble: createPreambleState(),
262
270
  externalRuntimeScript: null,
263
271
  bootstrapChunks: externalRuntimeConfig,
264
272
  importMapChunks: bootstrapScriptContent,
265
273
  onHeaders: onHeaders,
266
- headers: onHeaders
267
- ? {
268
- preconnects: "",
269
- fontPreloads: "",
270
- highImagePreloads: "",
271
- remainingCapacity:
272
- 2 + ("number" === typeof maxHeadersLength ? maxHeadersLength : 2e3)
273
- }
274
- : null,
274
+ headers: importMap,
275
275
  resets: {
276
276
  font: {},
277
277
  dns: {},
@@ -300,8 +300,8 @@ function createRenderState(
300
300
  stylesToHoist: !1
301
301
  };
302
302
  if (void 0 !== bootstrapScripts)
303
- for (onHeaders = 0; onHeaders < bootstrapScripts.length; onHeaders++) {
304
- var scriptConfig = bootstrapScripts[onHeaders];
303
+ for (importMap = 0; importMap < bootstrapScripts.length; importMap++) {
304
+ var scriptConfig = bootstrapScripts[importMap];
305
305
  idPrefix = inlineScriptWithNonce = void 0;
306
306
  bootstrapScriptContent = {
307
307
  rel: "preload",
@@ -328,7 +328,7 @@ function createRenderState(
328
328
  scriptConfig.moduleScriptResources[href] = null;
329
329
  scriptConfig = [];
330
330
  pushLinkImpl(scriptConfig, bootstrapScriptContent);
331
- importMap.bootstrapScripts.add(scriptConfig);
331
+ onHeaders.bootstrapScripts.add(scriptConfig);
332
332
  externalRuntimeConfig.push(
333
333
  '<script src="',
334
334
  escapeTextForBrowser(maxHeadersLength)
@@ -361,8 +361,8 @@ function createRenderState(
361
361
  nonce: nonce
362
362
  }),
363
363
  "string" === typeof bootstrapScriptContent
364
- ? (idPrefix.href = onHeaders = bootstrapScriptContent)
365
- : ((idPrefix.href = onHeaders = bootstrapScriptContent.src),
364
+ ? (idPrefix.href = importMap = bootstrapScriptContent)
365
+ : ((idPrefix.href = importMap = bootstrapScriptContent.src),
366
366
  (idPrefix.integrity = inlineScriptWithNonce =
367
367
  "string" === typeof bootstrapScriptContent.integrity
368
368
  ? bootstrapScriptContent.integrity
@@ -375,15 +375,15 @@ function createRenderState(
375
375
  ? "use-credentials"
376
376
  : "")),
377
377
  (bootstrapScriptContent = resumableState),
378
- (scriptConfig = onHeaders),
378
+ (scriptConfig = importMap),
379
379
  (bootstrapScriptContent.scriptResources[scriptConfig] = null),
380
380
  (bootstrapScriptContent.moduleScriptResources[scriptConfig] = null),
381
381
  (bootstrapScriptContent = []),
382
382
  pushLinkImpl(bootstrapScriptContent, idPrefix),
383
- importMap.bootstrapScripts.add(bootstrapScriptContent),
383
+ onHeaders.bootstrapScripts.add(bootstrapScriptContent),
384
384
  externalRuntimeConfig.push(
385
385
  '<script type="module" src="',
386
- escapeTextForBrowser(onHeaders)
386
+ escapeTextForBrowser(importMap)
387
387
  ),
388
388
  nonce &&
389
389
  externalRuntimeConfig.push('" nonce="', escapeTextForBrowser(nonce)),
@@ -398,7 +398,7 @@ function createRenderState(
398
398
  escapeTextForBrowser(maxHeadersLength)
399
399
  ),
400
400
  externalRuntimeConfig.push('" async="">\x3c/script>');
401
- return importMap;
401
+ return onHeaders;
402
402
  }
403
403
  function createResumableState(
404
404
  identifierPrefix,
@@ -427,6 +427,9 @@ function createResumableState(
427
427
  moduleScriptResources: {}
428
428
  };
429
429
  }
430
+ function createPreambleState() {
431
+ return { htmlChunks: null, headChunks: null, bodyChunks: null };
432
+ }
430
433
  function createFormatContext(insertionMode, selectedValue, tagScope) {
431
434
  return {
432
435
  insertionMode: insertionMode,
@@ -437,9 +440,9 @@ function createFormatContext(insertionMode, selectedValue, tagScope) {
437
440
  function createRootFormatContext(namespaceURI) {
438
441
  return createFormatContext(
439
442
  "http://www.w3.org/2000/svg" === namespaceURI
440
- ? 3
443
+ ? 4
441
444
  : "http://www.w3.org/1998/Math/MathML" === namespaceURI
442
- ? 4
445
+ ? 5
443
446
  : 0,
444
447
  null,
445
448
  0
@@ -456,33 +459,34 @@ function getChildFormatContext(parentContext, type, props) {
456
459
  parentContext.tagScope
457
460
  );
458
461
  case "svg":
459
- return createFormatContext(3, null, parentContext.tagScope);
462
+ return createFormatContext(4, null, parentContext.tagScope);
460
463
  case "picture":
461
464
  return createFormatContext(2, null, parentContext.tagScope | 2);
462
465
  case "math":
463
- return createFormatContext(4, null, parentContext.tagScope);
466
+ return createFormatContext(5, null, parentContext.tagScope);
464
467
  case "foreignObject":
465
468
  return createFormatContext(2, null, parentContext.tagScope);
466
469
  case "table":
467
- return createFormatContext(5, null, parentContext.tagScope);
470
+ return createFormatContext(6, null, parentContext.tagScope);
468
471
  case "thead":
469
472
  case "tbody":
470
473
  case "tfoot":
471
- return createFormatContext(6, null, parentContext.tagScope);
474
+ return createFormatContext(7, null, parentContext.tagScope);
472
475
  case "colgroup":
473
- return createFormatContext(8, null, parentContext.tagScope);
476
+ return createFormatContext(9, null, parentContext.tagScope);
474
477
  case "tr":
475
- return createFormatContext(7, null, parentContext.tagScope);
478
+ return createFormatContext(8, null, parentContext.tagScope);
479
+ case "head":
480
+ if (2 > parentContext.insertionMode)
481
+ return createFormatContext(3, null, parentContext.tagScope);
482
+ break;
483
+ case "html":
484
+ if (0 === parentContext.insertionMode)
485
+ return createFormatContext(1, null, parentContext.tagScope);
476
486
  }
477
- return 5 <= parentContext.insertionMode
487
+ return 6 <= parentContext.insertionMode || 2 > parentContext.insertionMode
478
488
  ? createFormatContext(2, null, parentContext.tagScope)
479
- : 0 === parentContext.insertionMode
480
- ? "html" === type
481
- ? createFormatContext(1, null, parentContext.tagScope)
482
- : createFormatContext(2, null, parentContext.tagScope)
483
- : 1 === parentContext.insertionMode
484
- ? createFormatContext(2, null, parentContext.tagScope)
485
- : parentContext;
489
+ : parentContext;
486
490
  }
487
491
  function pushTextInstance(target, text, renderState, textEmbedded) {
488
492
  if ("" === text) return textEmbedded;
@@ -954,6 +958,7 @@ function pushStartInstance(
954
958
  props,
955
959
  resumableState,
956
960
  renderState,
961
+ preambleState,
957
962
  hoistableState,
958
963
  formatContext,
959
964
  textEmbedded,
@@ -1433,7 +1438,7 @@ function pushStartInstance(
1433
1438
  return JSCompiler_inline_result$jscomp$2;
1434
1439
  case "title":
1435
1440
  if (
1436
- 3 === formatContext.insertionMode ||
1441
+ 4 === formatContext.insertionMode ||
1437
1442
  formatContext.tagScope & 1 ||
1438
1443
  null != props.itemProp
1439
1444
  )
@@ -1452,7 +1457,7 @@ function pushStartInstance(
1452
1457
  href = props.href,
1453
1458
  precedence = props.precedence;
1454
1459
  if (
1455
- 3 === formatContext.insertionMode ||
1460
+ 4 === formatContext.insertionMode ||
1456
1461
  formatContext.tagScope & 1 ||
1457
1462
  null != props.itemProp ||
1458
1463
  "string" !== typeof rel ||
@@ -1534,7 +1539,7 @@ function pushStartInstance(
1534
1539
  "symbol" === typeof asyncProp ||
1535
1540
  props.onLoad ||
1536
1541
  props.onError ||
1537
- 3 === formatContext.insertionMode ||
1542
+ 4 === formatContext.insertionMode ||
1538
1543
  formatContext.tagScope & 1 ||
1539
1544
  null != props.itemProp
1540
1545
  )
@@ -1575,7 +1580,7 @@ function pushStartInstance(
1575
1580
  var precedence$jscomp$0 = props.precedence,
1576
1581
  href$jscomp$0 = props.href;
1577
1582
  if (
1578
- 3 === formatContext.insertionMode ||
1583
+ 4 === formatContext.insertionMode ||
1579
1584
  formatContext.tagScope & 1 ||
1580
1585
  null != props.itemProp ||
1581
1586
  "string" !== typeof precedence$jscomp$0 ||
@@ -1678,7 +1683,7 @@ function pushStartInstance(
1678
1683
  return JSCompiler_inline_result$jscomp$6;
1679
1684
  case "meta":
1680
1685
  if (
1681
- 3 === formatContext.insertionMode ||
1686
+ 4 === formatContext.insertionMode ||
1682
1687
  formatContext.tagScope & 1 ||
1683
1688
  null != props.itemProp
1684
1689
  )
@@ -1856,10 +1861,13 @@ function pushStartInstance(
1856
1861
  case "missing-glyph":
1857
1862
  break;
1858
1863
  case "head":
1859
- if (2 > formatContext.insertionMode && null === renderState.headChunks) {
1860
- renderState.headChunks = [];
1864
+ if (2 > formatContext.insertionMode) {
1865
+ var preamble = preambleState || renderState.preamble;
1866
+ if (preamble.headChunks)
1867
+ throw Error("The `<head>` tag may only be rendered once.");
1868
+ preamble.headChunks = [];
1861
1869
  var JSCompiler_inline_result$jscomp$9 = pushStartGenericElement(
1862
- renderState.headChunks,
1870
+ preamble.headChunks,
1863
1871
  props,
1864
1872
  "head"
1865
1873
  );
@@ -1870,24 +1878,42 @@ function pushStartInstance(
1870
1878
  "head"
1871
1879
  );
1872
1880
  return JSCompiler_inline_result$jscomp$9;
1873
- case "html":
1874
- if (
1875
- 0 === formatContext.insertionMode &&
1876
- null === renderState.htmlChunks
1877
- ) {
1878
- renderState.htmlChunks = ["<!DOCTYPE html>"];
1881
+ case "body":
1882
+ if (2 > formatContext.insertionMode) {
1883
+ var preamble$jscomp$0 = preambleState || renderState.preamble;
1884
+ if (preamble$jscomp$0.bodyChunks)
1885
+ throw Error("The `<body>` tag may only be rendered once.");
1886
+ preamble$jscomp$0.bodyChunks = [];
1879
1887
  var JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
1880
- renderState.htmlChunks,
1888
+ preamble$jscomp$0.bodyChunks,
1881
1889
  props,
1882
- "html"
1890
+ "body"
1883
1891
  );
1884
1892
  } else
1885
1893
  JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
1886
1894
  target$jscomp$0,
1887
1895
  props,
1888
- "html"
1896
+ "body"
1889
1897
  );
1890
1898
  return JSCompiler_inline_result$jscomp$10;
1899
+ case "html":
1900
+ if (0 === formatContext.insertionMode) {
1901
+ var preamble$jscomp$1 = preambleState || renderState.preamble;
1902
+ if (preamble$jscomp$1.htmlChunks)
1903
+ throw Error("The `<html>` tag may only be rendered once.");
1904
+ preamble$jscomp$1.htmlChunks = ["<!DOCTYPE html>"];
1905
+ var JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
1906
+ preamble$jscomp$1.htmlChunks,
1907
+ props,
1908
+ "html"
1909
+ );
1910
+ } else
1911
+ JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
1912
+ target$jscomp$0,
1913
+ props,
1914
+ "html"
1915
+ );
1916
+ return JSCompiler_inline_result$jscomp$11;
1891
1917
  default:
1892
1918
  if (-1 !== type.indexOf("-")) {
1893
1919
  target$jscomp$0.push(startChunkForTag(type));
@@ -1948,6 +1974,15 @@ function endChunkForTag(tag) {
1948
1974
  void 0 === chunk && ((chunk = "</" + tag + ">"), endTagCache.set(tag, chunk));
1949
1975
  return chunk;
1950
1976
  }
1977
+ function hoistPreambleState(renderState, preambleState) {
1978
+ renderState = renderState.preamble;
1979
+ null === renderState.htmlChunks &&
1980
+ (renderState.htmlChunks = preambleState.htmlChunks);
1981
+ null === renderState.headChunks &&
1982
+ (renderState.headChunks = preambleState.headChunks);
1983
+ null === renderState.bodyChunks &&
1984
+ (renderState.bodyChunks = preambleState.bodyChunks);
1985
+ }
1951
1986
  function writeBootstrap(destination, renderState) {
1952
1987
  renderState = renderState.bootstrapChunks;
1953
1988
  for (var i = 0; i < renderState.length - 1; i++)
@@ -1970,6 +2005,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1970
2005
  switch (formatContext.insertionMode) {
1971
2006
  case 0:
1972
2007
  case 1:
2008
+ case 3:
1973
2009
  case 2:
1974
2010
  return (
1975
2011
  writeChunk(destination, '<div hidden id="'),
@@ -1977,7 +2013,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1977
2013
  writeChunk(destination, id.toString(16)),
1978
2014
  !!destination.write('">')
1979
2015
  );
1980
- case 3:
2016
+ case 4:
1981
2017
  return (
1982
2018
  writeChunk(
1983
2019
  destination,
@@ -1987,7 +2023,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1987
2023
  writeChunk(destination, id.toString(16)),
1988
2024
  !!destination.write('">')
1989
2025
  );
1990
- case 4:
2026
+ case 5:
1991
2027
  return (
1992
2028
  writeChunk(
1993
2029
  destination,
@@ -1997,28 +2033,28 @@ function writeStartSegment(destination, renderState, formatContext, id) {
1997
2033
  writeChunk(destination, id.toString(16)),
1998
2034
  !!destination.write('">')
1999
2035
  );
2000
- case 5:
2036
+ case 6:
2001
2037
  return (
2002
2038
  writeChunk(destination, '<table hidden id="'),
2003
2039
  writeChunk(destination, renderState.segmentPrefix),
2004
2040
  writeChunk(destination, id.toString(16)),
2005
2041
  !!destination.write('">')
2006
2042
  );
2007
- case 6:
2043
+ case 7:
2008
2044
  return (
2009
2045
  writeChunk(destination, '<table hidden><tbody id="'),
2010
2046
  writeChunk(destination, renderState.segmentPrefix),
2011
2047
  writeChunk(destination, id.toString(16)),
2012
2048
  !!destination.write('">')
2013
2049
  );
2014
- case 7:
2050
+ case 8:
2015
2051
  return (
2016
2052
  writeChunk(destination, '<table hidden><tr id="'),
2017
2053
  writeChunk(destination, renderState.segmentPrefix),
2018
2054
  writeChunk(destination, id.toString(16)),
2019
2055
  !!destination.write('">')
2020
2056
  );
2021
- case 8:
2057
+ case 9:
2022
2058
  return (
2023
2059
  writeChunk(destination, '<table hidden><colgroup id="'),
2024
2060
  writeChunk(destination, renderState.segmentPrefix),
@@ -2033,19 +2069,20 @@ function writeEndSegment(destination, formatContext) {
2033
2069
  switch (formatContext.insertionMode) {
2034
2070
  case 0:
2035
2071
  case 1:
2072
+ case 3:
2036
2073
  case 2:
2037
2074
  return !!destination.write("</div>");
2038
- case 3:
2039
- return !!destination.write("</svg>");
2040
2075
  case 4:
2041
- return !!destination.write("</math>");
2076
+ return !!destination.write("</svg>");
2042
2077
  case 5:
2043
- return !!destination.write("</table>");
2078
+ return !!destination.write("</math>");
2044
2079
  case 6:
2045
- return !!destination.write("</tbody></table>");
2080
+ return !!destination.write("</table>");
2046
2081
  case 7:
2047
- return !!destination.write("</tr></table>");
2082
+ return !!destination.write("</tbody></table>");
2048
2083
  case 8:
2084
+ return !!destination.write("</tr></table>");
2085
+ case 9:
2049
2086
  return !!destination.write("</colgroup></table>");
2050
2087
  default:
2051
2088
  throw Error("Unknown insertion mode. This is a bug in React.");
@@ -3488,7 +3525,7 @@ function RequestInstance(
3488
3525
  this.status = 10;
3489
3526
  this.fatalError = null;
3490
3527
  this.pendingRootTasks = this.allPendingTasks = this.nextSegmentId = 0;
3491
- this.completedRootSegment = null;
3528
+ this.completedPreambleSegments = this.completedRootSegment = null;
3492
3529
  this.abortableTasks = abortSet;
3493
3530
  this.pingedTasks = [];
3494
3531
  this.clientRenderedBoundaries = [];
@@ -3547,6 +3584,7 @@ function createRequest(
3547
3584
  null,
3548
3585
  renderState,
3549
3586
  null,
3587
+ null,
3550
3588
  resumableState.abortableTasks,
3551
3589
  null,
3552
3590
  rootFormatContext,
@@ -3572,7 +3610,12 @@ function pingTask(request, task) {
3572
3610
  return performWork(request);
3573
3611
  }, 0));
3574
3612
  }
3575
- function createSuspenseBoundary(request, fallbackAbortableTasks) {
3613
+ function createSuspenseBoundary(
3614
+ request,
3615
+ fallbackAbortableTasks,
3616
+ contentPreamble,
3617
+ fallbackPreamble
3618
+ ) {
3576
3619
  return {
3577
3620
  status: 0,
3578
3621
  rootSegmentID: -1,
@@ -3584,6 +3627,8 @@ function createSuspenseBoundary(request, fallbackAbortableTasks) {
3584
3627
  errorDigest: null,
3585
3628
  contentState: createHoistableState(),
3586
3629
  fallbackState: createHoistableState(),
3630
+ contentPreamble: contentPreamble,
3631
+ fallbackPreamble: fallbackPreamble,
3587
3632
  trackedContentKeyPath: null,
3588
3633
  trackedFallbackNode: null
3589
3634
  };
@@ -3595,6 +3640,7 @@ function createRenderTask(
3595
3640
  childIndex,
3596
3641
  blockedBoundary,
3597
3642
  blockedSegment,
3643
+ blockedPreamble,
3598
3644
  hoistableState,
3599
3645
  abortSet,
3600
3646
  keyPath,
@@ -3617,6 +3663,7 @@ function createRenderTask(
3617
3663
  },
3618
3664
  blockedBoundary: blockedBoundary,
3619
3665
  blockedSegment: blockedSegment,
3666
+ blockedPreamble: blockedPreamble,
3620
3667
  hoistableState: hoistableState,
3621
3668
  abortSet: abortSet,
3622
3669
  keyPath: keyPath,
@@ -3660,6 +3707,7 @@ function createReplayTask(
3660
3707
  },
3661
3708
  blockedBoundary: blockedBoundary,
3662
3709
  blockedSegment: null,
3710
+ blockedPreamble: null,
3663
3711
  hoistableState: hoistableState,
3664
3712
  abortSet: abortSet,
3665
3713
  keyPath: keyPath,
@@ -3683,11 +3731,12 @@ function createPendingSegment(
3683
3731
  ) {
3684
3732
  return {
3685
3733
  status: 0,
3734
+ parentFlushed: !1,
3686
3735
  id: -1,
3687
3736
  index: index,
3688
- parentFlushed: !1,
3689
3737
  chunks: [],
3690
3738
  children: [],
3739
+ preambleChildren: [],
3691
3740
  parentFormatContext: parentFormatContext,
3692
3741
  boundary: boundary,
3693
3742
  lastPushedText: lastPushedText,
@@ -3915,12 +3964,13 @@ function renderElement(request, task, keyPath, type, props, ref) {
3915
3964
  (task.formatContext = defaultProps),
3916
3965
  (task.keyPath = initialState);
3917
3966
  else {
3918
- initialState = pushStartInstance(
3967
+ ref = pushStartInstance(
3919
3968
  newProps.chunks,
3920
3969
  type,
3921
3970
  props,
3922
3971
  request.resumableState,
3923
3972
  request.renderState,
3973
+ task.blockedPreamble,
3924
3974
  task.hoistableState,
3925
3975
  task.formatContext,
3926
3976
  newProps.lastPushedText,
@@ -3928,12 +3978,42 @@ function renderElement(request, task, keyPath, type, props, ref) {
3928
3978
  );
3929
3979
  newProps.lastPushedText = !1;
3930
3980
  defaultProps = task.formatContext;
3931
- ref = task.keyPath;
3932
- task.formatContext = getChildFormatContext(defaultProps, type, props);
3981
+ initialState = task.keyPath;
3933
3982
  task.keyPath = keyPath;
3934
- renderNode(request, task, initialState, -1);
3983
+ 3 ===
3984
+ (task.formatContext = getChildFormatContext(defaultProps, type, props))
3985
+ .insertionMode
3986
+ ? ((keyPath = createPendingSegment(
3987
+ request,
3988
+ 0,
3989
+ null,
3990
+ task.formatContext,
3991
+ !1,
3992
+ !1
3993
+ )),
3994
+ newProps.preambleChildren.push(keyPath),
3995
+ (keyPath = createRenderTask(
3996
+ request,
3997
+ null,
3998
+ ref,
3999
+ -1,
4000
+ task.blockedBoundary,
4001
+ keyPath,
4002
+ task.blockedPreamble,
4003
+ task.hoistableState,
4004
+ request.abortableTasks,
4005
+ task.keyPath,
4006
+ task.formatContext,
4007
+ task.context,
4008
+ task.treeContext,
4009
+ task.componentStack,
4010
+ task.isFallback
4011
+ )),
4012
+ pushComponentStack(keyPath),
4013
+ request.pingedTasks.push(keyPath))
4014
+ : renderNode(request, task, ref, -1);
3935
4015
  task.formatContext = defaultProps;
3936
- task.keyPath = ref;
4016
+ task.keyPath = initialState;
3937
4017
  a: {
3938
4018
  task = newProps.chunks;
3939
4019
  request = request.resumableState;
@@ -3968,6 +4048,9 @@ function renderElement(request, task, keyPath, type, props, ref) {
3968
4048
  request.hasHtml = !0;
3969
4049
  break a;
3970
4050
  }
4051
+ break;
4052
+ case "head":
4053
+ if (1 >= defaultProps.insertionMode) break a;
3971
4054
  }
3972
4055
  task.push(endChunkForTag(type));
3973
4056
  }
@@ -4012,25 +4095,34 @@ function renderElement(request, task, keyPath, type, props, ref) {
4012
4095
  }
4013
4096
  } else {
4014
4097
  type = task.keyPath;
4015
- var parentBoundary = task.blockedBoundary,
4016
- parentHoistableState = task.hoistableState;
4017
- ref = task.blockedSegment;
4018
- propName$33 = props.fallback;
4098
+ var parentBoundary = task.blockedBoundary;
4099
+ ref = task.blockedPreamble;
4100
+ var parentHoistableState = task.hoistableState;
4101
+ propName$33 = task.blockedSegment;
4102
+ propName = props.fallback;
4019
4103
  props = props.children;
4020
4104
  var fallbackAbortSet = new Set();
4021
- propName = createSuspenseBoundary(request, fallbackAbortSet);
4105
+ var newBoundary =
4106
+ 2 > task.formatContext.insertionMode
4107
+ ? createSuspenseBoundary(
4108
+ request,
4109
+ fallbackAbortSet,
4110
+ createPreambleState(),
4111
+ createPreambleState()
4112
+ )
4113
+ : createSuspenseBoundary(request, fallbackAbortSet, null, null);
4022
4114
  null !== request.trackedPostpones &&
4023
- (propName.trackedContentKeyPath = keyPath);
4115
+ (newBoundary.trackedContentKeyPath = keyPath);
4024
4116
  var boundarySegment = createPendingSegment(
4025
4117
  request,
4026
- ref.chunks.length,
4027
- propName,
4118
+ propName$33.chunks.length,
4119
+ newBoundary,
4028
4120
  task.formatContext,
4029
4121
  !1,
4030
4122
  !1
4031
4123
  );
4032
- ref.children.push(boundarySegment);
4033
- ref.lastPushedText = !1;
4124
+ propName$33.children.push(boundarySegment);
4125
+ propName$33.lastPushedText = !1;
4034
4126
  var contentRootSegment = createPendingSegment(
4035
4127
  request,
4036
4128
  0,
@@ -4044,12 +4136,13 @@ function renderElement(request, task, keyPath, type, props, ref) {
4044
4136
  newProps = [keyPath[0], "Suspense Fallback", keyPath[2]];
4045
4137
  defaultProps = [newProps[1], newProps[2], [], null];
4046
4138
  request.trackedPostpones.workingMap.set(newProps, defaultProps);
4047
- propName.trackedFallbackNode = defaultProps;
4139
+ newBoundary.trackedFallbackNode = defaultProps;
4048
4140
  task.blockedSegment = boundarySegment;
4141
+ task.blockedPreamble = newBoundary.fallbackPreamble;
4049
4142
  task.keyPath = newProps;
4050
4143
  boundarySegment.status = 6;
4051
4144
  try {
4052
- renderNode(request, task, propName$33, -1),
4145
+ renderNode(request, task, propName, -1),
4053
4146
  boundarySegment.lastPushedText &&
4054
4147
  boundarySegment.textEmbedded &&
4055
4148
  boundarySegment.chunks.push("\x3c!-- --\x3e"),
@@ -4060,16 +4153,19 @@ function renderElement(request, task, keyPath, type, props, ref) {
4060
4153
  thrownValue)
4061
4154
  );
4062
4155
  } finally {
4063
- (task.blockedSegment = ref), (task.keyPath = type);
4156
+ (task.blockedSegment = propName$33),
4157
+ (task.blockedPreamble = ref),
4158
+ (task.keyPath = type);
4064
4159
  }
4065
4160
  task = createRenderTask(
4066
4161
  request,
4067
4162
  null,
4068
4163
  props,
4069
4164
  -1,
4070
- propName,
4165
+ newBoundary,
4071
4166
  contentRootSegment,
4072
- propName.contentState,
4167
+ newBoundary.contentPreamble,
4168
+ newBoundary.contentState,
4073
4169
  task.abortSet,
4074
4170
  keyPath,
4075
4171
  task.formatContext,
@@ -4081,8 +4177,9 @@ function renderElement(request, task, keyPath, type, props, ref) {
4081
4177
  pushComponentStack(task);
4082
4178
  request.pingedTasks.push(task);
4083
4179
  } else {
4084
- task.blockedBoundary = propName;
4085
- task.hoistableState = propName.contentState;
4180
+ task.blockedBoundary = newBoundary;
4181
+ task.blockedPreamble = newBoundary.contentPreamble;
4182
+ task.hoistableState = newBoundary.contentState;
4086
4183
  task.blockedSegment = contentRootSegment;
4087
4184
  task.keyPath = keyPath;
4088
4185
  contentRootSegment.status = 6;
@@ -4093,14 +4190,17 @@ function renderElement(request, task, keyPath, type, props, ref) {
4093
4190
  contentRootSegment.textEmbedded &&
4094
4191
  contentRootSegment.chunks.push("\x3c!-- --\x3e"),
4095
4192
  (contentRootSegment.status = 1),
4096
- queueCompletedSegment(propName, contentRootSegment),
4097
- 0 === propName.pendingTasks && 0 === propName.status)
4193
+ queueCompletedSegment(newBoundary, contentRootSegment),
4194
+ 0 === newBoundary.pendingTasks && 0 === newBoundary.status)
4098
4195
  ) {
4099
- propName.status = 1;
4196
+ newBoundary.status = 1;
4197
+ 0 === request.pendingRootTasks &&
4198
+ task.blockedPreamble &&
4199
+ preparePreamble(request);
4100
4200
  break a;
4101
4201
  }
4102
4202
  } catch (thrownValue$28) {
4103
- (propName.status = 4),
4203
+ (newBoundary.status = 4),
4104
4204
  12 === request.status
4105
4205
  ? ((contentRootSegment.status = 3),
4106
4206
  (newProps = request.fatalError))
@@ -4112,22 +4212,24 @@ function renderElement(request, task, keyPath, type, props, ref) {
4112
4212
  newProps,
4113
4213
  defaultProps
4114
4214
  )),
4115
- (propName.errorDigest = initialState),
4116
- untrackBoundary(request, propName);
4215
+ (newBoundary.errorDigest = initialState),
4216
+ untrackBoundary(request, newBoundary);
4117
4217
  } finally {
4118
4218
  (task.blockedBoundary = parentBoundary),
4219
+ (task.blockedPreamble = ref),
4119
4220
  (task.hoistableState = parentHoistableState),
4120
- (task.blockedSegment = ref),
4221
+ (task.blockedSegment = propName$33),
4121
4222
  (task.keyPath = type);
4122
4223
  }
4123
4224
  task = createRenderTask(
4124
4225
  request,
4125
4226
  null,
4126
- propName$33,
4227
+ propName,
4127
4228
  -1,
4128
4229
  parentBoundary,
4129
4230
  boundarySegment,
4130
- propName.fallbackState,
4231
+ newBoundary.fallbackPreamble,
4232
+ newBoundary.fallbackState,
4131
4233
  fallbackAbortSet,
4132
4234
  [keyPath[0], "Suspense Fallback", keyPath[2]],
4133
4235
  task.formatContext,
@@ -4146,9 +4248,9 @@ function renderElement(request, task, keyPath, type, props, ref) {
4146
4248
  switch (type.$$typeof) {
4147
4249
  case REACT_FORWARD_REF_TYPE:
4148
4250
  if ("ref" in props)
4149
- for (boundarySegment in ((newProps = {}), props))
4150
- "ref" !== boundarySegment &&
4151
- (newProps[boundarySegment] = props[boundarySegment]);
4251
+ for (newBoundary in ((newProps = {}), props))
4252
+ "ref" !== newBoundary &&
4253
+ (newProps[newBoundary] = props[newBoundary]);
4152
4254
  else newProps = props;
4153
4255
  type = renderWithHooks(
4154
4256
  request,
@@ -4353,17 +4455,27 @@ function retryNode(request, task) {
4353
4455
  previousReplaySet = task.replay,
4354
4456
  parentBoundary = task.blockedBoundary,
4355
4457
  parentHoistableState = task.hoistableState,
4356
- content = props.children;
4357
- props = props.fallback;
4358
- var fallbackAbortSet = new Set(),
4359
- resumedBoundary = createSuspenseBoundary(
4360
- request,
4361
- fallbackAbortSet
4362
- );
4363
- resumedBoundary.parentFlushed = !0;
4364
- resumedBoundary.rootSegmentID = type;
4365
- task.blockedBoundary = resumedBoundary;
4366
- task.hoistableState = resumedBoundary.contentState;
4458
+ content = props.children,
4459
+ fallback = props.fallback,
4460
+ fallbackAbortSet = new Set();
4461
+ props =
4462
+ 2 > task.formatContext.insertionMode
4463
+ ? createSuspenseBoundary(
4464
+ request,
4465
+ fallbackAbortSet,
4466
+ createPreambleState(),
4467
+ createPreambleState()
4468
+ )
4469
+ : createSuspenseBoundary(
4470
+ request,
4471
+ fallbackAbortSet,
4472
+ null,
4473
+ null
4474
+ );
4475
+ props.parentFlushed = !0;
4476
+ props.rootSegmentID = type;
4477
+ task.blockedBoundary = props;
4478
+ task.hoistableState = props.contentState;
4367
4479
  task.keyPath = key;
4368
4480
  task.replay = {
4369
4481
  nodes: ref,
@@ -4380,27 +4492,22 @@ function retryNode(request, task) {
4380
4492
  "Couldn't find all resumable slots by key/index during replaying. The tree doesn't match so React will fallback to client rendering."
4381
4493
  );
4382
4494
  task.replay.pendingTasks--;
4383
- if (
4384
- 0 === resumedBoundary.pendingTasks &&
4385
- 0 === resumedBoundary.status
4386
- ) {
4387
- resumedBoundary.status = 1;
4388
- request.completedBoundaries.push(resumedBoundary);
4495
+ if (0 === props.pendingTasks && 0 === props.status) {
4496
+ props.status = 1;
4497
+ request.completedBoundaries.push(props);
4389
4498
  break b;
4390
4499
  }
4391
4500
  } catch (error) {
4392
- (resumedBoundary.status = 4),
4501
+ (props.status = 4),
4393
4502
  (childNodes = getThrownInfo(task.componentStack)),
4394
4503
  (replay = logRecoverableError(
4395
4504
  request,
4396
4505
  error,
4397
4506
  childNodes
4398
4507
  )),
4399
- (resumedBoundary.errorDigest = replay),
4508
+ (props.errorDigest = replay),
4400
4509
  task.replay.pendingTasks--,
4401
- request.clientRenderedBoundaries.push(
4402
- resumedBoundary
4403
- );
4510
+ request.clientRenderedBoundaries.push(props);
4404
4511
  } finally {
4405
4512
  (task.blockedBoundary = parentBoundary),
4406
4513
  (task.hoistableState = parentHoistableState),
@@ -4415,10 +4522,10 @@ function retryNode(request, task) {
4415
4522
  slots: node$jscomp$0,
4416
4523
  pendingTasks: 0
4417
4524
  },
4418
- props,
4525
+ fallback,
4419
4526
  -1,
4420
4527
  parentBoundary,
4421
- resumedBoundary.fallbackState,
4528
+ props.fallbackState,
4422
4529
  fallbackAbortSet,
4423
4530
  [key[0], "Suspense Fallback", key[2]],
4424
4531
  task.formatContext,
@@ -4634,6 +4741,7 @@ function spawnNewSuspendedRenderTask(request, task, thenableState) {
4634
4741
  task.childIndex,
4635
4742
  task.blockedBoundary,
4636
4743
  newSegment,
4744
+ task.blockedPreamble,
4637
4745
  task.hoistableState,
4638
4746
  task.abortSet,
4639
4747
  task.keyPath,
@@ -4767,7 +4875,12 @@ function abortRemainingReplayNodes(
4767
4875
  node = node[5];
4768
4876
  var request = request$jscomp$0,
4769
4877
  errorDigest = errorDigest$jscomp$0,
4770
- resumedBoundary = createSuspenseBoundary(request, new Set());
4878
+ resumedBoundary = createSuspenseBoundary(
4879
+ request,
4880
+ new Set(),
4881
+ null,
4882
+ null
4883
+ );
4771
4884
  resumedBoundary.parentFlushed = !0;
4772
4885
  resumedBoundary.rootSegmentID = node;
4773
4886
  resumedBoundary.status = 4;
@@ -4901,6 +5014,7 @@ function safelyEmitEarlyPreloads(request, shellComplete) {
4901
5014
  }
4902
5015
  function completeShell(request) {
4903
5016
  null === request.trackedPostpones && safelyEmitEarlyPreloads(request, !0);
5017
+ null === request.trackedPostpones && preparePreamble(request);
4904
5018
  request.onShellError = noop;
4905
5019
  request = request.onShellReady;
4906
5020
  request();
@@ -4913,6 +5027,7 @@ function completeAll(request) {
4913
5027
  : null === request.completedRootSegment ||
4914
5028
  5 !== request.completedRootSegment.status
4915
5029
  );
5030
+ preparePreamble(request);
4916
5031
  request = request.onAllReady;
4917
5032
  request();
4918
5033
  }
@@ -4953,7 +5068,11 @@ function finishedTask(request, boundary, segment) {
4953
5068
  request.completedBoundaries.push(boundary),
4954
5069
  1 === boundary.status &&
4955
5070
  (boundary.fallbackAbortableTasks.forEach(abortTaskSoft, request),
4956
- boundary.fallbackAbortableTasks.clear()))
5071
+ boundary.fallbackAbortableTasks.clear(),
5072
+ 0 === request.pendingRootTasks &&
5073
+ null === request.trackedPostpones &&
5074
+ null !== boundary.contentPreamble &&
5075
+ preparePreamble(request)))
4957
5076
  : null !== segment &&
4958
5077
  segment.parentFlushed &&
4959
5078
  1 === segment.status &&
@@ -5110,9 +5229,11 @@ function performWork(request$jscomp$2) {
5110
5229
  (boundary$jscomp$0.errorDigest = request$jscomp$0),
5111
5230
  untrackBoundary(request, boundary$jscomp$0),
5112
5231
  boundary$jscomp$0.parentFlushed &&
5113
- request.clientRenderedBoundaries.push(
5114
- boundary$jscomp$0
5115
- )));
5232
+ request.clientRenderedBoundaries.push(boundary$jscomp$0),
5233
+ 0 === request.pendingRootTasks &&
5234
+ null === request.trackedPostpones &&
5235
+ null !== boundary$jscomp$0.contentPreamble &&
5236
+ preparePreamble(request)));
5116
5237
  request.allPendingTasks--;
5117
5238
  0 === request.allPendingTasks && completeAll(request);
5118
5239
  }
@@ -5135,6 +5256,85 @@ function performWork(request$jscomp$2) {
5135
5256
  }
5136
5257
  }
5137
5258
  }
5259
+ function preparePreambleFromSubtree(
5260
+ request,
5261
+ segment,
5262
+ collectedPreambleSegments
5263
+ ) {
5264
+ segment.preambleChildren.length &&
5265
+ collectedPreambleSegments.push(segment.preambleChildren);
5266
+ for (var pendingPreambles = !1, i = 0; i < segment.children.length; i++)
5267
+ pendingPreambles =
5268
+ preparePreambleFromSegment(
5269
+ request,
5270
+ segment.children[i],
5271
+ collectedPreambleSegments
5272
+ ) || pendingPreambles;
5273
+ return pendingPreambles;
5274
+ }
5275
+ function preparePreambleFromSegment(
5276
+ request,
5277
+ segment,
5278
+ collectedPreambleSegments
5279
+ ) {
5280
+ var boundary = segment.boundary;
5281
+ if (null === boundary)
5282
+ return preparePreambleFromSubtree(
5283
+ request,
5284
+ segment,
5285
+ collectedPreambleSegments
5286
+ );
5287
+ var preamble = boundary.contentPreamble,
5288
+ fallbackPreamble = boundary.fallbackPreamble;
5289
+ if (null === preamble || null === fallbackPreamble) return !1;
5290
+ switch (boundary.status) {
5291
+ case 1:
5292
+ hoistPreambleState(request.renderState, preamble);
5293
+ segment = boundary.completedSegments[0];
5294
+ if (!segment)
5295
+ throw Error(
5296
+ "A previously unvisited boundary must have exactly one root segment. This is a bug in React."
5297
+ );
5298
+ return preparePreambleFromSubtree(
5299
+ request,
5300
+ segment,
5301
+ collectedPreambleSegments
5302
+ );
5303
+ case 5:
5304
+ if (null !== request.trackedPostpones) return !0;
5305
+ case 4:
5306
+ if (1 === segment.status)
5307
+ return (
5308
+ hoistPreambleState(request.renderState, fallbackPreamble),
5309
+ preparePreambleFromSubtree(
5310
+ request,
5311
+ segment,
5312
+ collectedPreambleSegments
5313
+ )
5314
+ );
5315
+ default:
5316
+ return !0;
5317
+ }
5318
+ }
5319
+ function preparePreamble(request) {
5320
+ if (
5321
+ request.completedRootSegment &&
5322
+ null === request.completedPreambleSegments
5323
+ ) {
5324
+ var collectedPreambleSegments = [],
5325
+ hasPendingPreambles = preparePreambleFromSegment(
5326
+ request,
5327
+ request.completedRootSegment,
5328
+ collectedPreambleSegments
5329
+ ),
5330
+ preamble = request.renderState.preamble;
5331
+ if (
5332
+ !1 === hasPendingPreambles ||
5333
+ (preamble.headChunks && preamble.bodyChunks)
5334
+ )
5335
+ request.completedPreambleSegments = collectedPreambleSegments;
5336
+ }
5337
+ }
5138
5338
  function flushSubtree(request, destination, segment, hoistableState) {
5139
5339
  segment.parentFlushed = !0;
5140
5340
  switch (segment.status) {
@@ -5343,9 +5543,12 @@ function flushCompletedQueues(request, destination) {
5343
5543
  completedRootSegment = request.completedRootSegment;
5344
5544
  if (null !== completedRootSegment) {
5345
5545
  if (5 === completedRootSegment.status) return;
5546
+ var completedPreambleSegments = request.completedPreambleSegments;
5547
+ if (null === completedPreambleSegments) return;
5346
5548
  var renderState = request.renderState,
5347
- htmlChunks = renderState.htmlChunks,
5348
- headChunks = renderState.headChunks,
5549
+ preamble = renderState.preamble,
5550
+ htmlChunks = preamble.htmlChunks,
5551
+ headChunks = preamble.headChunks,
5349
5552
  i$jscomp$0;
5350
5553
  if (htmlChunks) {
5351
5554
  for (i$jscomp$0 = 0; i$jscomp$0 < htmlChunks.length; i$jscomp$0++)
@@ -5386,10 +5589,27 @@ function flushCompletedQueues(request, destination) {
5386
5589
  var hoistableChunks = renderState.hoistableChunks;
5387
5590
  for (i$jscomp$0 = 0; i$jscomp$0 < hoistableChunks.length; i$jscomp$0++)
5388
5591
  writeChunk(destination, hoistableChunks[i$jscomp$0]);
5389
- hoistableChunks.length = 0;
5390
- htmlChunks &&
5391
- null === headChunks &&
5592
+ for (
5593
+ renderState = hoistableChunks.length = 0;
5594
+ renderState < completedPreambleSegments.length;
5595
+ renderState++
5596
+ ) {
5597
+ var segments = completedPreambleSegments[renderState];
5598
+ for (preamble = 0; preamble < segments.length; preamble++)
5599
+ flushSegment(request, destination, segments[preamble], null);
5600
+ }
5601
+ var preamble$jscomp$0 = request.renderState.preamble,
5602
+ headChunks$jscomp$0 = preamble$jscomp$0.headChunks;
5603
+ (preamble$jscomp$0.htmlChunks || headChunks$jscomp$0) &&
5392
5604
  writeChunk(destination, endChunkForTag("head"));
5605
+ var bodyChunks = preamble$jscomp$0.bodyChunks;
5606
+ if (bodyChunks)
5607
+ for (
5608
+ completedPreambleSegments = 0;
5609
+ completedPreambleSegments < bodyChunks.length;
5610
+ completedPreambleSegments++
5611
+ )
5612
+ writeChunk(destination, bodyChunks[completedPreambleSegments]);
5393
5613
  flushSegment(request, destination, completedRootSegment, null);
5394
5614
  request.completedRootSegment = null;
5395
5615
  writeBootstrap(destination, request.renderState);
@@ -5589,15 +5809,15 @@ function abort(request, reason) {
5589
5809
  logRecoverableError(request, error$53, {}), fatalError(request, error$53);
5590
5810
  }
5591
5811
  }
5592
- var isomorphicReactPackageVersion$jscomp$inline_728 = React.version;
5812
+ var isomorphicReactPackageVersion$jscomp$inline_751 = React.version;
5593
5813
  if (
5594
- "19.1.0-canary-d46b04a2-20250117" !==
5595
- isomorphicReactPackageVersion$jscomp$inline_728
5814
+ "19.1.0-canary-9b62ee71-20250122" !==
5815
+ isomorphicReactPackageVersion$jscomp$inline_751
5596
5816
  )
5597
5817
  throw Error(
5598
5818
  'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
5599
- (isomorphicReactPackageVersion$jscomp$inline_728 +
5600
- "\n - react-dom: 19.1.0-canary-d46b04a2-20250117\nLearn more: https://react.dev/warnings/version-mismatch")
5819
+ (isomorphicReactPackageVersion$jscomp$inline_751 +
5820
+ "\n - react-dom: 19.1.0-canary-9b62ee71-20250122\nLearn more: https://react.dev/warnings/version-mismatch")
5601
5821
  );
5602
5822
  exports.renderToReadableStream = function (children, options) {
5603
5823
  return new Promise(function (resolve, reject) {
@@ -5688,4 +5908,4 @@ exports.renderToReadableStream = function (children, options) {
5688
5908
  startWork(request);
5689
5909
  });
5690
5910
  };
5691
- exports.version = "19.1.0-canary-d46b04a2-20250117";
5911
+ exports.version = "19.1.0-canary-9b62ee71-20250122";