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.
@@ -438,8 +438,7 @@ function createRenderState(
438
438
  segmentPrefix: stringToPrecomputedChunk(idPrefix + "S:"),
439
439
  boundaryPrefix: stringToPrecomputedChunk(idPrefix + "B:"),
440
440
  startInlineScript: inlineScriptWithNonce,
441
- htmlChunks: null,
442
- headChunks: null,
441
+ preamble: createPreambleState(),
443
442
  externalRuntimeScript: null,
444
443
  bootstrapChunks: externalRuntimeConfig,
445
444
  importMapChunks: bootstrapScriptContent,
@@ -606,6 +605,9 @@ function createResumableState(
606
605
  moduleScriptResources: {}
607
606
  };
608
607
  }
608
+ function createPreambleState() {
609
+ return { htmlChunks: null, headChunks: null, bodyChunks: null };
610
+ }
609
611
  function createFormatContext(insertionMode, selectedValue, tagScope) {
610
612
  return {
611
613
  insertionMode: insertionMode,
@@ -616,9 +618,9 @@ function createFormatContext(insertionMode, selectedValue, tagScope) {
616
618
  function createRootFormatContext(namespaceURI) {
617
619
  return createFormatContext(
618
620
  "http://www.w3.org/2000/svg" === namespaceURI
619
- ? 3
621
+ ? 4
620
622
  : "http://www.w3.org/1998/Math/MathML" === namespaceURI
621
- ? 4
623
+ ? 5
622
624
  : 0,
623
625
  null,
624
626
  0
@@ -635,33 +637,34 @@ function getChildFormatContext(parentContext, type, props) {
635
637
  parentContext.tagScope
636
638
  );
637
639
  case "svg":
638
- return createFormatContext(3, null, parentContext.tagScope);
640
+ return createFormatContext(4, null, parentContext.tagScope);
639
641
  case "picture":
640
642
  return createFormatContext(2, null, parentContext.tagScope | 2);
641
643
  case "math":
642
- return createFormatContext(4, null, parentContext.tagScope);
644
+ return createFormatContext(5, null, parentContext.tagScope);
643
645
  case "foreignObject":
644
646
  return createFormatContext(2, null, parentContext.tagScope);
645
647
  case "table":
646
- return createFormatContext(5, null, parentContext.tagScope);
648
+ return createFormatContext(6, null, parentContext.tagScope);
647
649
  case "thead":
648
650
  case "tbody":
649
651
  case "tfoot":
650
- return createFormatContext(6, null, parentContext.tagScope);
652
+ return createFormatContext(7, null, parentContext.tagScope);
651
653
  case "colgroup":
652
- return createFormatContext(8, null, parentContext.tagScope);
654
+ return createFormatContext(9, null, parentContext.tagScope);
653
655
  case "tr":
654
- return createFormatContext(7, null, parentContext.tagScope);
656
+ return createFormatContext(8, null, parentContext.tagScope);
657
+ case "head":
658
+ if (2 > parentContext.insertionMode)
659
+ return createFormatContext(3, null, parentContext.tagScope);
660
+ break;
661
+ case "html":
662
+ if (0 === parentContext.insertionMode)
663
+ return createFormatContext(1, null, parentContext.tagScope);
655
664
  }
656
- return 5 <= parentContext.insertionMode
665
+ return 6 <= parentContext.insertionMode || 2 > parentContext.insertionMode
657
666
  ? createFormatContext(2, null, parentContext.tagScope)
658
- : 0 === parentContext.insertionMode
659
- ? "html" === type
660
- ? createFormatContext(1, null, parentContext.tagScope)
661
- : createFormatContext(2, null, parentContext.tagScope)
662
- : 1 === parentContext.insertionMode
663
- ? createFormatContext(2, null, parentContext.tagScope)
664
- : parentContext;
667
+ : parentContext;
665
668
  }
666
669
  var textSeparator = stringToPrecomputedChunk("\x3c!-- --\x3e");
667
670
  function pushTextInstance(target, text, renderState, textEmbedded) {
@@ -1216,6 +1219,7 @@ function pushStartInstance(
1216
1219
  props,
1217
1220
  resumableState,
1218
1221
  renderState,
1222
+ preambleState,
1219
1223
  hoistableState,
1220
1224
  formatContext,
1221
1225
  textEmbedded,
@@ -1694,7 +1698,7 @@ function pushStartInstance(
1694
1698
  return JSCompiler_inline_result$jscomp$2;
1695
1699
  case "title":
1696
1700
  if (
1697
- 3 === formatContext.insertionMode ||
1701
+ 4 === formatContext.insertionMode ||
1698
1702
  formatContext.tagScope & 1 ||
1699
1703
  null != props.itemProp
1700
1704
  )
@@ -1713,7 +1717,7 @@ function pushStartInstance(
1713
1717
  href = props.href,
1714
1718
  precedence = props.precedence;
1715
1719
  if (
1716
- 3 === formatContext.insertionMode ||
1720
+ 4 === formatContext.insertionMode ||
1717
1721
  formatContext.tagScope & 1 ||
1718
1722
  null != props.itemProp ||
1719
1723
  "string" !== typeof rel ||
@@ -1795,7 +1799,7 @@ function pushStartInstance(
1795
1799
  "symbol" === typeof asyncProp ||
1796
1800
  props.onLoad ||
1797
1801
  props.onError ||
1798
- 3 === formatContext.insertionMode ||
1802
+ 4 === formatContext.insertionMode ||
1799
1803
  formatContext.tagScope & 1 ||
1800
1804
  null != props.itemProp
1801
1805
  )
@@ -1836,7 +1840,7 @@ function pushStartInstance(
1836
1840
  var precedence$jscomp$0 = props.precedence,
1837
1841
  href$jscomp$0 = props.href;
1838
1842
  if (
1839
- 3 === formatContext.insertionMode ||
1843
+ 4 === formatContext.insertionMode ||
1840
1844
  formatContext.tagScope & 1 ||
1841
1845
  null != props.itemProp ||
1842
1846
  "string" !== typeof precedence$jscomp$0 ||
@@ -1945,7 +1949,7 @@ function pushStartInstance(
1945
1949
  return JSCompiler_inline_result$jscomp$6;
1946
1950
  case "meta":
1947
1951
  if (
1948
- 3 === formatContext.insertionMode ||
1952
+ 4 === formatContext.insertionMode ||
1949
1953
  formatContext.tagScope & 1 ||
1950
1954
  null != props.itemProp
1951
1955
  )
@@ -2118,10 +2122,13 @@ function pushStartInstance(
2118
2122
  case "missing-glyph":
2119
2123
  break;
2120
2124
  case "head":
2121
- if (2 > formatContext.insertionMode && null === renderState.headChunks) {
2122
- renderState.headChunks = [];
2125
+ if (2 > formatContext.insertionMode) {
2126
+ var preamble = preambleState || renderState.preamble;
2127
+ if (preamble.headChunks)
2128
+ throw Error(formatProdErrorMessage(545, "`<head>`"));
2129
+ preamble.headChunks = [];
2123
2130
  var JSCompiler_inline_result$jscomp$9 = pushStartGenericElement(
2124
- renderState.headChunks,
2131
+ preamble.headChunks,
2125
2132
  props,
2126
2133
  "head"
2127
2134
  );
@@ -2132,24 +2139,42 @@ function pushStartInstance(
2132
2139
  "head"
2133
2140
  );
2134
2141
  return JSCompiler_inline_result$jscomp$9;
2135
- case "html":
2136
- if (
2137
- 0 === formatContext.insertionMode &&
2138
- null === renderState.htmlChunks
2139
- ) {
2140
- renderState.htmlChunks = [doctypeChunk];
2142
+ case "body":
2143
+ if (2 > formatContext.insertionMode) {
2144
+ var preamble$jscomp$0 = preambleState || renderState.preamble;
2145
+ if (preamble$jscomp$0.bodyChunks)
2146
+ throw Error(formatProdErrorMessage(545, "`<body>`"));
2147
+ preamble$jscomp$0.bodyChunks = [];
2141
2148
  var JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
2142
- renderState.htmlChunks,
2149
+ preamble$jscomp$0.bodyChunks,
2143
2150
  props,
2144
- "html"
2151
+ "body"
2145
2152
  );
2146
2153
  } else
2147
2154
  JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
2148
2155
  target$jscomp$0,
2149
2156
  props,
2150
- "html"
2157
+ "body"
2151
2158
  );
2152
2159
  return JSCompiler_inline_result$jscomp$10;
2160
+ case "html":
2161
+ if (0 === formatContext.insertionMode) {
2162
+ var preamble$jscomp$1 = preambleState || renderState.preamble;
2163
+ if (preamble$jscomp$1.htmlChunks)
2164
+ throw Error(formatProdErrorMessage(545, "`<html>`"));
2165
+ preamble$jscomp$1.htmlChunks = [doctypeChunk];
2166
+ var JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
2167
+ preamble$jscomp$1.htmlChunks,
2168
+ props,
2169
+ "html"
2170
+ );
2171
+ } else
2172
+ JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
2173
+ target$jscomp$0,
2174
+ props,
2175
+ "html"
2176
+ );
2177
+ return JSCompiler_inline_result$jscomp$11;
2153
2178
  default:
2154
2179
  if (-1 !== type.indexOf("-")) {
2155
2180
  target$jscomp$0.push(startChunkForTag(type));
@@ -2212,6 +2237,15 @@ function endChunkForTag(tag) {
2212
2237
  endTagCache.set(tag, chunk));
2213
2238
  return chunk;
2214
2239
  }
2240
+ function hoistPreambleState(renderState, preambleState) {
2241
+ renderState = renderState.preamble;
2242
+ null === renderState.htmlChunks &&
2243
+ (renderState.htmlChunks = preambleState.htmlChunks);
2244
+ null === renderState.headChunks &&
2245
+ (renderState.headChunks = preambleState.headChunks);
2246
+ null === renderState.bodyChunks &&
2247
+ (renderState.bodyChunks = preambleState.bodyChunks);
2248
+ }
2215
2249
  function writeBootstrap(destination, renderState) {
2216
2250
  renderState = renderState.bootstrapChunks;
2217
2251
  for (var i = 0; i < renderState.length - 1; i++)
@@ -2280,6 +2314,7 @@ function writeStartSegment(destination, renderState, formatContext, id) {
2280
2314
  switch (formatContext.insertionMode) {
2281
2315
  case 0:
2282
2316
  case 1:
2317
+ case 3:
2283
2318
  case 2:
2284
2319
  return (
2285
2320
  writeChunk(destination, startSegmentHTML),
@@ -2287,42 +2322,42 @@ function writeStartSegment(destination, renderState, formatContext, id) {
2287
2322
  writeChunk(destination, stringToChunk(id.toString(16))),
2288
2323
  writeChunkAndReturn(destination, startSegmentHTML2)
2289
2324
  );
2290
- case 3:
2325
+ case 4:
2291
2326
  return (
2292
2327
  writeChunk(destination, startSegmentSVG),
2293
2328
  writeChunk(destination, renderState.segmentPrefix),
2294
2329
  writeChunk(destination, stringToChunk(id.toString(16))),
2295
2330
  writeChunkAndReturn(destination, startSegmentSVG2)
2296
2331
  );
2297
- case 4:
2332
+ case 5:
2298
2333
  return (
2299
2334
  writeChunk(destination, startSegmentMathML),
2300
2335
  writeChunk(destination, renderState.segmentPrefix),
2301
2336
  writeChunk(destination, stringToChunk(id.toString(16))),
2302
2337
  writeChunkAndReturn(destination, startSegmentMathML2)
2303
2338
  );
2304
- case 5:
2339
+ case 6:
2305
2340
  return (
2306
2341
  writeChunk(destination, startSegmentTable),
2307
2342
  writeChunk(destination, renderState.segmentPrefix),
2308
2343
  writeChunk(destination, stringToChunk(id.toString(16))),
2309
2344
  writeChunkAndReturn(destination, startSegmentTable2)
2310
2345
  );
2311
- case 6:
2346
+ case 7:
2312
2347
  return (
2313
2348
  writeChunk(destination, startSegmentTableBody),
2314
2349
  writeChunk(destination, renderState.segmentPrefix),
2315
2350
  writeChunk(destination, stringToChunk(id.toString(16))),
2316
2351
  writeChunkAndReturn(destination, startSegmentTableBody2)
2317
2352
  );
2318
- case 7:
2353
+ case 8:
2319
2354
  return (
2320
2355
  writeChunk(destination, startSegmentTableRow),
2321
2356
  writeChunk(destination, renderState.segmentPrefix),
2322
2357
  writeChunk(destination, stringToChunk(id.toString(16))),
2323
2358
  writeChunkAndReturn(destination, startSegmentTableRow2)
2324
2359
  );
2325
- case 8:
2360
+ case 9:
2326
2361
  return (
2327
2362
  writeChunk(destination, startSegmentColGroup),
2328
2363
  writeChunk(destination, renderState.segmentPrefix),
@@ -2337,19 +2372,20 @@ function writeEndSegment(destination, formatContext) {
2337
2372
  switch (formatContext.insertionMode) {
2338
2373
  case 0:
2339
2374
  case 1:
2375
+ case 3:
2340
2376
  case 2:
2341
2377
  return writeChunkAndReturn(destination, endSegmentHTML);
2342
- case 3:
2343
- return writeChunkAndReturn(destination, endSegmentSVG);
2344
2378
  case 4:
2345
- return writeChunkAndReturn(destination, endSegmentMathML);
2379
+ return writeChunkAndReturn(destination, endSegmentSVG);
2346
2380
  case 5:
2347
- return writeChunkAndReturn(destination, endSegmentTable);
2381
+ return writeChunkAndReturn(destination, endSegmentMathML);
2348
2382
  case 6:
2349
- return writeChunkAndReturn(destination, endSegmentTableBody);
2383
+ return writeChunkAndReturn(destination, endSegmentTable);
2350
2384
  case 7:
2351
- return writeChunkAndReturn(destination, endSegmentTableRow);
2385
+ return writeChunkAndReturn(destination, endSegmentTableBody);
2352
2386
  case 8:
2387
+ return writeChunkAndReturn(destination, endSegmentTableRow);
2388
+ case 9:
2353
2389
  return writeChunkAndReturn(destination, endSegmentColGroup);
2354
2390
  default:
2355
2391
  throw Error(formatProdErrorMessage(397));
@@ -3831,7 +3867,7 @@ function RequestInstance(
3831
3867
  this.status = 10;
3832
3868
  this.fatalError = null;
3833
3869
  this.pendingRootTasks = this.allPendingTasks = this.nextSegmentId = 0;
3834
- this.completedRootSegment = null;
3870
+ this.completedPreambleSegments = this.completedRootSegment = null;
3835
3871
  this.abortableTasks = abortSet;
3836
3872
  this.pingedTasks = [];
3837
3873
  this.clientRenderedBoundaries = [];
@@ -3890,6 +3926,7 @@ function createRequest(
3890
3926
  null,
3891
3927
  renderState,
3892
3928
  null,
3929
+ null,
3893
3930
  resumableState.abortableTasks,
3894
3931
  null,
3895
3932
  rootFormatContext,
@@ -3949,7 +3986,12 @@ function pingTask(request, task) {
3949
3986
  return performWork(request);
3950
3987
  }));
3951
3988
  }
3952
- function createSuspenseBoundary(request, fallbackAbortableTasks) {
3989
+ function createSuspenseBoundary(
3990
+ request,
3991
+ fallbackAbortableTasks,
3992
+ contentPreamble,
3993
+ fallbackPreamble
3994
+ ) {
3953
3995
  return {
3954
3996
  status: 0,
3955
3997
  rootSegmentID: -1,
@@ -3961,6 +4003,8 @@ function createSuspenseBoundary(request, fallbackAbortableTasks) {
3961
4003
  errorDigest: null,
3962
4004
  contentState: createHoistableState(),
3963
4005
  fallbackState: createHoistableState(),
4006
+ contentPreamble: contentPreamble,
4007
+ fallbackPreamble: fallbackPreamble,
3964
4008
  trackedContentKeyPath: null,
3965
4009
  trackedFallbackNode: null
3966
4010
  };
@@ -3972,6 +4016,7 @@ function createRenderTask(
3972
4016
  childIndex,
3973
4017
  blockedBoundary,
3974
4018
  blockedSegment,
4019
+ blockedPreamble,
3975
4020
  hoistableState,
3976
4021
  abortSet,
3977
4022
  keyPath,
@@ -3994,6 +4039,7 @@ function createRenderTask(
3994
4039
  },
3995
4040
  blockedBoundary: blockedBoundary,
3996
4041
  blockedSegment: blockedSegment,
4042
+ blockedPreamble: blockedPreamble,
3997
4043
  hoistableState: hoistableState,
3998
4044
  abortSet: abortSet,
3999
4045
  keyPath: keyPath,
@@ -4037,6 +4083,7 @@ function createReplayTask(
4037
4083
  },
4038
4084
  blockedBoundary: blockedBoundary,
4039
4085
  blockedSegment: null,
4086
+ blockedPreamble: null,
4040
4087
  hoistableState: hoistableState,
4041
4088
  abortSet: abortSet,
4042
4089
  keyPath: keyPath,
@@ -4060,11 +4107,12 @@ function createPendingSegment(
4060
4107
  ) {
4061
4108
  return {
4062
4109
  status: 0,
4110
+ parentFlushed: !1,
4063
4111
  id: -1,
4064
4112
  index: index,
4065
- parentFlushed: !1,
4066
4113
  chunks: [],
4067
4114
  children: [],
4115
+ preambleChildren: [],
4068
4116
  parentFormatContext: parentFormatContext,
4069
4117
  boundary: boundary,
4070
4118
  lastPushedText: lastPushedText,
@@ -4292,12 +4340,13 @@ function renderElement(request, task, keyPath, type, props, ref) {
4292
4340
  (task.formatContext = defaultProps),
4293
4341
  (task.keyPath = initialState);
4294
4342
  else {
4295
- initialState = pushStartInstance(
4343
+ ref = pushStartInstance(
4296
4344
  newProps.chunks,
4297
4345
  type,
4298
4346
  props,
4299
4347
  request.resumableState,
4300
4348
  request.renderState,
4349
+ task.blockedPreamble,
4301
4350
  task.hoistableState,
4302
4351
  task.formatContext,
4303
4352
  newProps.lastPushedText,
@@ -4305,12 +4354,42 @@ function renderElement(request, task, keyPath, type, props, ref) {
4305
4354
  );
4306
4355
  newProps.lastPushedText = !1;
4307
4356
  defaultProps = task.formatContext;
4308
- ref = task.keyPath;
4309
- task.formatContext = getChildFormatContext(defaultProps, type, props);
4357
+ initialState = task.keyPath;
4310
4358
  task.keyPath = keyPath;
4311
- renderNode(request, task, initialState, -1);
4359
+ 3 ===
4360
+ (task.formatContext = getChildFormatContext(defaultProps, type, props))
4361
+ .insertionMode
4362
+ ? ((keyPath = createPendingSegment(
4363
+ request,
4364
+ 0,
4365
+ null,
4366
+ task.formatContext,
4367
+ !1,
4368
+ !1
4369
+ )),
4370
+ newProps.preambleChildren.push(keyPath),
4371
+ (keyPath = createRenderTask(
4372
+ request,
4373
+ null,
4374
+ ref,
4375
+ -1,
4376
+ task.blockedBoundary,
4377
+ keyPath,
4378
+ task.blockedPreamble,
4379
+ task.hoistableState,
4380
+ request.abortableTasks,
4381
+ task.keyPath,
4382
+ task.formatContext,
4383
+ task.context,
4384
+ task.treeContext,
4385
+ task.componentStack,
4386
+ task.isFallback
4387
+ )),
4388
+ pushComponentStack(keyPath),
4389
+ request.pingedTasks.push(keyPath))
4390
+ : renderNode(request, task, ref, -1);
4312
4391
  task.formatContext = defaultProps;
4313
- task.keyPath = ref;
4392
+ task.keyPath = initialState;
4314
4393
  a: {
4315
4394
  task = newProps.chunks;
4316
4395
  request = request.resumableState;
@@ -4345,6 +4424,9 @@ function renderElement(request, task, keyPath, type, props, ref) {
4345
4424
  request.hasHtml = !0;
4346
4425
  break a;
4347
4426
  }
4427
+ break;
4428
+ case "head":
4429
+ if (1 >= defaultProps.insertionMode) break a;
4348
4430
  }
4349
4431
  task.push(endChunkForTag(type));
4350
4432
  }
@@ -4389,25 +4471,34 @@ function renderElement(request, task, keyPath, type, props, ref) {
4389
4471
  }
4390
4472
  } else {
4391
4473
  type = task.keyPath;
4392
- var parentBoundary = task.blockedBoundary,
4393
- parentHoistableState = task.hoistableState;
4394
- ref = task.blockedSegment;
4395
- propName$33 = props.fallback;
4474
+ var parentBoundary = task.blockedBoundary;
4475
+ ref = task.blockedPreamble;
4476
+ var parentHoistableState = task.hoistableState;
4477
+ propName$33 = task.blockedSegment;
4478
+ propName = props.fallback;
4396
4479
  props = props.children;
4397
4480
  var fallbackAbortSet = new Set();
4398
- propName = createSuspenseBoundary(request, fallbackAbortSet);
4481
+ var newBoundary =
4482
+ 2 > task.formatContext.insertionMode
4483
+ ? createSuspenseBoundary(
4484
+ request,
4485
+ fallbackAbortSet,
4486
+ createPreambleState(),
4487
+ createPreambleState()
4488
+ )
4489
+ : createSuspenseBoundary(request, fallbackAbortSet, null, null);
4399
4490
  null !== request.trackedPostpones &&
4400
- (propName.trackedContentKeyPath = keyPath);
4491
+ (newBoundary.trackedContentKeyPath = keyPath);
4401
4492
  var boundarySegment = createPendingSegment(
4402
4493
  request,
4403
- ref.chunks.length,
4404
- propName,
4494
+ propName$33.chunks.length,
4495
+ newBoundary,
4405
4496
  task.formatContext,
4406
4497
  !1,
4407
4498
  !1
4408
4499
  );
4409
- ref.children.push(boundarySegment);
4410
- ref.lastPushedText = !1;
4500
+ propName$33.children.push(boundarySegment);
4501
+ propName$33.lastPushedText = !1;
4411
4502
  var contentRootSegment = createPendingSegment(
4412
4503
  request,
4413
4504
  0,
@@ -4421,12 +4512,13 @@ function renderElement(request, task, keyPath, type, props, ref) {
4421
4512
  newProps = [keyPath[0], "Suspense Fallback", keyPath[2]];
4422
4513
  defaultProps = [newProps[1], newProps[2], [], null];
4423
4514
  request.trackedPostpones.workingMap.set(newProps, defaultProps);
4424
- propName.trackedFallbackNode = defaultProps;
4515
+ newBoundary.trackedFallbackNode = defaultProps;
4425
4516
  task.blockedSegment = boundarySegment;
4517
+ task.blockedPreamble = newBoundary.fallbackPreamble;
4426
4518
  task.keyPath = newProps;
4427
4519
  boundarySegment.status = 6;
4428
4520
  try {
4429
- renderNode(request, task, propName$33, -1),
4521
+ renderNode(request, task, propName, -1),
4430
4522
  boundarySegment.lastPushedText &&
4431
4523
  boundarySegment.textEmbedded &&
4432
4524
  boundarySegment.chunks.push(textSeparator),
@@ -4437,16 +4529,19 @@ function renderElement(request, task, keyPath, type, props, ref) {
4437
4529
  thrownValue)
4438
4530
  );
4439
4531
  } finally {
4440
- (task.blockedSegment = ref), (task.keyPath = type);
4532
+ (task.blockedSegment = propName$33),
4533
+ (task.blockedPreamble = ref),
4534
+ (task.keyPath = type);
4441
4535
  }
4442
4536
  task = createRenderTask(
4443
4537
  request,
4444
4538
  null,
4445
4539
  props,
4446
4540
  -1,
4447
- propName,
4541
+ newBoundary,
4448
4542
  contentRootSegment,
4449
- propName.contentState,
4543
+ newBoundary.contentPreamble,
4544
+ newBoundary.contentState,
4450
4545
  task.abortSet,
4451
4546
  keyPath,
4452
4547
  task.formatContext,
@@ -4458,8 +4553,9 @@ function renderElement(request, task, keyPath, type, props, ref) {
4458
4553
  pushComponentStack(task);
4459
4554
  request.pingedTasks.push(task);
4460
4555
  } else {
4461
- task.blockedBoundary = propName;
4462
- task.hoistableState = propName.contentState;
4556
+ task.blockedBoundary = newBoundary;
4557
+ task.blockedPreamble = newBoundary.contentPreamble;
4558
+ task.hoistableState = newBoundary.contentState;
4463
4559
  task.blockedSegment = contentRootSegment;
4464
4560
  task.keyPath = keyPath;
4465
4561
  contentRootSegment.status = 6;
@@ -4470,14 +4566,17 @@ function renderElement(request, task, keyPath, type, props, ref) {
4470
4566
  contentRootSegment.textEmbedded &&
4471
4567
  contentRootSegment.chunks.push(textSeparator),
4472
4568
  (contentRootSegment.status = 1),
4473
- queueCompletedSegment(propName, contentRootSegment),
4474
- 0 === propName.pendingTasks && 0 === propName.status)
4569
+ queueCompletedSegment(newBoundary, contentRootSegment),
4570
+ 0 === newBoundary.pendingTasks && 0 === newBoundary.status)
4475
4571
  ) {
4476
- propName.status = 1;
4572
+ newBoundary.status = 1;
4573
+ 0 === request.pendingRootTasks &&
4574
+ task.blockedPreamble &&
4575
+ preparePreamble(request);
4477
4576
  break a;
4478
4577
  }
4479
4578
  } catch (thrownValue$28) {
4480
- (propName.status = 4),
4579
+ (newBoundary.status = 4),
4481
4580
  12 === request.status
4482
4581
  ? ((contentRootSegment.status = 3),
4483
4582
  (newProps = request.fatalError))
@@ -4489,22 +4588,24 @@ function renderElement(request, task, keyPath, type, props, ref) {
4489
4588
  newProps,
4490
4589
  defaultProps
4491
4590
  )),
4492
- (propName.errorDigest = initialState),
4493
- untrackBoundary(request, propName);
4591
+ (newBoundary.errorDigest = initialState),
4592
+ untrackBoundary(request, newBoundary);
4494
4593
  } finally {
4495
4594
  (task.blockedBoundary = parentBoundary),
4595
+ (task.blockedPreamble = ref),
4496
4596
  (task.hoistableState = parentHoistableState),
4497
- (task.blockedSegment = ref),
4597
+ (task.blockedSegment = propName$33),
4498
4598
  (task.keyPath = type);
4499
4599
  }
4500
4600
  task = createRenderTask(
4501
4601
  request,
4502
4602
  null,
4503
- propName$33,
4603
+ propName,
4504
4604
  -1,
4505
4605
  parentBoundary,
4506
4606
  boundarySegment,
4507
- propName.fallbackState,
4607
+ newBoundary.fallbackPreamble,
4608
+ newBoundary.fallbackState,
4508
4609
  fallbackAbortSet,
4509
4610
  [keyPath[0], "Suspense Fallback", keyPath[2]],
4510
4611
  task.formatContext,
@@ -4523,9 +4624,9 @@ function renderElement(request, task, keyPath, type, props, ref) {
4523
4624
  switch (type.$$typeof) {
4524
4625
  case REACT_FORWARD_REF_TYPE:
4525
4626
  if ("ref" in props)
4526
- for (boundarySegment in ((newProps = {}), props))
4527
- "ref" !== boundarySegment &&
4528
- (newProps[boundarySegment] = props[boundarySegment]);
4627
+ for (newBoundary in ((newProps = {}), props))
4628
+ "ref" !== newBoundary &&
4629
+ (newProps[newBoundary] = props[newBoundary]);
4529
4630
  else newProps = props;
4530
4631
  type = renderWithHooks(
4531
4632
  request,
@@ -4722,17 +4823,27 @@ function retryNode(request, task) {
4722
4823
  previousReplaySet = task.replay,
4723
4824
  parentBoundary = task.blockedBoundary,
4724
4825
  parentHoistableState = task.hoistableState,
4725
- content = props.children;
4726
- props = props.fallback;
4727
- var fallbackAbortSet = new Set(),
4728
- resumedBoundary = createSuspenseBoundary(
4729
- request,
4730
- fallbackAbortSet
4731
- );
4732
- resumedBoundary.parentFlushed = !0;
4733
- resumedBoundary.rootSegmentID = type;
4734
- task.blockedBoundary = resumedBoundary;
4735
- task.hoistableState = resumedBoundary.contentState;
4826
+ content = props.children,
4827
+ fallback = props.fallback,
4828
+ fallbackAbortSet = new Set();
4829
+ props =
4830
+ 2 > task.formatContext.insertionMode
4831
+ ? createSuspenseBoundary(
4832
+ request,
4833
+ fallbackAbortSet,
4834
+ createPreambleState(),
4835
+ createPreambleState()
4836
+ )
4837
+ : createSuspenseBoundary(
4838
+ request,
4839
+ fallbackAbortSet,
4840
+ null,
4841
+ null
4842
+ );
4843
+ props.parentFlushed = !0;
4844
+ props.rootSegmentID = type;
4845
+ task.blockedBoundary = props;
4846
+ task.hoistableState = props.contentState;
4736
4847
  task.keyPath = key;
4737
4848
  task.replay = {
4738
4849
  nodes: ref,
@@ -4747,27 +4858,22 @@ function retryNode(request, task) {
4747
4858
  )
4748
4859
  throw Error(formatProdErrorMessage(488));
4749
4860
  task.replay.pendingTasks--;
4750
- if (
4751
- 0 === resumedBoundary.pendingTasks &&
4752
- 0 === resumedBoundary.status
4753
- ) {
4754
- resumedBoundary.status = 1;
4755
- request.completedBoundaries.push(resumedBoundary);
4861
+ if (0 === props.pendingTasks && 0 === props.status) {
4862
+ props.status = 1;
4863
+ request.completedBoundaries.push(props);
4756
4864
  break b;
4757
4865
  }
4758
4866
  } catch (error) {
4759
- (resumedBoundary.status = 4),
4867
+ (props.status = 4),
4760
4868
  (childNodes = getThrownInfo(task.componentStack)),
4761
4869
  (replay = logRecoverableError(
4762
4870
  request,
4763
4871
  error,
4764
4872
  childNodes
4765
4873
  )),
4766
- (resumedBoundary.errorDigest = replay),
4874
+ (props.errorDigest = replay),
4767
4875
  task.replay.pendingTasks--,
4768
- request.clientRenderedBoundaries.push(
4769
- resumedBoundary
4770
- );
4876
+ request.clientRenderedBoundaries.push(props);
4771
4877
  } finally {
4772
4878
  (task.blockedBoundary = parentBoundary),
4773
4879
  (task.hoistableState = parentHoistableState),
@@ -4782,10 +4888,10 @@ function retryNode(request, task) {
4782
4888
  slots: node$jscomp$0,
4783
4889
  pendingTasks: 0
4784
4890
  },
4785
- props,
4891
+ fallback,
4786
4892
  -1,
4787
4893
  parentBoundary,
4788
- resumedBoundary.fallbackState,
4894
+ props.fallbackState,
4789
4895
  fallbackAbortSet,
4790
4896
  [key[0], "Suspense Fallback", key[2]],
4791
4897
  task.formatContext,
@@ -4998,6 +5104,7 @@ function spawnNewSuspendedRenderTask(request, task, thenableState) {
4998
5104
  task.childIndex,
4999
5105
  task.blockedBoundary,
5000
5106
  newSegment,
5107
+ task.blockedPreamble,
5001
5108
  task.hoistableState,
5002
5109
  task.abortSet,
5003
5110
  task.keyPath,
@@ -5131,7 +5238,12 @@ function abortRemainingReplayNodes(
5131
5238
  node = node[5];
5132
5239
  var request = request$jscomp$0,
5133
5240
  errorDigest = errorDigest$jscomp$0,
5134
- resumedBoundary = createSuspenseBoundary(request, new Set());
5241
+ resumedBoundary = createSuspenseBoundary(
5242
+ request,
5243
+ new Set(),
5244
+ null,
5245
+ null
5246
+ );
5135
5247
  resumedBoundary.parentFlushed = !0;
5136
5248
  resumedBoundary.rootSegmentID = node;
5137
5249
  resumedBoundary.status = 4;
@@ -5262,6 +5374,7 @@ function safelyEmitEarlyPreloads(request, shellComplete) {
5262
5374
  }
5263
5375
  function completeShell(request) {
5264
5376
  null === request.trackedPostpones && safelyEmitEarlyPreloads(request, !0);
5377
+ null === request.trackedPostpones && preparePreamble(request);
5265
5378
  request.onShellError = noop;
5266
5379
  request = request.onShellReady;
5267
5380
  request();
@@ -5274,6 +5387,7 @@ function completeAll(request) {
5274
5387
  : null === request.completedRootSegment ||
5275
5388
  5 !== request.completedRootSegment.status
5276
5389
  );
5390
+ preparePreamble(request);
5277
5391
  request = request.onAllReady;
5278
5392
  request();
5279
5393
  }
@@ -5312,7 +5426,11 @@ function finishedTask(request, boundary, segment) {
5312
5426
  request.completedBoundaries.push(boundary),
5313
5427
  1 === boundary.status &&
5314
5428
  (boundary.fallbackAbortableTasks.forEach(abortTaskSoft, request),
5315
- boundary.fallbackAbortableTasks.clear()))
5429
+ boundary.fallbackAbortableTasks.clear(),
5430
+ 0 === request.pendingRootTasks &&
5431
+ null === request.trackedPostpones &&
5432
+ null !== boundary.contentPreamble &&
5433
+ preparePreamble(request)))
5316
5434
  : null !== segment &&
5317
5435
  segment.parentFlushed &&
5318
5436
  1 === segment.status &&
@@ -5467,9 +5585,11 @@ function performWork(request$jscomp$2) {
5467
5585
  (boundary$jscomp$0.errorDigest = request$jscomp$0),
5468
5586
  untrackBoundary(request, boundary$jscomp$0),
5469
5587
  boundary$jscomp$0.parentFlushed &&
5470
- request.clientRenderedBoundaries.push(
5471
- boundary$jscomp$0
5472
- )));
5588
+ request.clientRenderedBoundaries.push(boundary$jscomp$0),
5589
+ 0 === request.pendingRootTasks &&
5590
+ null === request.trackedPostpones &&
5591
+ null !== boundary$jscomp$0.contentPreamble &&
5592
+ preparePreamble(request)));
5473
5593
  request.allPendingTasks--;
5474
5594
  0 === request.allPendingTasks && completeAll(request);
5475
5595
  }
@@ -5492,6 +5612,82 @@ function performWork(request$jscomp$2) {
5492
5612
  }
5493
5613
  }
5494
5614
  }
5615
+ function preparePreambleFromSubtree(
5616
+ request,
5617
+ segment,
5618
+ collectedPreambleSegments
5619
+ ) {
5620
+ segment.preambleChildren.length &&
5621
+ collectedPreambleSegments.push(segment.preambleChildren);
5622
+ for (var pendingPreambles = !1, i = 0; i < segment.children.length; i++)
5623
+ pendingPreambles =
5624
+ preparePreambleFromSegment(
5625
+ request,
5626
+ segment.children[i],
5627
+ collectedPreambleSegments
5628
+ ) || pendingPreambles;
5629
+ return pendingPreambles;
5630
+ }
5631
+ function preparePreambleFromSegment(
5632
+ request,
5633
+ segment,
5634
+ collectedPreambleSegments
5635
+ ) {
5636
+ var boundary = segment.boundary;
5637
+ if (null === boundary)
5638
+ return preparePreambleFromSubtree(
5639
+ request,
5640
+ segment,
5641
+ collectedPreambleSegments
5642
+ );
5643
+ var preamble = boundary.contentPreamble,
5644
+ fallbackPreamble = boundary.fallbackPreamble;
5645
+ if (null === preamble || null === fallbackPreamble) return !1;
5646
+ switch (boundary.status) {
5647
+ case 1:
5648
+ hoistPreambleState(request.renderState, preamble);
5649
+ segment = boundary.completedSegments[0];
5650
+ if (!segment) throw Error(formatProdErrorMessage(391));
5651
+ return preparePreambleFromSubtree(
5652
+ request,
5653
+ segment,
5654
+ collectedPreambleSegments
5655
+ );
5656
+ case 5:
5657
+ if (null !== request.trackedPostpones) return !0;
5658
+ case 4:
5659
+ if (1 === segment.status)
5660
+ return (
5661
+ hoistPreambleState(request.renderState, fallbackPreamble),
5662
+ preparePreambleFromSubtree(
5663
+ request,
5664
+ segment,
5665
+ collectedPreambleSegments
5666
+ )
5667
+ );
5668
+ default:
5669
+ return !0;
5670
+ }
5671
+ }
5672
+ function preparePreamble(request) {
5673
+ if (
5674
+ request.completedRootSegment &&
5675
+ null === request.completedPreambleSegments
5676
+ ) {
5677
+ var collectedPreambleSegments = [],
5678
+ hasPendingPreambles = preparePreambleFromSegment(
5679
+ request,
5680
+ request.completedRootSegment,
5681
+ collectedPreambleSegments
5682
+ ),
5683
+ preamble = request.renderState.preamble;
5684
+ if (
5685
+ !1 === hasPendingPreambles ||
5686
+ (preamble.headChunks && preamble.bodyChunks)
5687
+ )
5688
+ request.completedPreambleSegments = collectedPreambleSegments;
5689
+ }
5690
+ }
5495
5691
  function flushSubtree(request, destination, segment, hoistableState) {
5496
5692
  segment.parentFlushed = !0;
5497
5693
  switch (segment.status) {
@@ -5687,9 +5883,12 @@ function flushCompletedQueues(request, destination) {
5687
5883
  completedRootSegment = request.completedRootSegment;
5688
5884
  if (null !== completedRootSegment) {
5689
5885
  if (5 === completedRootSegment.status) return;
5886
+ var completedPreambleSegments = request.completedPreambleSegments;
5887
+ if (null === completedPreambleSegments) return;
5690
5888
  var renderState = request.renderState,
5691
- htmlChunks = renderState.htmlChunks,
5692
- headChunks = renderState.headChunks,
5889
+ preamble = renderState.preamble,
5890
+ htmlChunks = preamble.htmlChunks,
5891
+ headChunks = preamble.headChunks,
5693
5892
  i$jscomp$0;
5694
5893
  if (htmlChunks) {
5695
5894
  for (i$jscomp$0 = 0; i$jscomp$0 < htmlChunks.length; i$jscomp$0++)
@@ -5730,10 +5929,27 @@ function flushCompletedQueues(request, destination) {
5730
5929
  var hoistableChunks = renderState.hoistableChunks;
5731
5930
  for (i$jscomp$0 = 0; i$jscomp$0 < hoistableChunks.length; i$jscomp$0++)
5732
5931
  writeChunk(destination, hoistableChunks[i$jscomp$0]);
5733
- hoistableChunks.length = 0;
5734
- htmlChunks &&
5735
- null === headChunks &&
5932
+ for (
5933
+ renderState = hoistableChunks.length = 0;
5934
+ renderState < completedPreambleSegments.length;
5935
+ renderState++
5936
+ ) {
5937
+ var segments = completedPreambleSegments[renderState];
5938
+ for (preamble = 0; preamble < segments.length; preamble++)
5939
+ flushSegment(request, destination, segments[preamble], null);
5940
+ }
5941
+ var preamble$jscomp$0 = request.renderState.preamble,
5942
+ headChunks$jscomp$0 = preamble$jscomp$0.headChunks;
5943
+ (preamble$jscomp$0.htmlChunks || headChunks$jscomp$0) &&
5736
5944
  writeChunk(destination, endChunkForTag("head"));
5945
+ var bodyChunks = preamble$jscomp$0.bodyChunks;
5946
+ if (bodyChunks)
5947
+ for (
5948
+ completedPreambleSegments = 0;
5949
+ completedPreambleSegments < bodyChunks.length;
5950
+ completedPreambleSegments++
5951
+ )
5952
+ writeChunk(destination, bodyChunks[completedPreambleSegments]);
5737
5953
  flushSegment(request, destination, completedRootSegment, null);
5738
5954
  request.completedRootSegment = null;
5739
5955
  writeBootstrap(destination, request.renderState);
@@ -5954,12 +6170,12 @@ function abort(request, reason) {
5954
6170
  }
5955
6171
  function ensureCorrectIsomorphicReactVersion() {
5956
6172
  var isomorphicReactPackageVersion = React.version;
5957
- if ("19.1.0-canary-d46b04a2-20250117" !== isomorphicReactPackageVersion)
6173
+ if ("19.1.0-canary-9b62ee71-20250122" !== isomorphicReactPackageVersion)
5958
6174
  throw Error(
5959
6175
  formatProdErrorMessage(
5960
6176
  527,
5961
6177
  isomorphicReactPackageVersion,
5962
- "19.1.0-canary-d46b04a2-20250117"
6178
+ "19.1.0-canary-9b62ee71-20250122"
5963
6179
  )
5964
6180
  );
5965
6181
  }
@@ -6106,4 +6322,4 @@ exports.renderToReadableStream = function (children, options) {
6106
6322
  startWork(request);
6107
6323
  });
6108
6324
  };
6109
- exports.version = "19.1.0-canary-d46b04a2-20250117";
6325
+ exports.version = "19.1.0-canary-9b62ee71-20250122";