Skip to content

File tree

187 files changed

+12210
-6157
lines changed

Some content is hidden

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

187 files changed

+12210
-6157
lines changed

package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,16 @@
198198
"random-seed": "0.3.0",
199199
"react": "18.2.0",
200200
"react-17": "npm:react@17.0.2",
201-
"react-builtin": "npm:react@18.3.0-canary-a515d753b-20240220",
201+
"react-builtin": "npm:react@18.3.0-canary-6c3b8dbfe-20240226",
202202
"react-dom": "18.2.0",
203203
"react-dom-17": "npm:react-dom@17.0.2",
204-
"react-dom-builtin": "npm:react-dom@18.3.0-canary-a515d753b-20240220",
205-
"react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-a515d753b-20240220",
206-
"react-experimental-builtin": "npm:react@0.0.0-experimental-a515d753b-20240220",
207-
"react-server-dom-turbopack": "18.3.0-canary-a515d753b-20240220",
208-
"react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-a515d753b-20240220",
209-
"react-server-dom-webpack": "18.3.0-canary-a515d753b-20240220",
210-
"react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-a515d753b-20240220",
204+
"react-dom-builtin": "npm:react-dom@18.3.0-canary-6c3b8dbfe-20240226",
205+
"react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-6c3b8dbfe-20240226",
206+
"react-experimental-builtin": "npm:react@0.0.0-experimental-6c3b8dbfe-20240226",
207+
"react-server-dom-turbopack": "18.3.0-canary-6c3b8dbfe-20240226",
208+
"react-server-dom-turbopack-experimental": "npm:react-server-dom-turbopack@0.0.0-experimental-6c3b8dbfe-20240226",
209+
"react-server-dom-webpack": "18.3.0-canary-6c3b8dbfe-20240226",
210+
"react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-6c3b8dbfe-20240226",
211211
"react-ssr-prepass": "1.0.8",
212212
"react-virtualized": "9.22.3",
213213
"relay-compiler": "13.0.2",
@@ -217,8 +217,8 @@
217217
"resolve-from": "5.0.0",
218218
"sass": "1.54.0",
219219
"satori": "0.10.9",
220-
"scheduler-builtin": "npm:scheduler@0.24.0-canary-a515d753b-20240220",
221-
"scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-a515d753b-20240220",
220+
"scheduler-builtin": "npm:scheduler@0.24.0-canary-6c3b8dbfe-20240226",
221+
"scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-6c3b8dbfe-20240226",
222222
"seedrandom": "3.0.5",
223223
"selenium-webdriver": "4.0.0-beta.4",
224224
"semver": "7.3.7",

packages/next/src/client/components/react-dev-overlay/internal/helpers/hydration-error-info.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export let hydrationErrorComponentStack: string | undefined
33

44
// https://github.com/facebook/react/blob/main/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js used as a reference
55
const knownHydrationWarnings = new Set([
6+
'Warning: In HTML, %s cannot be a descendant of <%s>.\nThis will cause a hydration error.%s',
67
'Warning: Text content did not match. Server: "%s" Client: "%s"%s',
78
'Warning: Expected server HTML to contain a matching <%s> in <%s>.%s',
89
'Warning: Expected server HTML to contain a matching text node for "%s" in <%s>.%s',

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

+55-20
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-a515d753b-20240220';
20+
var ReactVersion = '18.3.0-experimental-6c3b8dbfe-20240226';
2121

2222
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2323

@@ -74,9 +74,6 @@ function printWarning(level, format, args) {
7474
}
7575
}
7676

77-
// -----------------------------------------------------------------------------
78-
var enableFloat = true; // Enables unstable_useMemoCache hook, intended as a compilation target for
79-
8077
// ATTENTION
8178
// When adding new symbols to this file,
8279
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
@@ -615,6 +612,9 @@ function checkHtmlStringCoercion(value) {
615612
}
616613
}
617614

615+
// -----------------------------------------------------------------------------
616+
var enableFloat = true; // Enables unstable_useMemoCache hook, intended as a compilation target for
617+
618618
// $FlowFixMe[method-unbinding]
619619
var hasOwnProperty = Object.prototype.hasOwnProperty;
620620

@@ -1510,6 +1510,7 @@ function validateProperty(tagName, name, value, eventRegistry) {
15101510

15111511
case 'defaultChecked':
15121512
case 'innerHTML':
1513+
case 'ref':
15131514
{
15141515
return true;
15151516
}
@@ -1933,7 +1934,7 @@ var clientRenderBoundary = '$RX=function(b,c,d,e){var a=document.getElementById(
19331934
var completeBoundary = '$RC=function(b,c,e){c=document.getElementById(c);c.parentNode.removeChild(c);var a=document.getElementById(b);if(a){b=a.previousSibling;if(e)b.data="$!",a.setAttribute("data-dgst",e);else{e=b.parentNode;a=b.nextSibling;var f=0;do{if(a&&8===a.nodeType){var d=a.data;if("/$"===d)if(0===f)break;else f--;else"$"!==d&&"$?"!==d&&"$!"!==d||f++}d=a.nextSibling;e.removeChild(a);a=d}while(a);for(;c.firstChild;)e.insertBefore(c.firstChild,a);b.data="$"}b._reactRetry&&b._reactRetry()}};';
19341935
var completeBoundaryWithStyles = '$RM=new Map;\n$RR=function(r,t,w){for(var u=$RC,n=$RM,p=new Map,q=document,g,b,h=q.querySelectorAll("link[data-precedence],style[data-precedence]"),v=[],k=0;b=h[k++];)"not all"===b.getAttribute("media")?v.push(b):("LINK"===b.tagName&&n.set(b.getAttribute("href"),b),p.set(b.dataset.precedence,g=b));b=0;h=[];var l,a;for(k=!0;;){if(k){var f=w[b++];if(!f){k=!1;b=0;continue}var c=!1,m=0;var d=f[m++];if(a=n.get(d)){var e=a._p;c=!0}else{a=q.createElement("link");a.href=d;a.rel="stylesheet";for(a.dataset.precedence=\nl=f[m++];e=f[m++];)a.setAttribute(e,f[m++]);e=a._p=new Promise(function(x,y){a.onload=x;a.onerror=y});n.set(d,a)}d=a.getAttribute("media");!e||"l"===e.s||d&&!matchMedia(d).matches||h.push(e);if(c)continue}else{a=v[b++];if(!a)break;l=a.getAttribute("data-precedence");a.removeAttribute("media")}c=p.get(l)||g;c===g&&(g=a);p.set(l,a);c?c.parentNode.insertBefore(a,c.nextSibling):(c=q.head,c.insertBefore(a,c.firstChild))}Promise.all(h).then(u.bind(null,r,t,""),u.bind(null,r,t,"Resource failed to load"))};';
19351936
var completeSegment = '$RS=function(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};';
1936-
var formReplaying = 'addEventListener("submit",function(a){if(!a.defaultPrevented){var c=a.target,d=a.submitter,e=c.action,b=d;if(d){var f=d.getAttribute("formAction");null!=f&&(e=f,b=null)}"javascript:throw new Error(\'A React form was unexpectedly submitted.\')"===e&&(a.preventDefault(),b?(a=document.createElement("input"),a.name=b.name,a.value=b.value,b.parentNode.insertBefore(a,b),b=new FormData(c),a.parentNode.removeChild(a)):b=new FormData(c),a=c.getRootNode(),(a.$$reactFormReplay=a.$$reactFormReplay||[]).push(c,\nd,b))}});';
1937+
var formReplaying = 'addEventListener("submit",function(a){if(!a.defaultPrevented){var c=a.target,d=a.submitter,e=c.action,b=d;if(d){var f=d.getAttribute("formAction");null!=f&&(e=f,b=null)}"javascript:throw new Error(\'React form unexpectedly submitted.\')"===e&&(a.preventDefault(),b?(a=document.createElement("input"),a.name=b.name,a.value=b.value,b.parentNode.insertBefore(a,b),b=new FormData(c),a.parentNode.removeChild(a)):b=new FormData(c),a=c.ownerDocument||c,(a.$$reactFormReplay=a.$$reactFormReplay||[]).push(c,d,b))}});';
19371938

19381939
function getValueDescriptorExpectingObjectForWarning(thing) {
19391940
return thing === null ? '`null`' : thing === undefined ? '`undefined`' : thing === '' ? 'an empty string' : "something with type \"" + typeof thing + "\"";
@@ -2540,7 +2541,7 @@ function makeFormFieldPrefix(resumableState) {
25402541

25412542

25422543
var actionJavaScriptURL = stringToPrecomputedChunk(escapeTextForBrowser( // eslint-disable-next-line no-script-url
2543-
"javascript:throw new Error('A React form was unexpectedly submitted.')"));
2544+
"javascript:throw new Error('React form unexpectedly submitted.')"));
25442545
var startHiddenInputChunk = stringToPrecomputedChunk('<input type="hidden"');
25452546

25462547
function pushAdditionalFormField(value, key) {
@@ -2717,6 +2718,7 @@ function pushAttribute(target, name, value) // not null or undefined
27172718

27182719
case 'suppressContentEditableWarning':
27192720
case 'suppressHydrationWarning':
2721+
case 'ref':
27202722
// Ignored. These are built-in to React on the client.
27212723
return;
27222724

@@ -4469,6 +4471,7 @@ function pushStartCustomElement(target, props, tag) {
44694471

44704472
case 'suppressContentEditableWarning':
44714473
case 'suppressHydrationWarning':
4474+
case 'ref':
44724475
// Ignored. These are built-in to React on the client.
44734476
break;
44744477

@@ -5750,6 +5753,7 @@ function writeStyleResourceAttributeInJS(destination, name, value) // not null o
57505753
case 'suppressContentEditableWarning':
57515754
case 'suppressHydrationWarning':
57525755
case 'style':
5756+
case 'ref':
57535757
// Ignored
57545758
return;
57555759
// Attribute renames
@@ -5920,6 +5924,7 @@ function writeStyleResourceAttributeInAttr(destination, name, value) // not null
59205924
case 'suppressContentEditableWarning':
59215925
case 'suppressHydrationWarning':
59225926
case 'style':
5927+
case 'ref':
59235928
// Ignored
59245929
return;
59255930
// Attribute renames
@@ -7402,18 +7407,19 @@ var didWarnOnInvalidCallback;
74027407
didWarnOnInvalidCallback = new Set();
74037408
}
74047409

7405-
function warnOnInvalidCallback(callback, callerName) {
7410+
function warnOnInvalidCallback(callback) {
74067411
{
74077412
if (callback === null || typeof callback === 'function') {
74087413
return;
7409-
}
7414+
} // eslint-disable-next-line react-internal/safe-string-coercion
7415+
74107416

7411-
var key = callerName + '_' + callback;
7417+
var key = String(callback);
74127418

74137419
if (!didWarnOnInvalidCallback.has(key)) {
74147420
didWarnOnInvalidCallback.add(key);
74157421

7416-
error('%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
7422+
error('Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback);
74177423
}
74187424
}
74197425
}
@@ -7442,7 +7448,7 @@ function warnNoop(publicInstance, callerName) {
74427448
return;
74437449
}
74447450

7445-
error('%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
7451+
error('Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, componentName);
74467452

74477453
didWarnAboutNoopUpdateForComponent[warningKey] = true;
74487454
}
@@ -7463,7 +7469,7 @@ var classComponentUpdater = {
74637469

74647470
{
74657471
if (callback !== undefined && callback !== null) {
7466-
warnOnInvalidCallback(callback, 'setState');
7472+
warnOnInvalidCallback(callback);
74677473
}
74687474
}
74697475
}
@@ -7475,7 +7481,7 @@ var classComponentUpdater = {
74757481

74767482
{
74777483
if (callback !== undefined && callback !== null) {
7478-
warnOnInvalidCallback(callback, 'setState');
7484+
warnOnInvalidCallback(callback);
74797485
}
74807486
}
74817487
},
@@ -7488,7 +7494,7 @@ var classComponentUpdater = {
74887494
} else {
74897495
{
74907496
if (callback !== undefined && callback !== null) {
7491-
warnOnInvalidCallback(callback, 'setState');
7497+
warnOnInvalidCallback(callback);
74927498
}
74937499
}
74947500
}
@@ -7604,9 +7610,9 @@ function checkClassInstance(instance, ctor, newProps) {
76047610

76057611
if (!renderPresent) {
76067612
if (ctor.prototype && typeof ctor.prototype.render === 'function') {
7607-
error('%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name);
7613+
error('No `render` method found on the %s ' + 'instance: did you accidentally return an object from the constructor?', name);
76087614
} else {
7609-
error('%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name);
7615+
error('No `render` method found on the %s ' + 'instance: you may have forgotten to define `render`.', name);
76107616
}
76117617
}
76127618

@@ -7665,7 +7671,7 @@ function checkClassInstance(instance, ctor, newProps) {
76657671
var hasMutatedProps = instance.props !== newProps;
76667672

76677673
if (instance.props !== undefined && hasMutatedProps) {
7668-
error('%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name);
7674+
error('When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name);
76697675
}
76707676

76717677
if (instance.defaultProps) {
@@ -9984,7 +9990,7 @@ function validateFunctionComponentInDev(Component) {
99849990
{
99859991
if (Component) {
99869992
if (Component.childContextTypes) {
9987-
error('%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component');
9993+
error('childContextTypes cannot be defined on a function component.\n' + ' %s.childContextTypes = ...', Component.displayName || Component.name || 'Component');
99889994
}
99899995
}
99909996

@@ -10041,7 +10047,27 @@ function resolveDefaultProps(Component, baseProps) {
1004110047
function renderForwardRef(request, task, keyPath, type, props, ref) {
1004210048
var previousComponentStack = task.componentStack;
1004310049
task.componentStack = createFunctionComponentStack(task, type.render);
10044-
var children = renderWithHooks(request, task, keyPath, type.render, props, ref);
10050+
var propsWithoutRef;
10051+
10052+
if ('ref' in props) {
10053+
// `ref` is just a prop now, but `forwardRef` expects it to not appear in
10054+
// the props object. This used to happen in the JSX runtime, but now we do
10055+
// it here.
10056+
propsWithoutRef = {};
10057+
10058+
for (var key in props) {
10059+
// Since `ref` should only appear in props via the JSX transform, we can
10060+
// assume that this is a plain object. So we don't need a
10061+
// hasOwnProperty check.
10062+
if (key !== 'ref') {
10063+
propsWithoutRef[key] = props[key];
10064+
}
10065+
}
10066+
} else {
10067+
propsWithoutRef = props;
10068+
}
10069+
10070+
var children = renderWithHooks(request, task, keyPath, type.render, propsWithoutRef, ref);
1004510071
var hasId = checkDidRenderIdHook();
1004610072
var formStateCount = getFormStateCount();
1004710073
var formStateMatchingIndex = getFormStateMatchingIndex();
@@ -10433,7 +10459,16 @@ function renderNodeDestructive(request, task, node, childIndex) {
1043310459
var type = element.type;
1043410460
var key = element.key;
1043510461
var props = element.props;
10436-
var ref = element.ref;
10462+
var ref;
10463+
10464+
{
10465+
// TODO: This is a temporary, intermediate step. Once the feature
10466+
// flag is removed, we should get the ref off the props object right
10467+
// before using it.
10468+
var refProp = props.ref;
10469+
ref = refProp !== undefined ? refProp : null;
10470+
}
10471+
1043710472
var name = getComponentNameFromType(type);
1043810473
var keyOrIndex = key == null ? childIndex === -1 ? 0 : childIndex : key;
1043910474
var keyPath = [task.keyPath, name, keyOrIndex];

0 commit comments

Comments
 (0)