Skip to content

Commit 4df9c84

Browse files

File tree

75 files changed

+4490
-3448
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+4490
-3448
lines changed

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,16 @@
197197
"random-seed": "0.3.0",
198198
"react": "18.2.0",
199199
"react-17": "npm:[email protected]",
200-
"react-builtin": "npm:[email protected]f1039be4a-20240107",
200+
"react-builtin": "npm:[email protected]60a927d04-20240113",
201201
"react-dom": "18.2.0",
202202
"react-dom-17": "npm:[email protected]",
203-
"react-dom-builtin": "npm:[email protected]f1039be4a-20240107",
204-
"react-dom-experimental-builtin": "npm:[email protected]f1039be4a-20240107",
205-
"react-experimental-builtin": "npm:[email protected]f1039be4a-20240107",
206-
"react-server-dom-turbopack": "18.3.0-canary-f1039be4a-20240107",
207-
"react-server-dom-turbopack-experimental": "npm:[email protected]f1039be4a-20240107",
208-
"react-server-dom-webpack": "18.3.0-canary-f1039be4a-20240107",
209-
"react-server-dom-webpack-experimental": "npm:[email protected]f1039be4a-20240107",
203+
"react-dom-builtin": "npm:[email protected]60a927d04-20240113",
204+
"react-dom-experimental-builtin": "npm:[email protected]60a927d04-20240113",
205+
"react-experimental-builtin": "npm:[email protected]60a927d04-20240113",
206+
"react-server-dom-turbopack": "18.3.0-canary-60a927d04-20240113",
207+
"react-server-dom-turbopack-experimental": "npm:[email protected]60a927d04-20240113",
208+
"react-server-dom-webpack": "18.3.0-canary-60a927d04-20240113",
209+
"react-server-dom-webpack-experimental": "npm:[email protected]60a927d04-20240113",
210210
"react-ssr-prepass": "1.0.8",
211211
"react-virtualized": "9.22.3",
212212
"relay-compiler": "13.0.2",
@@ -216,8 +216,8 @@
216216
"resolve-from": "5.0.0",
217217
"sass": "1.54.0",
218218
"satori": "0.10.9",
219-
"scheduler-builtin": "npm:[email protected]f1039be4a-20240107",
220-
"scheduler-experimental-builtin": "npm:[email protected]f1039be4a-20240107",
219+
"scheduler-builtin": "npm:[email protected]60a927d04-20240113",
220+
"scheduler-experimental-builtin": "npm:[email protected]60a927d04-20240113",
221221
"seedrandom": "3.0.5",
222222
"selenium-webdriver": "4.0.0-beta.4",
223223
"semver": "7.3.7",
@@ -258,4 +258,4 @@
258258
"pnpm": "8.14.0"
259259
},
260260
"packageManager": "[email protected]"
261-
}
261+
}

packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") {
1717
var React = require("next/dist/compiled/react-experimental");
1818
var ReactDOM = require('react-dom');
1919

20-
var ReactVersion = '18.3.0-experimental-f1039be4a-20240107';
20+
var ReactVersion = '18.3.0-experimental-60a927d04-20240113';
2121

2222
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2323

@@ -6673,22 +6673,22 @@ function getWrappedName(outerType, innerType, wrapperName) {
66736673

66746674
function getContextName(type) {
66756675
return type.displayName || 'Context';
6676-
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
6676+
}
66776677

6678+
var REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference'); // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
66786679

66796680
function getComponentNameFromType(type) {
66806681
if (type == null) {
66816682
// Host root, text node or just invalid type.
66826683
return null;
66836684
}
66846685

6685-
{
6686-
if (typeof type.tag === 'number') {
6687-
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
6686+
if (typeof type === 'function') {
6687+
if (type.$$typeof === REACT_CLIENT_REFERENCE) {
6688+
// TODO: Create a convention for naming client references with debug info.
6689+
return null;
66886690
}
6689-
}
66906691

6691-
if (typeof type === 'function') {
66926692
return type.displayName || type.name || null;
66936693
}
66946694

@@ -6723,6 +6723,12 @@ function getComponentNameFromType(type) {
67236723
}
67246724

67256725
if (typeof type === 'object') {
6726+
{
6727+
if (typeof type.tag === 'number') {
6728+
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
6729+
}
6730+
}
6731+
67266732
switch (type.$$typeof) {
67276733
case REACT_CONTEXT_TYPE:
67286734
var context = type;
@@ -9415,7 +9421,8 @@ function renderSuspenseBoundary(request, someTask, keyPath, props) {
94159421
errorDigest = logRecoverableError(request, error, thrownInfo);
94169422
}
94179423

9418-
encodeErrorForBoundary(newBoundary, errorDigest, error, thrownInfo); // We don't need to decrement any task numbers because we didn't spawn any new task.
9424+
encodeErrorForBoundary(newBoundary, errorDigest, error, thrownInfo);
9425+
untrackBoundary(request, newBoundary); // We don't need to decrement any task numbers because we didn't spawn any new task.
94199426
// We don't need to schedule any task because we know the parent has written yet.
94209427
// We do need to fallthrough to create the fallback though.
94219428
} finally {
@@ -10596,6 +10603,36 @@ function trackPostpone(request, trackedPostpones, task, segment) {
1059610603

1059710604
slots[task.childIndex] = segment.id;
1059810605
}
10606+
} // In case a boundary errors, we need to stop tracking it because we won't
10607+
// resume it.
10608+
10609+
10610+
function untrackBoundary(request, boundary) {
10611+
var trackedPostpones = request.trackedPostpones;
10612+
10613+
if (trackedPostpones === null) {
10614+
return;
10615+
}
10616+
10617+
var boundaryKeyPath = boundary.trackedContentKeyPath;
10618+
10619+
if (boundaryKeyPath === null) {
10620+
return;
10621+
}
10622+
10623+
var boundaryNode = trackedPostpones.workingMap.get(boundaryKeyPath);
10624+
10625+
if (boundaryNode === undefined) {
10626+
return;
10627+
} // Downgrade to plain ReplayNode since we won't replay through it.
10628+
// $FlowFixMe[cannot-write]: We intentionally downgrade this to the other tuple.
10629+
10630+
10631+
boundaryNode.length = 4; // Remove any resumable slots.
10632+
10633+
boundaryNode[2] = [];
10634+
boundaryNode[3] = null; // TODO: We should really just remove the boundary from all parent paths too so
10635+
// we don't replay the path to it.
1059910636
}
1060010637

1060110638
function injectPostponedHole(request, task, reason, thrownInfo) {
@@ -10814,7 +10851,8 @@ function erroredTask(request, boundary, error, errorInfo) {
1081410851

1081510852
if (boundary.status !== CLIENT_RENDERED) {
1081610853
boundary.status = CLIENT_RENDERED;
10817-
encodeErrorForBoundary(boundary, errorDigest, error, errorInfo); // Regardless of what happens next, this boundary won't be displayed,
10854+
encodeErrorForBoundary(boundary, errorDigest, error, errorInfo);
10855+
untrackBoundary(request, boundary); // Regardless of what happens next, this boundary won't be displayed,
1081810856
// so we can flush it, if the parent already flushed.
1081910857

1082010858
if (boundary.parentFlushed) {
@@ -10978,6 +11016,7 @@ function abortTask(task, request, error) {
1097811016
}
1097911017

1098011018
encodeErrorForBoundary(boundary, _errorDigest, errorMessage, _errorInfo);
11019+
untrackBoundary(request, boundary);
1098111020

1098211021
if (boundary.parentFlushed) {
1098311022
request.clientRenderedBoundaries.push(boundary);

packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.js

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function formatProdErrorMessage(code) {
2626
return "Minified React error #" + code + "; visit " + url + " for the full message or " + 'use the non-minified dev environment for full errors and additional ' + 'helpful warnings.';
2727
}
2828

29-
var ReactVersion = '18.3.0-experimental-f1039be4a-20240107';
29+
var ReactVersion = '18.3.0-experimental-60a927d04-20240113';
3030

3131
// A pure JS implementation of a string hashing function. We do not use it for
3232
// security or obfuscation purposes, only to create compact hashes. So we
@@ -4994,8 +4994,9 @@ function getWrappedName(outerType, innerType, wrapperName) {
49944994

49954995
function getContextName(type) {
49964996
return type.displayName || 'Context';
4997-
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
4997+
}
49984998

4999+
const REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference'); // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
49995000

50005001
function getComponentNameFromType(type) {
50015002
if (type == null) {
@@ -5004,6 +5005,11 @@ function getComponentNameFromType(type) {
50045005
}
50055006

50065007
if (typeof type === 'function') {
5008+
if (type.$$typeof === REACT_CLIENT_REFERENCE) {
5009+
// TODO: Create a convention for naming client references with debug info.
5010+
return null;
5011+
}
5012+
50075013
return type.displayName || type.name || null;
50085014
}
50095015

@@ -5038,6 +5044,7 @@ function getComponentNameFromType(type) {
50385044
}
50395045

50405046
if (typeof type === 'object') {
5047+
50415048
switch (type.$$typeof) {
50425049
case REACT_CONTEXT_TYPE:
50435050
const context = type;
@@ -6995,7 +7002,8 @@ function renderSuspenseBoundary(request, someTask, keyPath, props) {
69957002
errorDigest = logRecoverableError(request, error, thrownInfo);
69967003
}
69977004

6998-
encodeErrorForBoundary(newBoundary, errorDigest); // We don't need to decrement any task numbers because we didn't spawn any new task.
7005+
encodeErrorForBoundary(newBoundary, errorDigest);
7006+
untrackBoundary(request, newBoundary); // We don't need to decrement any task numbers because we didn't spawn any new task.
69997007
// We don't need to schedule any task because we know the parent has written yet.
70007008
// We do need to fallthrough to create the fallback though.
70017009
} finally {
@@ -7994,6 +8002,36 @@ function trackPostpone(request, trackedPostpones, task, segment) {
79948002

79958003
slots[task.childIndex] = segment.id;
79968004
}
8005+
} // In case a boundary errors, we need to stop tracking it because we won't
8006+
// resume it.
8007+
8008+
8009+
function untrackBoundary(request, boundary) {
8010+
const trackedPostpones = request.trackedPostpones;
8011+
8012+
if (trackedPostpones === null) {
8013+
return;
8014+
}
8015+
8016+
const boundaryKeyPath = boundary.trackedContentKeyPath;
8017+
8018+
if (boundaryKeyPath === null) {
8019+
return;
8020+
}
8021+
8022+
const boundaryNode = trackedPostpones.workingMap.get(boundaryKeyPath);
8023+
8024+
if (boundaryNode === undefined) {
8025+
return;
8026+
} // Downgrade to plain ReplayNode since we won't replay through it.
8027+
// $FlowFixMe[cannot-write]: We intentionally downgrade this to the other tuple.
8028+
8029+
8030+
boundaryNode.length = 4; // Remove any resumable slots.
8031+
8032+
boundaryNode[2] = [];
8033+
boundaryNode[3] = null; // TODO: We should really just remove the boundary from all parent paths too so
8034+
// we don't replay the path to it.
79978035
}
79988036

79998037
function injectPostponedHole(request, task, reason, thrownInfo) {
@@ -8210,7 +8248,8 @@ function erroredTask(request, boundary, error, errorInfo) {
82108248

82118249
if (boundary.status !== CLIENT_RENDERED) {
82128250
boundary.status = CLIENT_RENDERED;
8213-
encodeErrorForBoundary(boundary, errorDigest); // Regardless of what happens next, this boundary won't be displayed,
8251+
encodeErrorForBoundary(boundary, errorDigest);
8252+
untrackBoundary(request, boundary); // Regardless of what happens next, this boundary won't be displayed,
82148253
// so we can flush it, if the parent already flushed.
82158254

82168255
if (boundary.parentFlushed) {
@@ -8348,6 +8387,7 @@ function abortTask(task, request, error) {
83488387
const errorDigest = logRecoverableError(request, error, errorInfo);
83498388

83508389
encodeErrorForBoundary(boundary, errorDigest);
8390+
untrackBoundary(request, boundary);
83518391

83528392
if (boundary.parentFlushed) {
83538393
request.clientRenderedBoundaries.push(boundary);

0 commit comments

Comments
 (0)