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.
@@ -792,8 +792,7 @@
792
792
  segmentPrefix: stringToPrecomputedChunk(idPrefix + "S:"),
793
793
  boundaryPrefix: stringToPrecomputedChunk(idPrefix + "B:"),
794
794
  startInlineScript: inlineScriptWithNonce,
795
- htmlChunks: null,
796
- headChunks: null,
795
+ preamble: createPreambleState(),
797
796
  externalRuntimeScript: null,
798
797
  bootstrapChunks: externalRuntimeConfig,
799
798
  importMapChunks: bootstrapScriptContent,
@@ -959,6 +958,9 @@
959
958
  moduleScriptResources: {}
960
959
  };
961
960
  }
961
+ function createPreambleState() {
962
+ return { htmlChunks: null, headChunks: null, bodyChunks: null };
963
+ }
962
964
  function createFormatContext(insertionMode, selectedValue, tagScope) {
963
965
  return {
964
966
  insertionMode: insertionMode,
@@ -1029,16 +1031,26 @@
1029
1031
  null,
1030
1032
  parentContext.tagScope
1031
1033
  );
1034
+ case "head":
1035
+ if (parentContext.insertionMode < HTML_MODE)
1036
+ return createFormatContext(
1037
+ HTML_HEAD_MODE,
1038
+ null,
1039
+ parentContext.tagScope
1040
+ );
1041
+ break;
1042
+ case "html":
1043
+ if (parentContext.insertionMode === ROOT_HTML_MODE)
1044
+ return createFormatContext(
1045
+ HTML_HTML_MODE,
1046
+ null,
1047
+ parentContext.tagScope
1048
+ );
1032
1049
  }
1033
- return parentContext.insertionMode >= HTML_TABLE_MODE
1050
+ return parentContext.insertionMode >= HTML_TABLE_MODE ||
1051
+ parentContext.insertionMode < HTML_MODE
1034
1052
  ? createFormatContext(HTML_MODE, null, parentContext.tagScope)
1035
- : parentContext.insertionMode === ROOT_HTML_MODE
1036
- ? "html" === type
1037
- ? createFormatContext(HTML_HTML_MODE, null, parentContext.tagScope)
1038
- : createFormatContext(HTML_MODE, null, parentContext.tagScope)
1039
- : parentContext.insertionMode === HTML_HTML_MODE
1040
- ? createFormatContext(HTML_MODE, null, parentContext.tagScope)
1041
- : parentContext;
1053
+ : parentContext;
1042
1054
  }
1043
1055
  function pushTextInstance(target, text, renderState, textEmbedded) {
1044
1056
  if ("" === text) return textEmbedded;
@@ -1714,6 +1726,7 @@
1714
1726
  props,
1715
1727
  resumableState,
1716
1728
  renderState,
1729
+ preambleState,
1717
1730
  hoistableState,
1718
1731
  formatContext,
1719
1732
  textEmbedded,
@@ -2868,13 +2881,13 @@
2868
2881
  case "missing-glyph":
2869
2882
  break;
2870
2883
  case "head":
2871
- if (
2872
- formatContext.insertionMode < HTML_MODE &&
2873
- null === renderState.headChunks
2874
- ) {
2875
- renderState.headChunks = [];
2884
+ if (formatContext.insertionMode < HTML_MODE) {
2885
+ var preamble = preambleState || renderState.preamble;
2886
+ if (preamble.headChunks)
2887
+ throw Error("The `<head>` tag may only be rendered once.");
2888
+ preamble.headChunks = [];
2876
2889
  var JSCompiler_inline_result$jscomp$9 = pushStartGenericElement(
2877
- renderState.headChunks,
2890
+ preamble.headChunks,
2878
2891
  props,
2879
2892
  "head"
2880
2893
  );
@@ -2885,24 +2898,42 @@
2885
2898
  "head"
2886
2899
  );
2887
2900
  return JSCompiler_inline_result$jscomp$9;
2888
- case "html":
2889
- if (
2890
- formatContext.insertionMode === ROOT_HTML_MODE &&
2891
- null === renderState.htmlChunks
2892
- ) {
2893
- renderState.htmlChunks = [doctypeChunk];
2901
+ case "body":
2902
+ if (formatContext.insertionMode < HTML_MODE) {
2903
+ var preamble$jscomp$0 = preambleState || renderState.preamble;
2904
+ if (preamble$jscomp$0.bodyChunks)
2905
+ throw Error("The `<body>` tag may only be rendered once.");
2906
+ preamble$jscomp$0.bodyChunks = [];
2894
2907
  var JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
2895
- renderState.htmlChunks,
2908
+ preamble$jscomp$0.bodyChunks,
2896
2909
  props,
2897
- "html"
2910
+ "body"
2898
2911
  );
2899
2912
  } else
2900
2913
  JSCompiler_inline_result$jscomp$10 = pushStartGenericElement(
2901
2914
  target$jscomp$0,
2902
2915
  props,
2903
- "html"
2916
+ "body"
2904
2917
  );
2905
2918
  return JSCompiler_inline_result$jscomp$10;
2919
+ case "html":
2920
+ if (formatContext.insertionMode === ROOT_HTML_MODE) {
2921
+ var preamble$jscomp$1 = preambleState || renderState.preamble;
2922
+ if (preamble$jscomp$1.htmlChunks)
2923
+ throw Error("The `<html>` tag may only be rendered once.");
2924
+ preamble$jscomp$1.htmlChunks = [doctypeChunk];
2925
+ var JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
2926
+ preamble$jscomp$1.htmlChunks,
2927
+ props,
2928
+ "html"
2929
+ );
2930
+ } else
2931
+ JSCompiler_inline_result$jscomp$11 = pushStartGenericElement(
2932
+ target$jscomp$0,
2933
+ props,
2934
+ "html"
2935
+ );
2936
+ return JSCompiler_inline_result$jscomp$11;
2906
2937
  default:
2907
2938
  if (-1 !== type.indexOf("-")) {
2908
2939
  target$jscomp$0.push(startChunkForTag(type));
@@ -2970,6 +3001,15 @@
2970
3001
  endTagCache.set(tag, chunk));
2971
3002
  return chunk;
2972
3003
  }
3004
+ function hoistPreambleState(renderState, preambleState) {
3005
+ renderState = renderState.preamble;
3006
+ null === renderState.htmlChunks &&
3007
+ (renderState.htmlChunks = preambleState.htmlChunks);
3008
+ null === renderState.headChunks &&
3009
+ (renderState.headChunks = preambleState.headChunks);
3010
+ null === renderState.bodyChunks &&
3011
+ (renderState.bodyChunks = preambleState.bodyChunks);
3012
+ }
2973
3013
  function writeBootstrap(destination, renderState) {
2974
3014
  renderState = renderState.bootstrapChunks;
2975
3015
  for (var i = 0; i < renderState.length - 1; i++)
@@ -2994,6 +3034,7 @@
2994
3034
  switch (formatContext.insertionMode) {
2995
3035
  case ROOT_HTML_MODE:
2996
3036
  case HTML_HTML_MODE:
3037
+ case HTML_HEAD_MODE:
2997
3038
  case HTML_MODE:
2998
3039
  return (
2999
3040
  writeChunk(destination, startSegmentHTML),
@@ -3051,6 +3092,7 @@
3051
3092
  switch (formatContext.insertionMode) {
3052
3093
  case ROOT_HTML_MODE:
3053
3094
  case HTML_HTML_MODE:
3095
+ case HTML_HEAD_MODE:
3054
3096
  case HTML_MODE:
3055
3097
  return writeChunkAndReturn(destination, endSegmentHTML);
3056
3098
  case SVG_MODE:
@@ -4251,7 +4293,7 @@
4251
4293
  this.status = 10;
4252
4294
  this.fatalError = null;
4253
4295
  this.pendingRootTasks = this.allPendingTasks = this.nextSegmentId = 0;
4254
- this.completedRootSegment = null;
4296
+ this.completedPreambleSegments = this.completedRootSegment = null;
4255
4297
  this.abortableTasks = abortSet;
4256
4298
  this.pingedTasks = [];
4257
4299
  this.clientRenderedBoundaries = [];
@@ -4311,6 +4353,7 @@
4311
4353
  null,
4312
4354
  renderState,
4313
4355
  null,
4356
+ null,
4314
4357
  resumableState.abortableTasks,
4315
4358
  null,
4316
4359
  rootFormatContext,
@@ -4374,7 +4417,12 @@
4374
4417
  return performWork(request);
4375
4418
  }));
4376
4419
  }
4377
- function createSuspenseBoundary(request, fallbackAbortableTasks) {
4420
+ function createSuspenseBoundary(
4421
+ request,
4422
+ fallbackAbortableTasks,
4423
+ contentPreamble,
4424
+ fallbackPreamble
4425
+ ) {
4378
4426
  return {
4379
4427
  status: PENDING,
4380
4428
  rootSegmentID: -1,
@@ -4386,6 +4434,8 @@
4386
4434
  errorDigest: null,
4387
4435
  contentState: createHoistableState(),
4388
4436
  fallbackState: createHoistableState(),
4437
+ contentPreamble: contentPreamble,
4438
+ fallbackPreamble: fallbackPreamble,
4389
4439
  trackedContentKeyPath: null,
4390
4440
  trackedFallbackNode: null,
4391
4441
  errorMessage: null,
@@ -4400,6 +4450,7 @@
4400
4450
  childIndex,
4401
4451
  blockedBoundary,
4402
4452
  blockedSegment,
4453
+ blockedPreamble,
4403
4454
  hoistableState,
4404
4455
  abortSet,
4405
4456
  keyPath,
@@ -4422,6 +4473,7 @@
4422
4473
  },
4423
4474
  blockedBoundary: blockedBoundary,
4424
4475
  blockedSegment: blockedSegment,
4476
+ blockedPreamble: blockedPreamble,
4425
4477
  hoistableState: hoistableState,
4426
4478
  abortSet: abortSet,
4427
4479
  keyPath: keyPath,
@@ -4465,6 +4517,7 @@
4465
4517
  },
4466
4518
  blockedBoundary: blockedBoundary,
4467
4519
  blockedSegment: null,
4520
+ blockedPreamble: null,
4468
4521
  hoistableState: hoistableState,
4469
4522
  abortSet: abortSet,
4470
4523
  keyPath: keyPath,
@@ -4488,11 +4541,12 @@
4488
4541
  ) {
4489
4542
  return {
4490
4543
  status: PENDING,
4544
+ parentFlushed: !1,
4491
4545
  id: -1,
4492
4546
  index: index,
4493
- parentFlushed: !1,
4494
4547
  chunks: [],
4495
4548
  children: [],
4549
+ preambleChildren: [],
4496
4550
  parentFormatContext: parentFormatContext,
4497
4551
  boundary: boundary,
4498
4552
  lastPushedText: lastPushedText,
@@ -5132,6 +5186,7 @@
5132
5186
  props,
5133
5187
  request.resumableState,
5134
5188
  request.renderState,
5189
+ task.blockedPreamble,
5135
5190
  task.hoistableState,
5136
5191
  task.formatContext,
5137
5192
  segment.lastPushedText,
@@ -5140,9 +5195,43 @@
5140
5195
  segment.lastPushedText = !1;
5141
5196
  var _prevContext = task.formatContext,
5142
5197
  _prevKeyPath2 = task.keyPath;
5143
- task.formatContext = getChildFormatContext(_prevContext, type, props);
5144
5198
  task.keyPath = keyPath;
5145
- renderNode(request, task, _children, -1);
5199
+ if (
5200
+ (task.formatContext = getChildFormatContext(
5201
+ _prevContext,
5202
+ type,
5203
+ props
5204
+ )).insertionMode === HTML_HEAD_MODE
5205
+ ) {
5206
+ var preambleSegment = createPendingSegment(
5207
+ request,
5208
+ 0,
5209
+ null,
5210
+ task.formatContext,
5211
+ !1,
5212
+ !1
5213
+ );
5214
+ segment.preambleChildren.push(preambleSegment);
5215
+ var preambleTask = createRenderTask(
5216
+ request,
5217
+ null,
5218
+ _children,
5219
+ -1,
5220
+ task.blockedBoundary,
5221
+ preambleSegment,
5222
+ task.blockedPreamble,
5223
+ task.hoistableState,
5224
+ request.abortableTasks,
5225
+ task.keyPath,
5226
+ task.formatContext,
5227
+ task.context,
5228
+ task.treeContext,
5229
+ task.componentStack,
5230
+ task.isFallback
5231
+ );
5232
+ pushComponentStack(preambleTask);
5233
+ request.pingedTasks.push(preambleTask);
5234
+ } else renderNode(request, task, _children, -1);
5146
5235
  task.formatContext = _prevContext;
5147
5236
  task.keyPath = _prevKeyPath2;
5148
5237
  a: {
@@ -5179,6 +5268,9 @@
5179
5268
  resumableState.hasHtml = !0;
5180
5269
  break a;
5181
5270
  }
5271
+ break;
5272
+ case "head":
5273
+ if (_prevContext.insertionMode <= HTML_HTML_MODE) break a;
5182
5274
  }
5183
5275
  target.push(endChunkForTag(type));
5184
5276
  }
@@ -5227,12 +5319,26 @@
5227
5319
  } else {
5228
5320
  var prevKeyPath$jscomp$3 = task.keyPath,
5229
5321
  parentBoundary = task.blockedBoundary,
5322
+ parentPreamble = task.blockedPreamble,
5230
5323
  parentHoistableState = task.hoistableState,
5231
5324
  parentSegment = task.blockedSegment,
5232
5325
  fallback = props.fallback,
5233
5326
  content = props.children,
5234
- fallbackAbortSet = new Set(),
5235
- newBoundary = createSuspenseBoundary(request, fallbackAbortSet);
5327
+ fallbackAbortSet = new Set();
5328
+ var newBoundary =
5329
+ task.formatContext.insertionMode < HTML_MODE
5330
+ ? createSuspenseBoundary(
5331
+ request,
5332
+ fallbackAbortSet,
5333
+ createPreambleState(),
5334
+ createPreambleState()
5335
+ )
5336
+ : createSuspenseBoundary(
5337
+ request,
5338
+ fallbackAbortSet,
5339
+ null,
5340
+ null
5341
+ );
5236
5342
  null !== request.trackedPostpones &&
5237
5343
  (newBoundary.trackedContentKeyPath = keyPath);
5238
5344
  var boundarySegment = createPendingSegment(
@@ -5272,6 +5378,7 @@
5272
5378
  );
5273
5379
  newBoundary.trackedFallbackNode = fallbackReplayNode;
5274
5380
  task.blockedSegment = boundarySegment;
5381
+ task.blockedPreamble = newBoundary.fallbackPreamble;
5275
5382
  task.keyPath = fallbackKeyPath;
5276
5383
  boundarySegment.status = 6;
5277
5384
  try {
@@ -5287,6 +5394,7 @@
5287
5394
  );
5288
5395
  } finally {
5289
5396
  (task.blockedSegment = parentSegment),
5397
+ (task.blockedPreamble = parentPreamble),
5290
5398
  (task.keyPath = prevKeyPath$jscomp$3);
5291
5399
  }
5292
5400
  var suspendedPrimaryTask = createRenderTask(
@@ -5296,6 +5404,7 @@
5296
5404
  -1,
5297
5405
  newBoundary,
5298
5406
  contentRootSegment,
5407
+ newBoundary.contentPreamble,
5299
5408
  newBoundary.contentState,
5300
5409
  task.abortSet,
5301
5410
  keyPath,
@@ -5309,6 +5418,7 @@
5309
5418
  request.pingedTasks.push(suspendedPrimaryTask);
5310
5419
  } else {
5311
5420
  task.blockedBoundary = newBoundary;
5421
+ task.blockedPreamble = newBoundary.contentPreamble;
5312
5422
  task.hoistableState = newBoundary.contentState;
5313
5423
  task.blockedSegment = contentRootSegment;
5314
5424
  task.keyPath = keyPath;
@@ -5325,6 +5435,9 @@
5325
5435
  newBoundary.status === PENDING)
5326
5436
  ) {
5327
5437
  newBoundary.status = COMPLETED;
5438
+ 0 === request.pendingRootTasks &&
5439
+ task.blockedPreamble &&
5440
+ preparePreamble(request);
5328
5441
  break a;
5329
5442
  }
5330
5443
  } catch (thrownValue$2) {
@@ -5350,6 +5463,7 @@
5350
5463
  untrackBoundary(request, newBoundary);
5351
5464
  } finally {
5352
5465
  (task.blockedBoundary = parentBoundary),
5466
+ (task.blockedPreamble = parentPreamble),
5353
5467
  (task.hoistableState = parentHoistableState),
5354
5468
  (task.blockedSegment = parentSegment),
5355
5469
  (task.keyPath = prevKeyPath$jscomp$3);
@@ -5361,6 +5475,7 @@
5361
5475
  -1,
5362
5476
  parentBoundary,
5363
5477
  boundarySegment,
5478
+ newBoundary.fallbackPreamble,
5364
5479
  newBoundary.fallbackState,
5365
5480
  fallbackAbortSet,
5366
5481
  [keyPath[0], "Suspense Fallback", keyPath[2]],
@@ -5618,17 +5733,27 @@
5618
5733
  previousReplaySet = task.replay,
5619
5734
  parentBoundary = task.blockedBoundary,
5620
5735
  parentHoistableState = task.hoistableState,
5621
- content = props.children;
5622
- props = props.fallback;
5623
- var fallbackAbortSet = new Set(),
5624
- resumedBoundary = createSuspenseBoundary(
5625
- request,
5626
- fallbackAbortSet
5627
- );
5628
- resumedBoundary.parentFlushed = !0;
5629
- resumedBoundary.rootSegmentID = ref;
5630
- task.blockedBoundary = resumedBoundary;
5631
- task.hoistableState = resumedBoundary.contentState;
5736
+ content = props.children,
5737
+ fallback = props.fallback,
5738
+ fallbackAbortSet = new Set();
5739
+ props =
5740
+ task.formatContext.insertionMode < HTML_MODE
5741
+ ? createSuspenseBoundary(
5742
+ request,
5743
+ fallbackAbortSet,
5744
+ createPreambleState(),
5745
+ createPreambleState()
5746
+ )
5747
+ : createSuspenseBoundary(
5748
+ request,
5749
+ fallbackAbortSet,
5750
+ null,
5751
+ null
5752
+ );
5753
+ props.parentFlushed = !0;
5754
+ props.rootSegmentID = ref;
5755
+ task.blockedBoundary = props;
5756
+ task.hoistableState = props.contentState;
5632
5757
  task.keyPath = keyPath;
5633
5758
  task.replay = {
5634
5759
  nodes: replay,
@@ -5646,15 +5771,15 @@
5646
5771
  );
5647
5772
  task.replay.pendingTasks--;
5648
5773
  if (
5649
- 0 === resumedBoundary.pendingTasks &&
5650
- resumedBoundary.status === PENDING
5774
+ 0 === props.pendingTasks &&
5775
+ props.status === PENDING
5651
5776
  ) {
5652
- resumedBoundary.status = COMPLETED;
5653
- request.completedBoundaries.push(resumedBoundary);
5777
+ props.status = COMPLETED;
5778
+ request.completedBoundaries.push(props);
5654
5779
  break a;
5655
5780
  }
5656
5781
  } catch (error) {
5657
- (resumedBoundary.status = CLIENT_RENDERED),
5782
+ (props.status = CLIENT_RENDERED),
5658
5783
  (childNodes = getThrownInfo(task.componentStack)),
5659
5784
  (type = logRecoverableError(
5660
5785
  request,
@@ -5662,16 +5787,14 @@
5662
5787
  childNodes
5663
5788
  )),
5664
5789
  encodeErrorForBoundary(
5665
- resumedBoundary,
5790
+ props,
5666
5791
  type,
5667
5792
  error,
5668
5793
  childNodes,
5669
5794
  !1
5670
5795
  ),
5671
5796
  task.replay.pendingTasks--,
5672
- request.clientRenderedBoundaries.push(
5673
- resumedBoundary
5674
- );
5797
+ request.clientRenderedBoundaries.push(props);
5675
5798
  } finally {
5676
5799
  (task.blockedBoundary = parentBoundary),
5677
5800
  (task.hoistableState = parentHoistableState),
@@ -5682,10 +5805,10 @@
5682
5805
  request,
5683
5806
  null,
5684
5807
  { nodes: keyOrIndex, slots: key, pendingTasks: 0 },
5685
- props,
5808
+ fallback,
5686
5809
  -1,
5687
5810
  parentBoundary,
5688
- resumedBoundary.fallbackState,
5811
+ props.fallbackState,
5689
5812
  fallbackAbortSet,
5690
5813
  [keyPath[0], "Suspense Fallback", keyPath[2]],
5691
5814
  task.formatContext,
@@ -6014,6 +6137,7 @@
6014
6137
  task.childIndex,
6015
6138
  task.blockedBoundary,
6016
6139
  newSegment,
6140
+ task.blockedPreamble,
6017
6141
  task.hoistableState,
6018
6142
  task.abortSet,
6019
6143
  task.keyPath,
@@ -6182,7 +6306,12 @@
6182
6306
  errorDigest = errorDigest$jscomp$0,
6183
6307
  errorInfo = errorInfo$jscomp$0,
6184
6308
  wasAborted = aborted,
6185
- resumedBoundary = createSuspenseBoundary(request, new Set());
6309
+ resumedBoundary = createSuspenseBoundary(
6310
+ request,
6311
+ new Set(),
6312
+ null,
6313
+ null
6314
+ );
6186
6315
  resumedBoundary.parentFlushed = !0;
6187
6316
  resumedBoundary.rootSegmentID = node;
6188
6317
  resumedBoundary.status = CLIENT_RENDERED;
@@ -6335,6 +6464,7 @@
6335
6464
  }
6336
6465
  function completeShell(request) {
6337
6466
  null === request.trackedPostpones && safelyEmitEarlyPreloads(request, !0);
6467
+ null === request.trackedPostpones && preparePreamble(request);
6338
6468
  request.onShellError = noop;
6339
6469
  request = request.onShellReady;
6340
6470
  request();
@@ -6347,6 +6477,7 @@
6347
6477
  : null === request.completedRootSegment ||
6348
6478
  request.completedRootSegment.status !== POSTPONED
6349
6479
  );
6480
+ preparePreamble(request);
6350
6481
  request = request.onAllReady;
6351
6482
  request();
6352
6483
  }
@@ -6391,7 +6522,11 @@
6391
6522
  abortTaskSoft,
6392
6523
  request
6393
6524
  ),
6394
- boundary.fallbackAbortableTasks.clear()))
6525
+ boundary.fallbackAbortableTasks.clear(),
6526
+ 0 === request.pendingRootTasks &&
6527
+ null === request.trackedPostpones &&
6528
+ null !== boundary.contentPreamble &&
6529
+ preparePreamble(request)))
6395
6530
  : null !== segment &&
6396
6531
  segment.parentFlushed &&
6397
6532
  segment.status === COMPLETED &&
@@ -6561,7 +6696,11 @@
6561
6696
  ),
6562
6697
  untrackBoundary(request, boundary),
6563
6698
  boundary.parentFlushed &&
6564
- request.clientRenderedBoundaries.push(boundary)));
6699
+ request.clientRenderedBoundaries.push(boundary),
6700
+ 0 === request.pendingRootTasks &&
6701
+ null === request.trackedPostpones &&
6702
+ null !== boundary.contentPreamble &&
6703
+ preparePreamble(request)));
6565
6704
  request.allPendingTasks--;
6566
6705
  0 === request.allPendingTasks && completeAll(request);
6567
6706
  }
@@ -6590,6 +6729,85 @@
6590
6729
  }
6591
6730
  }
6592
6731
  }
6732
+ function preparePreambleFromSubtree(
6733
+ request,
6734
+ segment,
6735
+ collectedPreambleSegments
6736
+ ) {
6737
+ segment.preambleChildren.length &&
6738
+ collectedPreambleSegments.push(segment.preambleChildren);
6739
+ for (var pendingPreambles = !1, i = 0; i < segment.children.length; i++)
6740
+ pendingPreambles =
6741
+ preparePreambleFromSegment(
6742
+ request,
6743
+ segment.children[i],
6744
+ collectedPreambleSegments
6745
+ ) || pendingPreambles;
6746
+ return pendingPreambles;
6747
+ }
6748
+ function preparePreambleFromSegment(
6749
+ request,
6750
+ segment,
6751
+ collectedPreambleSegments
6752
+ ) {
6753
+ var boundary = segment.boundary;
6754
+ if (null === boundary)
6755
+ return preparePreambleFromSubtree(
6756
+ request,
6757
+ segment,
6758
+ collectedPreambleSegments
6759
+ );
6760
+ var preamble = boundary.contentPreamble,
6761
+ fallbackPreamble = boundary.fallbackPreamble;
6762
+ if (null === preamble || null === fallbackPreamble) return !1;
6763
+ switch (boundary.status) {
6764
+ case COMPLETED:
6765
+ hoistPreambleState(request.renderState, preamble);
6766
+ segment = boundary.completedSegments[0];
6767
+ if (!segment)
6768
+ throw Error(
6769
+ "A previously unvisited boundary must have exactly one root segment. This is a bug in React."
6770
+ );
6771
+ return preparePreambleFromSubtree(
6772
+ request,
6773
+ segment,
6774
+ collectedPreambleSegments
6775
+ );
6776
+ case POSTPONED:
6777
+ if (null !== request.trackedPostpones) return !0;
6778
+ case CLIENT_RENDERED:
6779
+ if (segment.status === COMPLETED)
6780
+ return (
6781
+ hoistPreambleState(request.renderState, fallbackPreamble),
6782
+ preparePreambleFromSubtree(
6783
+ request,
6784
+ segment,
6785
+ collectedPreambleSegments
6786
+ )
6787
+ );
6788
+ default:
6789
+ return !0;
6790
+ }
6791
+ }
6792
+ function preparePreamble(request) {
6793
+ if (
6794
+ request.completedRootSegment &&
6795
+ null === request.completedPreambleSegments
6796
+ ) {
6797
+ var collectedPreambleSegments = [],
6798
+ hasPendingPreambles = preparePreambleFromSegment(
6799
+ request,
6800
+ request.completedRootSegment,
6801
+ collectedPreambleSegments
6802
+ ),
6803
+ preamble = request.renderState.preamble;
6804
+ if (
6805
+ !1 === hasPendingPreambles ||
6806
+ (preamble.headChunks && preamble.bodyChunks)
6807
+ )
6808
+ request.completedPreambleSegments = collectedPreambleSegments;
6809
+ }
6810
+ }
6593
6811
  function flushSubtree(request, destination, segment, hoistableState) {
6594
6812
  segment.parentFlushed = !0;
6595
6813
  switch (segment.status) {
@@ -6845,9 +7063,12 @@
6845
7063
  completedRootSegment = request.completedRootSegment;
6846
7064
  if (null !== completedRootSegment) {
6847
7065
  if (completedRootSegment.status === POSTPONED) return;
7066
+ var completedPreambleSegments = request.completedPreambleSegments;
7067
+ if (null === completedPreambleSegments) return;
6848
7068
  var renderState = request.renderState,
6849
- htmlChunks = renderState.htmlChunks,
6850
- headChunks = renderState.headChunks,
7069
+ preamble = renderState.preamble,
7070
+ htmlChunks = preamble.htmlChunks,
7071
+ headChunks = preamble.headChunks,
6851
7072
  i$jscomp$0;
6852
7073
  if (htmlChunks) {
6853
7074
  for (i$jscomp$0 = 0; i$jscomp$0 < htmlChunks.length; i$jscomp$0++)
@@ -6908,10 +7129,27 @@
6908
7129
  i$jscomp$0++
6909
7130
  )
6910
7131
  writeChunk(destination, hoistableChunks[i$jscomp$0]);
6911
- hoistableChunks.length = 0;
6912
- htmlChunks &&
6913
- null === headChunks &&
7132
+ for (
7133
+ renderState = hoistableChunks.length = 0;
7134
+ renderState < completedPreambleSegments.length;
7135
+ renderState++
7136
+ ) {
7137
+ var segments = completedPreambleSegments[renderState];
7138
+ for (preamble = 0; preamble < segments.length; preamble++)
7139
+ flushSegment(request, destination, segments[preamble], null);
7140
+ }
7141
+ var preamble$jscomp$0 = request.renderState.preamble,
7142
+ headChunks$jscomp$0 = preamble$jscomp$0.headChunks;
7143
+ (preamble$jscomp$0.htmlChunks || headChunks$jscomp$0) &&
6914
7144
  writeChunk(destination, endChunkForTag("head"));
7145
+ var bodyChunks = preamble$jscomp$0.bodyChunks;
7146
+ if (bodyChunks)
7147
+ for (
7148
+ completedPreambleSegments = 0;
7149
+ completedPreambleSegments < bodyChunks.length;
7150
+ completedPreambleSegments++
7151
+ )
7152
+ writeChunk(destination, bodyChunks[completedPreambleSegments]);
6915
7153
  flushSegment(request, destination, completedRootSegment, null);
6916
7154
  request.completedRootSegment = null;
6917
7155
  writeBootstrap(destination, request.renderState);
@@ -7194,11 +7432,11 @@
7194
7432
  }
7195
7433
  function ensureCorrectIsomorphicReactVersion() {
7196
7434
  var isomorphicReactPackageVersion = React.version;
7197
- if ("19.1.0-canary-d46b04a2-20250117" !== isomorphicReactPackageVersion)
7435
+ if ("19.1.0-canary-18eaf51b-20250118" !== isomorphicReactPackageVersion)
7198
7436
  throw Error(
7199
7437
  'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
7200
7438
  (isomorphicReactPackageVersion +
7201
- "\n - react-dom: 19.1.0-canary-d46b04a2-20250117\nLearn more: https://react.dev/warnings/version-mismatch")
7439
+ "\n - react-dom: 19.1.0-canary-18eaf51b-20250118\nLearn more: https://react.dev/warnings/version-mismatch")
7202
7440
  );
7203
7441
  }
7204
7442
  function createDrainHandler(destination, request) {
@@ -8352,12 +8590,13 @@
8352
8590
  var ROOT_HTML_MODE = 0,
8353
8591
  HTML_HTML_MODE = 1,
8354
8592
  HTML_MODE = 2,
8355
- SVG_MODE = 3,
8356
- MATHML_MODE = 4,
8357
- HTML_TABLE_MODE = 5,
8358
- HTML_TABLE_BODY_MODE = 6,
8359
- HTML_TABLE_ROW_MODE = 7,
8360
- HTML_COLGROUP_MODE = 8,
8593
+ HTML_HEAD_MODE = 3,
8594
+ SVG_MODE = 4,
8595
+ MATHML_MODE = 5,
8596
+ HTML_TABLE_MODE = 6,
8597
+ HTML_TABLE_BODY_MODE = 7,
8598
+ HTML_TABLE_ROW_MODE = 8,
8599
+ HTML_COLGROUP_MODE = 9,
8361
8600
  textSeparator = stringToPrecomputedChunk("\x3c!-- --\x3e"),
8362
8601
  styleNameCache = new Map(),
8363
8602
  styleAttributeStart = stringToPrecomputedChunk(' style="'),
@@ -8842,5 +9081,5 @@
8842
9081
  }
8843
9082
  };
8844
9083
  };
8845
- exports.version = "19.1.0-canary-d46b04a2-20250117";
9084
+ exports.version = "19.1.0-canary-18eaf51b-20250118";
8846
9085
  })();