react-server-dom-webpack 19.0.0-rc-a26e3f403e-20240611 → 19.0.0-rc-f3e09d6328-20240612

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.
@@ -1147,23 +1147,22 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
1147
1147
  ? "$L" + JSCompiler_inline_result.id.toString(16)
1148
1148
  : serializeByValueID(JSCompiler_inline_result.id);
1149
1149
  }
1150
- else if (thrownValue === AbortSigil)
1151
- (task.status = 3),
1152
- (prevKeyPath = request.fatalError),
1153
- (JSCompiler_inline_result = parentPropertyName
1154
- ? "$L" + prevKeyPath.toString(16)
1155
- : serializeByValueID(prevKeyPath));
1156
- else if (
1157
- ((task.keyPath = prevKeyPath),
1158
- (task.implicitSlot = prevImplicitSlot),
1159
- parentPropertyName)
1160
- )
1161
- request.pendingChunks++,
1162
- (prevKeyPath = request.nextChunkId++),
1163
- (prevImplicitSlot = logRecoverableError(request, value)),
1164
- emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
1165
- (JSCompiler_inline_result = "$L" + prevKeyPath.toString(16));
1166
- else throw value;
1150
+ else
1151
+ thrownValue === AbortSigil
1152
+ ? ((task.status = 3),
1153
+ (prevKeyPath = request.fatalError),
1154
+ (JSCompiler_inline_result = parentPropertyName
1155
+ ? "$L" + prevKeyPath.toString(16)
1156
+ : serializeByValueID(prevKeyPath)))
1157
+ : ((task.keyPath = prevKeyPath),
1158
+ (task.implicitSlot = prevImplicitSlot),
1159
+ request.pendingChunks++,
1160
+ (prevKeyPath = request.nextChunkId++),
1161
+ (prevImplicitSlot = logRecoverableError(request, value)),
1162
+ emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
1163
+ (JSCompiler_inline_result = parentPropertyName
1164
+ ? "$L" + prevKeyPath.toString(16)
1165
+ : serializeByValueID(prevKeyPath)));
1167
1166
  }
1168
1167
  return JSCompiler_inline_result;
1169
1168
  },
@@ -1293,7 +1292,8 @@ function renderModelDestructive(
1293
1292
  if ("object" === typeof value) {
1294
1293
  switch (value.$$typeof) {
1295
1294
  case REACT_ELEMENT_TYPE:
1296
- var writtenObjects = request.writtenObjects;
1295
+ var elementReference = null,
1296
+ writtenObjects = request.writtenObjects;
1297
1297
  if (null === task.keyPath && !task.implicitSlot) {
1298
1298
  var existingReference = writtenObjects.get(value);
1299
1299
  if (void 0 !== existingReference)
@@ -1303,11 +1303,12 @@ function renderModelDestructive(
1303
1303
  -1 === parentPropertyName.indexOf(":") &&
1304
1304
  ((parent = writtenObjects.get(parent)),
1305
1305
  void 0 !== parent &&
1306
- writtenObjects.set(value, parent + ":" + parentPropertyName));
1306
+ ((elementReference = parent + ":" + parentPropertyName),
1307
+ writtenObjects.set(value, elementReference)));
1307
1308
  }
1308
1309
  parentPropertyName = value.props;
1309
1310
  parent = parentPropertyName.ref;
1310
- return renderElement(
1311
+ request = renderElement(
1311
1312
  request,
1312
1313
  task,
1313
1314
  value.type,
@@ -1315,6 +1316,12 @@ function renderModelDestructive(
1315
1316
  void 0 !== parent ? parent : null,
1316
1317
  parentPropertyName
1317
1318
  );
1319
+ "object" === typeof request &&
1320
+ null !== request &&
1321
+ null !== elementReference &&
1322
+ (writtenObjects.has(request) ||
1323
+ writtenObjects.set(request, elementReference));
1324
+ return request;
1318
1325
  case REACT_LAZY_TYPE:
1319
1326
  task.thenableState = null;
1320
1327
  parentPropertyName = value._init;
@@ -1335,44 +1342,44 @@ function renderModelDestructive(
1335
1342
  );
1336
1343
  if (
1337
1344
  void 0 !== request.temporaryReferences &&
1338
- ((writtenObjects = request.temporaryReferences.get(value)),
1339
- void 0 !== writtenObjects)
1345
+ ((elementReference = request.temporaryReferences.get(value)),
1346
+ void 0 !== elementReference)
1340
1347
  )
1341
- return "$T" + writtenObjects;
1342
- writtenObjects = request.writtenObjects;
1343
- existingReference = writtenObjects.get(value);
1348
+ return "$T" + elementReference;
1349
+ elementReference = request.writtenObjects;
1350
+ writtenObjects = elementReference.get(value);
1344
1351
  if ("function" === typeof value.then) {
1345
- if (void 0 !== existingReference) {
1352
+ if (void 0 !== writtenObjects) {
1346
1353
  if (null !== task.keyPath || task.implicitSlot)
1347
1354
  return "$@" + serializeThenable(request, task, value).toString(16);
1348
1355
  if (modelRoot === value) modelRoot = null;
1349
- else return existingReference;
1356
+ else return writtenObjects;
1350
1357
  }
1351
1358
  request = "$@" + serializeThenable(request, task, value).toString(16);
1352
- writtenObjects.set(value, request);
1359
+ elementReference.set(value, request);
1353
1360
  return request;
1354
1361
  }
1355
- if (void 0 !== existingReference)
1362
+ if (void 0 !== writtenObjects)
1356
1363
  if (modelRoot === value) modelRoot = null;
1357
- else return existingReference;
1364
+ else return writtenObjects;
1358
1365
  else if (
1359
1366
  -1 === parentPropertyName.indexOf(":") &&
1360
- ((existingReference = writtenObjects.get(parent)),
1361
- void 0 !== existingReference)
1367
+ ((writtenObjects = elementReference.get(parent)),
1368
+ void 0 !== writtenObjects)
1362
1369
  ) {
1363
- var propertyName = parentPropertyName;
1370
+ existingReference = parentPropertyName;
1364
1371
  if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE)
1365
1372
  switch (parentPropertyName) {
1366
1373
  case "1":
1367
- propertyName = "type";
1374
+ existingReference = "type";
1368
1375
  break;
1369
1376
  case "2":
1370
- propertyName = "key";
1377
+ existingReference = "key";
1371
1378
  break;
1372
1379
  case "3":
1373
- propertyName = "props";
1380
+ existingReference = "props";
1374
1381
  }
1375
- writtenObjects.set(value, existingReference + ":" + propertyName);
1382
+ elementReference.set(value, writtenObjects + ":" + existingReference);
1376
1383
  }
1377
1384
  if (isArrayImpl(value)) return renderFragment(request, task, value);
1378
1385
  if (value instanceof Map)
@@ -1534,10 +1541,11 @@ function renderModelDestructive(
1534
1541
  }
1535
1542
  if ("symbol" === typeof value) {
1536
1543
  task = request.writtenSymbols;
1537
- writtenObjects = task.get(value);
1538
- if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects);
1539
- writtenObjects = value.description;
1540
- if (Symbol.for(writtenObjects) !== value)
1544
+ elementReference = task.get(value);
1545
+ if (void 0 !== elementReference)
1546
+ return serializeByValueID(elementReference);
1547
+ elementReference = value.description;
1548
+ if (Symbol.for(elementReference) !== value)
1541
1549
  throw Error(
1542
1550
  "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" +
1543
1551
  (value.description + ") cannot be found among global symbols.") +
@@ -1548,7 +1556,7 @@ function renderModelDestructive(
1548
1556
  parent = encodeReferenceChunk(
1549
1557
  request,
1550
1558
  parentPropertyName,
1551
- "$S" + writtenObjects
1559
+ "$S" + elementReference
1552
1560
  );
1553
1561
  request.completedImportChunks.push(parent);
1554
1562
  task.set(value, parentPropertyName);
@@ -514,7 +514,15 @@
514
514
  this.onPostpone =
515
515
  void 0 === onPostpone ? defaultPostponeHandler : onPostpone;
516
516
  this.environmentName =
517
- void 0 === environmentName ? "Server" : environmentName;
517
+ void 0 === environmentName
518
+ ? function () {
519
+ return "Server";
520
+ }
521
+ : "function" !== typeof environmentName
522
+ ? function () {
523
+ return environmentName;
524
+ }
525
+ : environmentName;
518
526
  this.didWarnForKey = null;
519
527
  model = createTask(this, model, null, !1, abortSet);
520
528
  pingedTasks.push(model);
@@ -778,16 +786,14 @@
778
786
  if (null !== prevThenableState)
779
787
  owner = prevThenableState._componentDebugInfo;
780
788
  else {
781
- var componentName = Component.displayName || Component.name || "";
789
+ var componentDebugID = debugID,
790
+ componentName = Component.displayName || Component.name || "",
791
+ componentEnv = request.environmentName();
782
792
  request.pendingChunks++;
783
- var componentDebugID = debugID;
784
- owner = {
785
- name: componentName,
786
- env: request.environmentName,
787
- owner: owner
788
- };
793
+ owner = { name: componentName, env: componentEnv, owner: owner };
789
794
  outlineModel(request, owner);
790
795
  emitDebugChunk(request, componentDebugID, owner);
796
+ task.environmentName = componentEnv;
791
797
  }
792
798
  prepareToUseHooksForComponent(prevThenableState, owner);
793
799
  props = callComponentInDEV(Component, props, owner);
@@ -1073,28 +1079,28 @@
1073
1079
  ? serializeLazyID(JSCompiler_inline_result.id)
1074
1080
  : serializeByValueID(JSCompiler_inline_result.id);
1075
1081
  }
1076
- else if (thrownValue === AbortSigil)
1077
- (originalValue.status = 3),
1078
- (originalValue = request.fatalError),
1079
- (JSCompiler_inline_result = parentPropertyName
1080
- ? serializeLazyID(originalValue)
1081
- : serializeByValueID(originalValue));
1082
- else if (
1083
- ((originalValue.keyPath = prevKeyPath),
1084
- (originalValue.implicitSlot = prevImplicitSlot),
1085
- parentPropertyName)
1086
- )
1087
- request.pendingChunks++,
1088
- (originalValue = request.nextChunkId++),
1089
- (prevKeyPath = logRecoverableError(request, value)),
1090
- emitErrorChunk(request, originalValue, prevKeyPath, value),
1091
- (JSCompiler_inline_result = serializeLazyID(originalValue));
1092
- else throw value;
1082
+ else
1083
+ thrownValue === AbortSigil
1084
+ ? ((originalValue.status = 3),
1085
+ (originalValue = request.fatalError),
1086
+ (JSCompiler_inline_result = parentPropertyName
1087
+ ? serializeLazyID(originalValue)
1088
+ : serializeByValueID(originalValue)))
1089
+ : ((originalValue.keyPath = prevKeyPath),
1090
+ (originalValue.implicitSlot = prevImplicitSlot),
1091
+ request.pendingChunks++,
1092
+ (originalValue = request.nextChunkId++),
1093
+ (prevKeyPath = logRecoverableError(request, value)),
1094
+ emitErrorChunk(request, originalValue, prevKeyPath, value),
1095
+ (JSCompiler_inline_result = parentPropertyName
1096
+ ? serializeLazyID(originalValue)
1097
+ : serializeByValueID(originalValue)));
1093
1098
  }
1094
1099
  return JSCompiler_inline_result;
1095
1100
  },
1096
1101
  thenableState: null
1097
1102
  };
1103
+ task.environmentName = request.environmentName();
1098
1104
  abortSet.add(task);
1099
1105
  return task;
1100
1106
  }
@@ -1250,7 +1256,8 @@
1250
1256
  if ("object" === typeof value) {
1251
1257
  switch (value.$$typeof) {
1252
1258
  case REACT_ELEMENT_TYPE:
1253
- var _writtenObjects = request.writtenObjects;
1259
+ var elementReference = null,
1260
+ _writtenObjects = request.writtenObjects;
1254
1261
  if (null === task.keyPath && !task.implicitSlot) {
1255
1262
  var _existingReference = _writtenObjects.get(value);
1256
1263
  if (void 0 !== _existingReference)
@@ -1260,10 +1267,8 @@
1260
1267
  -1 === parentPropertyName.indexOf(":") &&
1261
1268
  ((parent = _writtenObjects.get(parent)),
1262
1269
  void 0 !== parent &&
1263
- _writtenObjects.set(
1264
- value,
1265
- parent + ":" + parentPropertyName
1266
- ));
1270
+ ((elementReference = parent + ":" + parentPropertyName),
1271
+ _writtenObjects.set(value, elementReference)));
1267
1272
  }
1268
1273
  if ((parentPropertyName = value._debugInfo)) {
1269
1274
  if (null === debugID) return outlineTask(request, task);
@@ -1271,7 +1276,7 @@
1271
1276
  }
1272
1277
  parentPropertyName = value.props;
1273
1278
  parent = parentPropertyName.ref;
1274
- return renderElement(
1279
+ value = renderElement(
1275
1280
  request,
1276
1281
  task,
1277
1282
  value.type,
@@ -1280,6 +1285,12 @@
1280
1285
  parentPropertyName,
1281
1286
  value._owner
1282
1287
  );
1288
+ "object" === typeof value &&
1289
+ null !== value &&
1290
+ null !== elementReference &&
1291
+ (_writtenObjects.has(value) ||
1292
+ _writtenObjects.set(value, elementReference));
1293
+ return value;
1283
1294
  case REACT_LAZY_TYPE:
1284
1295
  task.thenableState = null;
1285
1296
  parentPropertyName = callLazyInitInDEV(value);
@@ -1309,46 +1320,49 @@
1309
1320
  );
1310
1321
  if (
1311
1322
  void 0 !== request.temporaryReferences &&
1312
- ((_writtenObjects = request.temporaryReferences.get(value)),
1313
- void 0 !== _writtenObjects)
1323
+ ((elementReference = request.temporaryReferences.get(value)),
1324
+ void 0 !== elementReference)
1314
1325
  )
1315
- return "$T" + _writtenObjects;
1316
- _writtenObjects = request.writtenObjects;
1317
- _existingReference = _writtenObjects.get(value);
1326
+ return "$T" + elementReference;
1327
+ elementReference = request.writtenObjects;
1328
+ _writtenObjects = elementReference.get(value);
1318
1329
  if ("function" === typeof value.then) {
1319
- if (void 0 !== _existingReference) {
1330
+ if (void 0 !== _writtenObjects) {
1320
1331
  if (null !== task.keyPath || task.implicitSlot)
1321
1332
  return (
1322
1333
  "$@" + serializeThenable(request, task, value).toString(16)
1323
1334
  );
1324
1335
  if (modelRoot === value) modelRoot = null;
1325
- else return _existingReference;
1336
+ else return _writtenObjects;
1326
1337
  }
1327
1338
  request = "$@" + serializeThenable(request, task, value).toString(16);
1328
- _writtenObjects.set(value, request);
1339
+ elementReference.set(value, request);
1329
1340
  return request;
1330
1341
  }
1331
- if (void 0 !== _existingReference)
1342
+ if (void 0 !== _writtenObjects)
1332
1343
  if (modelRoot === value) modelRoot = null;
1333
- else return _existingReference;
1344
+ else return _writtenObjects;
1334
1345
  else if (
1335
1346
  -1 === parentPropertyName.indexOf(":") &&
1336
- ((_existingReference = _writtenObjects.get(parent)),
1337
- void 0 !== _existingReference)
1347
+ ((_writtenObjects = elementReference.get(parent)),
1348
+ void 0 !== _writtenObjects)
1338
1349
  ) {
1339
- var propertyName = parentPropertyName;
1350
+ _existingReference = parentPropertyName;
1340
1351
  if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE)
1341
1352
  switch (parentPropertyName) {
1342
1353
  case "1":
1343
- propertyName = "type";
1354
+ _existingReference = "type";
1344
1355
  break;
1345
1356
  case "2":
1346
- propertyName = "key";
1357
+ _existingReference = "key";
1347
1358
  break;
1348
1359
  case "3":
1349
- propertyName = "props";
1360
+ _existingReference = "props";
1350
1361
  }
1351
- _writtenObjects.set(value, _existingReference + ":" + propertyName);
1362
+ elementReference.set(
1363
+ value,
1364
+ _writtenObjects + ":" + _existingReference
1365
+ );
1352
1366
  }
1353
1367
  if (isArrayImpl(value)) return renderFragment(request, task, value);
1354
1368
  if (value instanceof Map) return serializeMap(request, value);
@@ -1383,9 +1397,9 @@
1383
1397
  return serializeTypedArray(request, "V", value);
1384
1398
  if ("function" === typeof Blob && value instanceof Blob)
1385
1399
  return serializeBlob(request, value);
1386
- if ((_writtenObjects = getIteratorFn(value)))
1400
+ if ((elementReference = getIteratorFn(value)))
1387
1401
  return (
1388
- (parentPropertyName = _writtenObjects.call(value)),
1402
+ (parentPropertyName = elementReference.call(value)),
1389
1403
  parentPropertyName === value
1390
1404
  ? "$i" +
1391
1405
  outlineModel(request, Array.from(parentPropertyName)).toString(
@@ -1398,8 +1412,8 @@
1398
1412
  value instanceof ReadableStream
1399
1413
  )
1400
1414
  return serializeReadableStream(request, task, value);
1401
- _writtenObjects = value[ASYNC_ITERATOR];
1402
- if ("function" === typeof _writtenObjects)
1415
+ elementReference = value[ASYNC_ITERATOR];
1416
+ if ("function" === typeof elementReference)
1403
1417
  return (
1404
1418
  null !== task.keyPath
1405
1419
  ? ((value = [
@@ -1410,7 +1424,7 @@
1410
1424
  null
1411
1425
  ]),
1412
1426
  (value = task.implicitSlot ? [value] : value))
1413
- : ((parentPropertyName = _writtenObjects.call(value)),
1427
+ : ((parentPropertyName = elementReference.call(value)),
1414
1428
  (value = serializeAsyncIterable(
1415
1429
  request,
1416
1430
  task,
@@ -1427,6 +1441,16 @@
1427
1441
  throw Error(
1428
1442
  "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported."
1429
1443
  );
1444
+ if (
1445
+ "object" === typeof value.task &&
1446
+ null !== value.task &&
1447
+ "function" === typeof value.task.run &&
1448
+ "string" === typeof value.name &&
1449
+ "string" === typeof value.env &&
1450
+ void 0 !== value.owner &&
1451
+ "undefined" === typeof value.stack
1452
+ )
1453
+ return { name: value.name, env: value.env, owner: value.owner };
1430
1454
  if ("Object" !== objectName(value))
1431
1455
  error$jscomp$0(
1432
1456
  "Only plain objects can be passed to Client Components from Server Components. %s objects are not supported.%s",
@@ -1438,14 +1462,14 @@
1438
1462
  request = Object.getOwnPropertyNames(value);
1439
1463
  for (task = 0; task < request.length; task++)
1440
1464
  if (
1441
- ((_writtenObjects = Object.getOwnPropertyDescriptor(
1465
+ ((elementReference = Object.getOwnPropertyDescriptor(
1442
1466
  value,
1443
1467
  request[task]
1444
1468
  )),
1445
- !_writtenObjects ||
1446
- (!_writtenObjects.enumerable &&
1469
+ !elementReference ||
1470
+ (!elementReference.enumerable &&
1447
1471
  (("key" !== request[task] && "ref" !== request[task]) ||
1448
- "function" !== typeof _writtenObjects.get)))
1472
+ "function" !== typeof elementReference.get)))
1449
1473
  ) {
1450
1474
  request = !1;
1451
1475
  break a;
@@ -1542,11 +1566,11 @@
1542
1566
  }
1543
1567
  if ("symbol" === typeof value) {
1544
1568
  task = request.writtenSymbols;
1545
- _writtenObjects = task.get(value);
1546
- if (void 0 !== _writtenObjects)
1547
- return serializeByValueID(_writtenObjects);
1548
- _writtenObjects = value.description;
1549
- if (Symbol.for(_writtenObjects) !== value)
1569
+ elementReference = task.get(value);
1570
+ if (void 0 !== elementReference)
1571
+ return serializeByValueID(elementReference);
1572
+ elementReference = value.description;
1573
+ if (Symbol.for(elementReference) !== value)
1550
1574
  throw Error(
1551
1575
  "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" +
1552
1576
  (value.description + ") cannot be found among global symbols.") +
@@ -1557,7 +1581,7 @@
1557
1581
  parent = encodeReferenceChunk(
1558
1582
  request,
1559
1583
  parentPropertyName,
1560
- "$S" + _writtenObjects
1584
+ "$S" + elementReference
1561
1585
  );
1562
1586
  request.completedImportChunks.push(parent);
1563
1587
  task.set(value, parentPropertyName);
@@ -1808,7 +1832,10 @@
1808
1832
  }
1809
1833
  function forwardDebugInfo(request, id, debugInfo) {
1810
1834
  for (var i = 0; i < debugInfo.length; i++)
1811
- request.pendingChunks++, emitDebugChunk(request, id, debugInfo[i]);
1835
+ request.pendingChunks++,
1836
+ "string" === typeof debugInfo[i].name &&
1837
+ outlineModel(request, debugInfo[i]),
1838
+ emitDebugChunk(request, id, debugInfo[i]);
1812
1839
  }
1813
1840
  function emitChunk(request, task, value) {
1814
1841
  var id = task.id;
@@ -1861,14 +1888,20 @@
1861
1888
  modelRoot = resolvedModel;
1862
1889
  task.keyPath = null;
1863
1890
  task.implicitSlot = !1;
1864
- if ("object" === typeof resolvedModel && null !== resolvedModel)
1891
+ if ("object" === typeof resolvedModel && null !== resolvedModel) {
1865
1892
  request.writtenObjects.set(
1866
1893
  resolvedModel,
1867
1894
  serializeByValueID(task.id)
1868
- ),
1869
- emitChunk(request, task, resolvedModel);
1870
- else {
1871
- var json = stringify(resolvedModel);
1895
+ );
1896
+ var currentEnv = request.environmentName();
1897
+ currentEnv !== task.environmentName &&
1898
+ emitDebugChunk(request, task.id, { env: currentEnv });
1899
+ emitChunk(request, task, resolvedModel);
1900
+ } else {
1901
+ var json = stringify(resolvedModel),
1902
+ _currentEnv = request.environmentName();
1903
+ _currentEnv !== task.environmentName &&
1904
+ emitDebugChunk(request, task.id, { env: _currentEnv });
1872
1905
  emitModelChunk(request, task.id, json);
1873
1906
  }
1874
1907
  request.abortableTasks.delete(task);
@@ -1152,23 +1152,22 @@ function createTask(request, model, keyPath, implicitSlot, abortSet) {
1152
1152
  ? "$L" + JSCompiler_inline_result.id.toString(16)
1153
1153
  : serializeByValueID(JSCompiler_inline_result.id);
1154
1154
  }
1155
- else if (thrownValue === AbortSigil)
1156
- (task.status = 3),
1157
- (prevKeyPath = request.fatalError),
1158
- (JSCompiler_inline_result = parentPropertyName
1159
- ? "$L" + prevKeyPath.toString(16)
1160
- : serializeByValueID(prevKeyPath));
1161
- else if (
1162
- ((task.keyPath = prevKeyPath),
1163
- (task.implicitSlot = prevImplicitSlot),
1164
- parentPropertyName)
1165
- )
1166
- request.pendingChunks++,
1167
- (prevKeyPath = request.nextChunkId++),
1168
- (prevImplicitSlot = logRecoverableError(request, value)),
1169
- emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
1170
- (JSCompiler_inline_result = "$L" + prevKeyPath.toString(16));
1171
- else throw value;
1155
+ else
1156
+ thrownValue === AbortSigil
1157
+ ? ((task.status = 3),
1158
+ (prevKeyPath = request.fatalError),
1159
+ (JSCompiler_inline_result = parentPropertyName
1160
+ ? "$L" + prevKeyPath.toString(16)
1161
+ : serializeByValueID(prevKeyPath)))
1162
+ : ((task.keyPath = prevKeyPath),
1163
+ (task.implicitSlot = prevImplicitSlot),
1164
+ request.pendingChunks++,
1165
+ (prevKeyPath = request.nextChunkId++),
1166
+ (prevImplicitSlot = logRecoverableError(request, value)),
1167
+ emitErrorChunk(request, prevKeyPath, prevImplicitSlot),
1168
+ (JSCompiler_inline_result = parentPropertyName
1169
+ ? "$L" + prevKeyPath.toString(16)
1170
+ : serializeByValueID(prevKeyPath)));
1172
1171
  }
1173
1172
  return JSCompiler_inline_result;
1174
1173
  },
@@ -1298,7 +1297,8 @@ function renderModelDestructive(
1298
1297
  if ("object" === typeof value) {
1299
1298
  switch (value.$$typeof) {
1300
1299
  case REACT_ELEMENT_TYPE:
1301
- var writtenObjects = request.writtenObjects;
1300
+ var elementReference = null,
1301
+ writtenObjects = request.writtenObjects;
1302
1302
  if (null === task.keyPath && !task.implicitSlot) {
1303
1303
  var existingReference = writtenObjects.get(value);
1304
1304
  if (void 0 !== existingReference)
@@ -1308,11 +1308,12 @@ function renderModelDestructive(
1308
1308
  -1 === parentPropertyName.indexOf(":") &&
1309
1309
  ((parent = writtenObjects.get(parent)),
1310
1310
  void 0 !== parent &&
1311
- writtenObjects.set(value, parent + ":" + parentPropertyName));
1311
+ ((elementReference = parent + ":" + parentPropertyName),
1312
+ writtenObjects.set(value, elementReference)));
1312
1313
  }
1313
1314
  parentPropertyName = value.props;
1314
1315
  parent = parentPropertyName.ref;
1315
- return renderElement(
1316
+ request = renderElement(
1316
1317
  request,
1317
1318
  task,
1318
1319
  value.type,
@@ -1320,6 +1321,12 @@ function renderModelDestructive(
1320
1321
  void 0 !== parent ? parent : null,
1321
1322
  parentPropertyName
1322
1323
  );
1324
+ "object" === typeof request &&
1325
+ null !== request &&
1326
+ null !== elementReference &&
1327
+ (writtenObjects.has(request) ||
1328
+ writtenObjects.set(request, elementReference));
1329
+ return request;
1323
1330
  case REACT_LAZY_TYPE:
1324
1331
  task.thenableState = null;
1325
1332
  parentPropertyName = value._init;
@@ -1340,44 +1347,44 @@ function renderModelDestructive(
1340
1347
  );
1341
1348
  if (
1342
1349
  void 0 !== request.temporaryReferences &&
1343
- ((writtenObjects = request.temporaryReferences.get(value)),
1344
- void 0 !== writtenObjects)
1350
+ ((elementReference = request.temporaryReferences.get(value)),
1351
+ void 0 !== elementReference)
1345
1352
  )
1346
- return "$T" + writtenObjects;
1347
- writtenObjects = request.writtenObjects;
1348
- existingReference = writtenObjects.get(value);
1353
+ return "$T" + elementReference;
1354
+ elementReference = request.writtenObjects;
1355
+ writtenObjects = elementReference.get(value);
1349
1356
  if ("function" === typeof value.then) {
1350
- if (void 0 !== existingReference) {
1357
+ if (void 0 !== writtenObjects) {
1351
1358
  if (null !== task.keyPath || task.implicitSlot)
1352
1359
  return "$@" + serializeThenable(request, task, value).toString(16);
1353
1360
  if (modelRoot === value) modelRoot = null;
1354
- else return existingReference;
1361
+ else return writtenObjects;
1355
1362
  }
1356
1363
  request = "$@" + serializeThenable(request, task, value).toString(16);
1357
- writtenObjects.set(value, request);
1364
+ elementReference.set(value, request);
1358
1365
  return request;
1359
1366
  }
1360
- if (void 0 !== existingReference)
1367
+ if (void 0 !== writtenObjects)
1361
1368
  if (modelRoot === value) modelRoot = null;
1362
- else return existingReference;
1369
+ else return writtenObjects;
1363
1370
  else if (
1364
1371
  -1 === parentPropertyName.indexOf(":") &&
1365
- ((existingReference = writtenObjects.get(parent)),
1366
- void 0 !== existingReference)
1372
+ ((writtenObjects = elementReference.get(parent)),
1373
+ void 0 !== writtenObjects)
1367
1374
  ) {
1368
- var propertyName = parentPropertyName;
1375
+ existingReference = parentPropertyName;
1369
1376
  if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE)
1370
1377
  switch (parentPropertyName) {
1371
1378
  case "1":
1372
- propertyName = "type";
1379
+ existingReference = "type";
1373
1380
  break;
1374
1381
  case "2":
1375
- propertyName = "key";
1382
+ existingReference = "key";
1376
1383
  break;
1377
1384
  case "3":
1378
- propertyName = "props";
1385
+ existingReference = "props";
1379
1386
  }
1380
- writtenObjects.set(value, existingReference + ":" + propertyName);
1387
+ elementReference.set(value, writtenObjects + ":" + existingReference);
1381
1388
  }
1382
1389
  if (isArrayImpl(value)) return renderFragment(request, task, value);
1383
1390
  if (value instanceof Map)
@@ -1539,10 +1546,11 @@ function renderModelDestructive(
1539
1546
  }
1540
1547
  if ("symbol" === typeof value) {
1541
1548
  task = request.writtenSymbols;
1542
- writtenObjects = task.get(value);
1543
- if (void 0 !== writtenObjects) return serializeByValueID(writtenObjects);
1544
- writtenObjects = value.description;
1545
- if (Symbol.for(writtenObjects) !== value)
1549
+ elementReference = task.get(value);
1550
+ if (void 0 !== elementReference)
1551
+ return serializeByValueID(elementReference);
1552
+ elementReference = value.description;
1553
+ if (Symbol.for(elementReference) !== value)
1546
1554
  throw Error(
1547
1555
  "Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" +
1548
1556
  (value.description + ") cannot be found among global symbols.") +
@@ -1553,7 +1561,7 @@ function renderModelDestructive(
1553
1561
  parent = encodeReferenceChunk(
1554
1562
  request,
1555
1563
  parentPropertyName,
1556
- "$S" + writtenObjects
1564
+ "$S" + elementReference
1557
1565
  );
1558
1566
  request.completedImportChunks.push(parent);
1559
1567
  task.set(value, parentPropertyName);