diff --git a/compiled/facebook-www/JSXDEVRuntime-dev.classic.js b/compiled/facebook-www/JSXDEVRuntime-dev.classic.js index 3e0f1328feaa9..72fde660a8c9c 100644 --- a/compiled/facebook-www/JSXDEVRuntime-dev.classic.js +++ b/compiled/facebook-www/JSXDEVRuntime-dev.classic.js @@ -91,8 +91,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -318,7 +318,9 @@ function checkPropStringCoercion(value, propName) { } } -var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference'); +var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference'); // This function is deprecated. Don't use. Only the renderer knows what a valid type is. +// TODO: Delete this when enableOwnerStacks ships. + function isValidElementType(type) { if (typeof type === 'string' || typeof type === 'function') { return true; @@ -716,7 +718,8 @@ function describeFunctionComponentFrame(fn) { function shouldConstruct(Component) { var prototype = Component.prototype; return !!(prototype && prototype.isReactComponent); -} +} // TODO: Delete this once the key warning no longer uses it. I.e. when enableOwnerStacks ship. + function describeUnknownElementTypeFrameInDEV(type) { @@ -1154,7 +1157,7 @@ function ReactElement(type, key, _ref, self, source, owner, props, debugStack, d configurable: false, enumerable: false, writable: true, - value: false + value: 0 }); // debugInfo contains Server Component debug information. Object.defineProperty(element, '_debugInfo', { @@ -1346,29 +1349,7 @@ function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) { } } - var element = ReactElement(type, key, ref, self, source, getOwner(), props); - - if (type === REACT_FRAGMENT_TYPE) { - validateFragmentProps(element); - } - - return element; - } -} - -function getDeclarationErrorAddendum() { - { - var owner = getOwner(); - - if (owner) { - var name = getComponentNameFromType(owner.type); - - if (name) { - return '\n\nCheck the render method of `' + name + '`.'; - } - } - - return ''; + return ReactElement(type, key, ref, self, source, getOwner(), props); } } /** @@ -1381,7 +1362,6 @@ function getDeclarationErrorAddendum() { * @param {*} parentType node's parent's type. */ - function validateChildKeys(node, parentType) { { if (typeof node !== 'object' || !node) { @@ -1399,7 +1379,7 @@ function validateChildKeys(node, parentType) { } else if (isValidElement(node)) { // This element was passed in a valid location. if (node._store) { - node._store.validated = true; + node._store.validated = 1; } } else { var iteratorFn = getIteratorFn(node); @@ -1450,12 +1430,13 @@ var ownerHasKeyUseWarning = {}; */ function validateExplicitKey(element, parentType) { + { if (!element._store || element._store.validated || element.key != null) { return; } - element._store.validated = true; + element._store.validated = 1; var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { @@ -1481,28 +1462,37 @@ function validateExplicitKey(element, parentType) { childOwner = " It was passed a child from " + ownerName + "."; } - setCurrentlyValidatingElement(element); + var prevGetCurrentStack = ReactSharedInternals.getCurrentStack; - error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); + ReactSharedInternals.getCurrentStack = function () { - setCurrentlyValidatingElement(null); - } -} + var stack = describeUnknownElementTypeFrameInDEV(element.type); // Delegate to the injected renderer-specific implementation -function setCurrentlyValidatingElement(element) { - { - if (element) { - var stack = describeUnknownElementTypeFrameInDEV(element.type); - ReactSharedInternals.setExtraStackFrame(stack); - } else { - ReactSharedInternals.setExtraStackFrame(null); - } + if (prevGetCurrentStack) { + stack += prevGetCurrentStack() || ''; + } + + return stack; + }; + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); + + ReactSharedInternals.getCurrentStack = prevGetCurrentStack; } } function getCurrentComponentErrorInfo(parentType) { { - var info = getDeclarationErrorAddendum(); + var info = ''; + var owner = getOwner(); + + if (owner) { + var name = getComponentNameFromType(owner.type); + + if (name) { + info = '\n\nCheck the render method of `' + name + '`.'; + } + } if (!info) { var parentName = getComponentNameFromType(parentType); @@ -1515,39 +1505,6 @@ function getCurrentComponentErrorInfo(parentType) { return info; } } -/** - * Given a fragment, validate that it can only be provided with fragment props - * @param {ReactElement} fragment - */ - - -function validateFragmentProps(fragment) { - // TODO: Move this to render phase instead of at element creation. - { - var keys = Object.keys(fragment.props); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - - if (key !== 'children' && key !== 'key') { - setCurrentlyValidatingElement(fragment); - - error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); - - setCurrentlyValidatingElement(null); - break; - } - } - - if (!enableRefAsProp && fragment.ref !== null) { - setCurrentlyValidatingElement(fragment); - - error('Invalid attribute `ref` supplied to `React.Fragment`.'); - - setCurrentlyValidatingElement(null); - } - } -} function coerceStringRef(mixedRef, owner, type) { diff --git a/compiled/facebook-www/JSXDEVRuntime-dev.modern.js b/compiled/facebook-www/JSXDEVRuntime-dev.modern.js index 51796d644913f..4a5f699351053 100644 --- a/compiled/facebook-www/JSXDEVRuntime-dev.modern.js +++ b/compiled/facebook-www/JSXDEVRuntime-dev.modern.js @@ -91,8 +91,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -318,7 +318,9 @@ function checkPropStringCoercion(value, propName) { } } -var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference'); +var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference'); // This function is deprecated. Don't use. Only the renderer knows what a valid type is. +// TODO: Delete this when enableOwnerStacks ships. + function isValidElementType(type) { if (typeof type === 'string' || typeof type === 'function') { return true; @@ -716,7 +718,8 @@ function describeFunctionComponentFrame(fn) { function shouldConstruct(Component) { var prototype = Component.prototype; return !!(prototype && prototype.isReactComponent); -} +} // TODO: Delete this once the key warning no longer uses it. I.e. when enableOwnerStacks ship. + function describeUnknownElementTypeFrameInDEV(type) { @@ -1157,7 +1160,7 @@ function ReactElement(type, key, _ref, self, source, owner, props, debugStack, d configurable: false, enumerable: false, writable: true, - value: false + value: 0 }); // debugInfo contains Server Component debug information. Object.defineProperty(element, '_debugInfo', { @@ -1349,29 +1352,7 @@ function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) { } } - var element = ReactElement(type, key, ref, self, source, getOwner(), props); - - if (type === REACT_FRAGMENT_TYPE) { - validateFragmentProps(element); - } - - return element; - } -} - -function getDeclarationErrorAddendum() { - { - var owner = getOwner(); - - if (owner) { - var name = getComponentNameFromType(owner.type); - - if (name) { - return '\n\nCheck the render method of `' + name + '`.'; - } - } - - return ''; + return ReactElement(type, key, ref, self, source, getOwner(), props); } } /** @@ -1384,7 +1365,6 @@ function getDeclarationErrorAddendum() { * @param {*} parentType node's parent's type. */ - function validateChildKeys(node, parentType) { { if (typeof node !== 'object' || !node) { @@ -1402,7 +1382,7 @@ function validateChildKeys(node, parentType) { } else if (isValidElement(node)) { // This element was passed in a valid location. if (node._store) { - node._store.validated = true; + node._store.validated = 1; } } else { var iteratorFn = getIteratorFn(node); @@ -1453,12 +1433,13 @@ var ownerHasKeyUseWarning = {}; */ function validateExplicitKey(element, parentType) { + { if (!element._store || element._store.validated || element.key != null) { return; } - element._store.validated = true; + element._store.validated = 1; var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { @@ -1484,28 +1465,37 @@ function validateExplicitKey(element, parentType) { childOwner = " It was passed a child from " + ownerName + "."; } - setCurrentlyValidatingElement(element); + var prevGetCurrentStack = ReactSharedInternals.getCurrentStack; - error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); + ReactSharedInternals.getCurrentStack = function () { - setCurrentlyValidatingElement(null); - } -} + var stack = describeUnknownElementTypeFrameInDEV(element.type); // Delegate to the injected renderer-specific implementation -function setCurrentlyValidatingElement(element) { - { - if (element) { - var stack = describeUnknownElementTypeFrameInDEV(element.type); - ReactSharedInternals.setExtraStackFrame(stack); - } else { - ReactSharedInternals.setExtraStackFrame(null); - } + if (prevGetCurrentStack) { + stack += prevGetCurrentStack() || ''; + } + + return stack; + }; + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); + + ReactSharedInternals.getCurrentStack = prevGetCurrentStack; } } function getCurrentComponentErrorInfo(parentType) { { - var info = getDeclarationErrorAddendum(); + var info = ''; + var owner = getOwner(); + + if (owner) { + var name = getComponentNameFromType(owner.type); + + if (name) { + info = '\n\nCheck the render method of `' + name + '`.'; + } + } if (!info) { var parentName = getComponentNameFromType(parentType); @@ -1518,39 +1508,6 @@ function getCurrentComponentErrorInfo(parentType) { return info; } } -/** - * Given a fragment, validate that it can only be provided with fragment props - * @param {ReactElement} fragment - */ - - -function validateFragmentProps(fragment) { - // TODO: Move this to render phase instead of at element creation. - { - var keys = Object.keys(fragment.props); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - - if (key !== 'children' && key !== 'key') { - setCurrentlyValidatingElement(fragment); - - error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); - - setCurrentlyValidatingElement(null); - break; - } - } - - if (!enableRefAsProp && fragment.ref !== null) { - setCurrentlyValidatingElement(fragment); - - error('Invalid attribute `ref` supplied to `React.Fragment`.'); - - setCurrentlyValidatingElement(null); - } - } -} function coerceStringRef(mixedRef, owner, type) { diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index ebe1927dab20f..d83a118da1b43 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -2e540e22b2b4038a278b2875306976b016fb31a9 +84239da896fd7395a667ab1e7ef1ef338a32de8f diff --git a/compiled/facebook-www/React-dev.classic.js b/compiled/facebook-www/React-dev.classic.js index ad0bfb5c2a4d7..02dbec55e08db 100644 --- a/compiled/facebook-www/React-dev.classic.js +++ b/compiled/facebook-www/React-dev.classic.js @@ -22,7 +22,7 @@ if ( ) { __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); } -var ReactVersion = '19.0.0-www-classic-95a9e838'; +var ReactVersion = '19.0.0-www-classic-87c03497'; // Re-export dynamic flags from the www version. var dynamicFeatureFlags = require('ReactFeatureFlags'); @@ -109,8 +109,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -572,38 +572,17 @@ var ReactSharedInternals = { ReactSharedInternals.isBatchingLegacy = false; ReactSharedInternals.didScheduleLegacyUpdate = false; ReactSharedInternals.didUsePromise = false; - ReactSharedInternals.thrownErrors = []; - var currentExtraStackFrame = null; - - ReactSharedInternals.setExtraStackFrame = function (stack) { - currentExtraStackFrame = stack; - }; // Stack implementation injected by the current renderer. - + ReactSharedInternals.thrownErrors = []; // Stack implementation injected by the current renderer. ReactSharedInternals.getCurrentStack = null; - - ReactSharedInternals.getStackAddendum = function () { - var stack = ''; // Add an extra top frame while an element is being validated - - if (currentExtraStackFrame) { - stack += currentExtraStackFrame; - } // Delegate to the injected renderer-specific implementation - - - var impl = ReactSharedInternals.getCurrentStack; - - if (impl) { - stack += impl() || ''; - } - - return stack; - }; } // $FlowFixMe[method-unbinding] var hasOwnProperty = Object.prototype.hasOwnProperty; -var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference'); +var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference'); // This function is deprecated. Don't use. Only the renderer knows what a valid type is. +// TODO: Delete this when enableOwnerStacks ships. + function isValidElementType(type) { if (typeof type === 'string' || typeof type === 'function') { return true; @@ -995,7 +974,8 @@ function describeFunctionComponentFrame(fn) { function shouldConstruct(Component) { var prototype = Component.prototype; return !!(prototype && prototype.isReactComponent); -} +} // TODO: Delete this once the key warning no longer uses it. I.e. when enableOwnerStacks ship. + function describeUnknownElementTypeFrameInDEV(type) { @@ -1434,7 +1414,7 @@ function ReactElement(type, key, _ref, self, source, owner, props, debugStack, d configurable: false, enumerable: false, writable: true, - value: false + value: 0 }); // debugInfo contains Server Component debug information. Object.defineProperty(element, '_debugInfo', { @@ -1650,13 +1630,7 @@ function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) { } } - var element = ReactElement(type, key, ref, self, source, getOwner(), props); - - if (type === REACT_FRAGMENT_TYPE) { - validateFragmentProps(element); - } - - return element; + return ReactElement(type, key, ref, self, source, getOwner(), props); } } /** @@ -1667,6 +1641,11 @@ function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) { function createElement(type, config, children) { { if (!isValidElementType(type)) { + // This is just an optimistic check that provides a better stack trace before + // owner stacks. It's really up to the renderer if it's a valid element type. + // When owner stacks are enabled, we instead warn in the renderer and it'll + // have the stack trace of the JSX element anyway. + // // This is an invalid element type. // // We warn in this case but don't throw. We expect the element creation to @@ -1811,13 +1790,7 @@ function createElement(type, config, children) { } } - var element = ReactElement(type, key, ref, undefined, undefined, getOwner(), props); - - if (type === REACT_FRAGMENT_TYPE) { - validateFragmentProps(element); - } - - return element; + return ReactElement(type, key, ref, undefined, undefined, getOwner(), props); } function cloneAndReplaceKey(oldElement, newKey) { return ReactElement(oldElement.type, newKey, // When enableRefAsProp is on, this argument is ignored. This check only @@ -1922,22 +1895,6 @@ function cloneElement(element, config, children) { return clonedElement; } - -function getDeclarationErrorAddendum() { - { - var owner = getOwner(); - - if (owner) { - var name = getComponentNameFromType(owner.type); - - if (name) { - return '\n\nCheck the render method of `' + name + '`.'; - } - } - - return ''; - } -} /** * Ensure that every element either is passed in a static location, in an * array with an explicit keys property defined, or in an object literal @@ -1948,7 +1905,6 @@ function getDeclarationErrorAddendum() { * @param {*} parentType node's parent's type. */ - function validateChildKeys(node, parentType) { { if (typeof node !== 'object' || !node) { @@ -1966,7 +1922,7 @@ function validateChildKeys(node, parentType) { } else if (isValidElement(node)) { // This element was passed in a valid location. if (node._store) { - node._store.validated = true; + node._store.validated = 1; } } else { var iteratorFn = getIteratorFn(node); @@ -2017,12 +1973,13 @@ var ownerHasKeyUseWarning = {}; */ function validateExplicitKey(element, parentType) { + { if (!element._store || element._store.validated || element.key != null) { return; } - element._store.validated = true; + element._store.validated = 1; var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { @@ -2048,28 +2005,37 @@ function validateExplicitKey(element, parentType) { childOwner = " It was passed a child from " + ownerName + "."; } - setCurrentlyValidatingElement(element); + var prevGetCurrentStack = ReactSharedInternals.getCurrentStack; - error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); + ReactSharedInternals.getCurrentStack = function () { - setCurrentlyValidatingElement(null); - } -} + var stack = describeUnknownElementTypeFrameInDEV(element.type); // Delegate to the injected renderer-specific implementation -function setCurrentlyValidatingElement(element) { - { - if (element) { - var stack = describeUnknownElementTypeFrameInDEV(element.type); - ReactSharedInternals.setExtraStackFrame(stack); - } else { - ReactSharedInternals.setExtraStackFrame(null); - } + if (prevGetCurrentStack) { + stack += prevGetCurrentStack() || ''; + } + + return stack; + }; + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); + + ReactSharedInternals.getCurrentStack = prevGetCurrentStack; } } function getCurrentComponentErrorInfo(parentType) { { - var info = getDeclarationErrorAddendum(); + var info = ''; + var owner = getOwner(); + + if (owner) { + var name = getComponentNameFromType(owner.type); + + if (name) { + info = '\n\nCheck the render method of `' + name + '`.'; + } + } if (!info) { var parentName = getComponentNameFromType(parentType); @@ -2082,39 +2048,6 @@ function getCurrentComponentErrorInfo(parentType) { return info; } } -/** - * Given a fragment, validate that it can only be provided with fragment props - * @param {ReactElement} fragment - */ - - -function validateFragmentProps(fragment) { - // TODO: Move this to render phase instead of at element creation. - { - var keys = Object.keys(fragment.props); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - - if (key !== 'children' && key !== 'key') { - setCurrentlyValidatingElement(fragment); - - error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); - - setCurrentlyValidatingElement(null); - break; - } - } - - if (!enableRefAsProp && fragment.ref !== null) { - setCurrentlyValidatingElement(fragment); - - error('Invalid attribute `ref` supplied to `React.Fragment`.'); - - setCurrentlyValidatingElement(null); - } - } -} function coerceStringRef(mixedRef, owner, type) { @@ -2369,17 +2302,32 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { // The `if` statement here prevents auto-disabling of the safe // coercion ESLint rule, so we must manually disable it below. // $FlowFixMe[incompatible-type] Flow incorrectly thinks React.Portal doesn't have a key - if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) { - checkKeyStringCoercion(mappedChild.key); + if (mappedChild.key != null) { + if (!_child || _child.key !== mappedChild.key) { + checkKeyStringCoercion(mappedChild.key); + } } } - mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as + var newChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as // traverseAllChildren used to do for objects as children escapedPrefix + ( // $FlowFixMe[incompatible-type] Flow incorrectly thinks React.Portal doesn't have a key - mappedChild.key && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey( // $FlowFixMe[unsafe-addition] + mappedChild.key != null && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey( // $FlowFixMe[unsafe-addition] '' + mappedChild.key // eslint-disable-line react-internal/safe-string-coercion ) + '/' : '') + childKey); + + { + if (nameSoFar !== '' && mappedChild.key == null) { + // We need to validate that this child should have had a key before assigning it one. + if (!newChild._store.validated) { + // We mark this child as having failed validation but we let the actual renderer + // print the warning later. + newChild._store.validated = 2; + } + } + } + + mappedChild = newChild; } array.push(mappedChild); diff --git a/compiled/facebook-www/React-dev.modern.js b/compiled/facebook-www/React-dev.modern.js index 9d2ef4d8361c2..499140807952b 100644 --- a/compiled/facebook-www/React-dev.modern.js +++ b/compiled/facebook-www/React-dev.modern.js @@ -22,7 +22,7 @@ if ( ) { __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); } -var ReactVersion = '19.0.0-www-modern-199d23a7'; +var ReactVersion = '19.0.0-www-modern-005a649e'; // Re-export dynamic flags from the www version. var dynamicFeatureFlags = require('ReactFeatureFlags'); @@ -109,8 +109,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -572,38 +572,17 @@ var ReactSharedInternals = { ReactSharedInternals.isBatchingLegacy = false; ReactSharedInternals.didScheduleLegacyUpdate = false; ReactSharedInternals.didUsePromise = false; - ReactSharedInternals.thrownErrors = []; - var currentExtraStackFrame = null; - - ReactSharedInternals.setExtraStackFrame = function (stack) { - currentExtraStackFrame = stack; - }; // Stack implementation injected by the current renderer. - + ReactSharedInternals.thrownErrors = []; // Stack implementation injected by the current renderer. ReactSharedInternals.getCurrentStack = null; - - ReactSharedInternals.getStackAddendum = function () { - var stack = ''; // Add an extra top frame while an element is being validated - - if (currentExtraStackFrame) { - stack += currentExtraStackFrame; - } // Delegate to the injected renderer-specific implementation - - - var impl = ReactSharedInternals.getCurrentStack; - - if (impl) { - stack += impl() || ''; - } - - return stack; - }; } // $FlowFixMe[method-unbinding] var hasOwnProperty = Object.prototype.hasOwnProperty; -var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference'); +var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference'); // This function is deprecated. Don't use. Only the renderer knows what a valid type is. +// TODO: Delete this when enableOwnerStacks ships. + function isValidElementType(type) { if (typeof type === 'string' || typeof type === 'function') { return true; @@ -995,7 +974,8 @@ function describeFunctionComponentFrame(fn) { function shouldConstruct(Component) { var prototype = Component.prototype; return !!(prototype && prototype.isReactComponent); -} +} // TODO: Delete this once the key warning no longer uses it. I.e. when enableOwnerStacks ship. + function describeUnknownElementTypeFrameInDEV(type) { @@ -1437,7 +1417,7 @@ function ReactElement(type, key, _ref, self, source, owner, props, debugStack, d configurable: false, enumerable: false, writable: true, - value: false + value: 0 }); // debugInfo contains Server Component debug information. Object.defineProperty(element, '_debugInfo', { @@ -1653,13 +1633,7 @@ function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) { } } - var element = ReactElement(type, key, ref, self, source, getOwner(), props); - - if (type === REACT_FRAGMENT_TYPE) { - validateFragmentProps(element); - } - - return element; + return ReactElement(type, key, ref, self, source, getOwner(), props); } } /** @@ -1670,6 +1644,11 @@ function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) { function createElement(type, config, children) { { if (!isValidElementType(type)) { + // This is just an optimistic check that provides a better stack trace before + // owner stacks. It's really up to the renderer if it's a valid element type. + // When owner stacks are enabled, we instead warn in the renderer and it'll + // have the stack trace of the JSX element anyway. + // // This is an invalid element type. // // We warn in this case but don't throw. We expect the element creation to @@ -1814,13 +1793,7 @@ function createElement(type, config, children) { } } - var element = ReactElement(type, key, ref, undefined, undefined, getOwner(), props); - - if (type === REACT_FRAGMENT_TYPE) { - validateFragmentProps(element); - } - - return element; + return ReactElement(type, key, ref, undefined, undefined, getOwner(), props); } function cloneAndReplaceKey(oldElement, newKey) { return ReactElement(oldElement.type, newKey, // When enableRefAsProp is on, this argument is ignored. This check only @@ -1925,22 +1898,6 @@ function cloneElement(element, config, children) { return clonedElement; } - -function getDeclarationErrorAddendum() { - { - var owner = getOwner(); - - if (owner) { - var name = getComponentNameFromType(owner.type); - - if (name) { - return '\n\nCheck the render method of `' + name + '`.'; - } - } - - return ''; - } -} /** * Ensure that every element either is passed in a static location, in an * array with an explicit keys property defined, or in an object literal @@ -1951,7 +1908,6 @@ function getDeclarationErrorAddendum() { * @param {*} parentType node's parent's type. */ - function validateChildKeys(node, parentType) { { if (typeof node !== 'object' || !node) { @@ -1969,7 +1925,7 @@ function validateChildKeys(node, parentType) { } else if (isValidElement(node)) { // This element was passed in a valid location. if (node._store) { - node._store.validated = true; + node._store.validated = 1; } } else { var iteratorFn = getIteratorFn(node); @@ -2020,12 +1976,13 @@ var ownerHasKeyUseWarning = {}; */ function validateExplicitKey(element, parentType) { + { if (!element._store || element._store.validated || element.key != null) { return; } - element._store.validated = true; + element._store.validated = 1; var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { @@ -2051,28 +2008,37 @@ function validateExplicitKey(element, parentType) { childOwner = " It was passed a child from " + ownerName + "."; } - setCurrentlyValidatingElement(element); + var prevGetCurrentStack = ReactSharedInternals.getCurrentStack; - error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); + ReactSharedInternals.getCurrentStack = function () { - setCurrentlyValidatingElement(null); - } -} + var stack = describeUnknownElementTypeFrameInDEV(element.type); // Delegate to the injected renderer-specific implementation -function setCurrentlyValidatingElement(element) { - { - if (element) { - var stack = describeUnknownElementTypeFrameInDEV(element.type); - ReactSharedInternals.setExtraStackFrame(stack); - } else { - ReactSharedInternals.setExtraStackFrame(null); - } + if (prevGetCurrentStack) { + stack += prevGetCurrentStack() || ''; + } + + return stack; + }; + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); + + ReactSharedInternals.getCurrentStack = prevGetCurrentStack; } } function getCurrentComponentErrorInfo(parentType) { { - var info = getDeclarationErrorAddendum(); + var info = ''; + var owner = getOwner(); + + if (owner) { + var name = getComponentNameFromType(owner.type); + + if (name) { + info = '\n\nCheck the render method of `' + name + '`.'; + } + } if (!info) { var parentName = getComponentNameFromType(parentType); @@ -2085,39 +2051,6 @@ function getCurrentComponentErrorInfo(parentType) { return info; } } -/** - * Given a fragment, validate that it can only be provided with fragment props - * @param {ReactElement} fragment - */ - - -function validateFragmentProps(fragment) { - // TODO: Move this to render phase instead of at element creation. - { - var keys = Object.keys(fragment.props); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - - if (key !== 'children' && key !== 'key') { - setCurrentlyValidatingElement(fragment); - - error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); - - setCurrentlyValidatingElement(null); - break; - } - } - - if (!enableRefAsProp && fragment.ref !== null) { - setCurrentlyValidatingElement(fragment); - - error('Invalid attribute `ref` supplied to `React.Fragment`.'); - - setCurrentlyValidatingElement(null); - } - } -} function coerceStringRef(mixedRef, owner, type) { @@ -2372,17 +2305,32 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { // The `if` statement here prevents auto-disabling of the safe // coercion ESLint rule, so we must manually disable it below. // $FlowFixMe[incompatible-type] Flow incorrectly thinks React.Portal doesn't have a key - if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) { - checkKeyStringCoercion(mappedChild.key); + if (mappedChild.key != null) { + if (!_child || _child.key !== mappedChild.key) { + checkKeyStringCoercion(mappedChild.key); + } } } - mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as + var newChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as // traverseAllChildren used to do for objects as children escapedPrefix + ( // $FlowFixMe[incompatible-type] Flow incorrectly thinks React.Portal doesn't have a key - mappedChild.key && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey( // $FlowFixMe[unsafe-addition] + mappedChild.key != null && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey( // $FlowFixMe[unsafe-addition] '' + mappedChild.key // eslint-disable-line react-internal/safe-string-coercion ) + '/' : '') + childKey); + + { + if (nameSoFar !== '' && mappedChild.key == null) { + // We need to validate that this child should have had a key before assigning it one. + if (!newChild._store.validated) { + // We mark this child as having failed validation but we let the actual renderer + // print the warning later. + newChild._store.validated = 2; + } + } + } + + mappedChild = newChild; } array.push(mappedChild); diff --git a/compiled/facebook-www/React-prod.classic.js b/compiled/facebook-www/React-prod.classic.js index 084307294efa8..4d0e2dc0d94f4 100644 --- a/compiled/facebook-www/React-prod.classic.js +++ b/compiled/facebook-www/React-prod.classic.js @@ -284,7 +284,8 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { (callback = cloneAndReplaceKey( callback, escapedPrefix + - (!callback.key || (children && children.key === callback.key) + (null == callback.key || + (children && children.key === callback.key) ? "" : ("" + callback.key).replace( userProvidedKeyEscapeRegex, @@ -684,4 +685,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-www-classic-af056f91"; +exports.version = "19.0.0-www-classic-e55b1679"; diff --git a/compiled/facebook-www/React-prod.modern.js b/compiled/facebook-www/React-prod.modern.js index 7887c56f22b77..8ec56819b300a 100644 --- a/compiled/facebook-www/React-prod.modern.js +++ b/compiled/facebook-www/React-prod.modern.js @@ -284,7 +284,8 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { (callback = cloneAndReplaceKey( callback, escapedPrefix + - (!callback.key || (children && children.key === callback.key) + (null == callback.key || + (children && children.key === callback.key) ? "" : ("" + callback.key).replace( userProvidedKeyEscapeRegex, @@ -684,4 +685,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-www-modern-af056f91"; +exports.version = "19.0.0-www-modern-e55b1679"; diff --git a/compiled/facebook-www/React-profiling.classic.js b/compiled/facebook-www/React-profiling.classic.js index da0cad706fb5c..13e5fe971c6eb 100644 --- a/compiled/facebook-www/React-profiling.classic.js +++ b/compiled/facebook-www/React-profiling.classic.js @@ -288,7 +288,8 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { (callback = cloneAndReplaceKey( callback, escapedPrefix + - (!callback.key || (children && children.key === callback.key) + (null == callback.key || + (children && children.key === callback.key) ? "" : ("" + callback.key).replace( userProvidedKeyEscapeRegex, @@ -688,7 +689,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-www-classic-cb3c2ab2"; +exports.version = "19.0.0-www-classic-3337290d"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/React-profiling.modern.js b/compiled/facebook-www/React-profiling.modern.js index 1edca9abcedbe..638049e79dfb2 100644 --- a/compiled/facebook-www/React-profiling.modern.js +++ b/compiled/facebook-www/React-profiling.modern.js @@ -288,7 +288,8 @@ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { (callback = cloneAndReplaceKey( callback, escapedPrefix + - (!callback.key || (children && children.key === callback.key) + (null == callback.key || + (children && children.key === callback.key) ? "" : ("" + callback.key).replace( userProvidedKeyEscapeRegex, @@ -688,7 +689,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-www-modern-cb3c2ab2"; +exports.version = "19.0.0-www-modern-3337290d"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/ReactART-dev.classic.js b/compiled/facebook-www/ReactART-dev.classic.js index ff4d5457d1509..deb705977fc54 100644 --- a/compiled/facebook-www/ReactART-dev.classic.js +++ b/compiled/facebook-www/ReactART-dev.classic.js @@ -60,7 +60,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = '19.0.0-www-classic-15c5a6dc'; +var ReactVersion = '19.0.0-www-classic-7d4c9d5a'; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -103,8 +103,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -6228,7 +6228,7 @@ var warnForMissingKey = function (child, returnFiber) {}; return; } - if (!child._store || child._store.validated || child.key != null) { + if (!child._store || (child._store.validated || child.key != null) && child._store.validated !== 2) { return; } @@ -6237,17 +6237,113 @@ var warnForMissingKey = function (child, returnFiber) {}; } // $FlowFixMe[cannot-write] unable to narrow type from mixed to writable object - child._store.validated = true; - var componentName = getComponentNameFromFiber(returnFiber) || 'Component'; + child._store.validated = 1; + var componentName = getComponentNameFromFiber(returnFiber); + var componentKey = componentName || 'null'; - if (ownerHasKeyUseWarning[componentName]) { + if (ownerHasKeyUseWarning[componentKey]) { return; } - ownerHasKeyUseWarning[componentName] = true; + ownerHasKeyUseWarning[componentKey] = true; + var childOwner = child._owner; + var parentOwner = returnFiber._debugOwner; + var currentComponentErrorInfo = ''; - error('Each child in a list should have a unique ' + '"key" prop. See https://react.dev/link/warning-keys for ' + 'more information.'); + if (parentOwner && typeof parentOwner.tag === 'number') { + var name = getComponentNameFromFiber(parentOwner); + + if (name) { + currentComponentErrorInfo = '\n\nCheck the render method of `' + name + '`.'; + } + } + + if (!currentComponentErrorInfo) { + if (componentName) { + currentComponentErrorInfo = "\n\nCheck the top-level render call using <" + componentName + ">."; + } + } // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + + + var childOwnerAppendix = ''; + + if (childOwner != null && parentOwner !== childOwner) { + var ownerName = null; + + if (typeof childOwner.tag === 'number') { + ownerName = getComponentNameFromFiber(childOwner); + } else if (typeof childOwner.name === 'string') { + ownerName = childOwner.name; + } + + if (ownerName) { + // Give the component that originally created this child. + childOwnerAppendix = " It was passed a child from " + ownerName + "."; + } + } // We create a fake Fiber for the child to log the stack trace from. + // TODO: Refactor the warnForMissingKey calls to happen after fiber creation + // so that we can get access to the fiber that will eventually be created. + // That way the log can show up associated with the right instance in DevTools. + + + var fiber = createFiberFromElement(child, returnFiber.mode, 0); + fiber.return = returnFiber; + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwnerAppendix); + + setCurrentFiber(prevDebugFiber); }; +} // Given a fragment, validate that it can only be provided with fragment props +// We do this here instead of BeginWork because the Fragment fiber doesn't have +// the whole props object, only the children and is shared with arrays. + + +function validateFragmentProps(element, fiber, returnFiber) { + { + var keys = Object.keys(element.props); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + + if (key !== 'children' && key !== 'key') { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); + + setCurrentFiber(prevDebugFiber); + break; + } + } + + if (!enableRefAsProp && element.ref !== null) { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var _prevDebugFiber = getCurrentFiber(); + + setCurrentFiber(fiber); + + error('Invalid attribute `ref` supplied to `React.Fragment`.'); + + setCurrentFiber(_prevDebugFiber); + } + } } function unwrapThenable(thenable) { @@ -6471,7 +6567,9 @@ function createChildReconciler(shouldTrackSideEffects) { var elementType = element.type; if (elementType === REACT_FRAGMENT_TYPE) { - return updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + var updated = updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + validateFragmentProps(element, updated, returnFiber); + return updated; } if (current !== null) { @@ -7215,6 +7313,7 @@ function createChildReconciler(shouldTrackSideEffects) { existing._debugInfo = debugInfo; } + validateFragmentProps(element, existing, returnFiber); return existing; } } else { @@ -7258,6 +7357,7 @@ function createChildReconciler(shouldTrackSideEffects) { created._debugInfo = debugInfo; } + validateFragmentProps(element, created, returnFiber); return created; } else { var _created4 = createFiberFromElement(element, returnFiber.mode, lanes); @@ -7320,6 +7420,7 @@ function createChildReconciler(shouldTrackSideEffects) { var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null; if (isUnkeyedTopLevelFragment) { + validateFragmentProps(newChild, null, returnFiber); newChild = newChild.props.children; } // Handle object types @@ -25832,10 +25933,22 @@ key, pendingProps, owner, mode, lanes) { } var info = ''; + var typeString; { if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; + info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; + } + + if (type === null) { + typeString = 'null'; + } else if (isArray(type)) { + typeString = 'array'; + } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { + typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; + info = ' Did you accidentally export a JSX literal instead of a component?'; + } else { + typeString = typeof type; } var ownerName = owner ? getComponentNameFromOwner(owner) : null; @@ -25845,7 +25958,7 @@ key, pendingProps, owner, mode, lanes) { } } - throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + (type == null ? type : typeof type) + "." + info)); + throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + typeString + "." + info)); } } } diff --git a/compiled/facebook-www/ReactART-dev.modern.js b/compiled/facebook-www/ReactART-dev.modern.js index cc447b8ff9824..9fa3cc7dd1da7 100644 --- a/compiled/facebook-www/ReactART-dev.modern.js +++ b/compiled/facebook-www/ReactART-dev.modern.js @@ -60,7 +60,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = '19.0.0-www-modern-1bbec70f'; +var ReactVersion = '19.0.0-www-modern-4793f209'; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -103,8 +103,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -6017,7 +6017,7 @@ var warnForMissingKey = function (child, returnFiber) {}; return; } - if (!child._store || child._store.validated || child.key != null) { + if (!child._store || (child._store.validated || child.key != null) && child._store.validated !== 2) { return; } @@ -6026,17 +6026,113 @@ var warnForMissingKey = function (child, returnFiber) {}; } // $FlowFixMe[cannot-write] unable to narrow type from mixed to writable object - child._store.validated = true; - var componentName = getComponentNameFromFiber(returnFiber) || 'Component'; + child._store.validated = 1; + var componentName = getComponentNameFromFiber(returnFiber); + var componentKey = componentName || 'null'; - if (ownerHasKeyUseWarning[componentName]) { + if (ownerHasKeyUseWarning[componentKey]) { return; } - ownerHasKeyUseWarning[componentName] = true; + ownerHasKeyUseWarning[componentKey] = true; + var childOwner = child._owner; + var parentOwner = returnFiber._debugOwner; + var currentComponentErrorInfo = ''; - error('Each child in a list should have a unique ' + '"key" prop. See https://react.dev/link/warning-keys for ' + 'more information.'); + if (parentOwner && typeof parentOwner.tag === 'number') { + var name = getComponentNameFromFiber(parentOwner); + + if (name) { + currentComponentErrorInfo = '\n\nCheck the render method of `' + name + '`.'; + } + } + + if (!currentComponentErrorInfo) { + if (componentName) { + currentComponentErrorInfo = "\n\nCheck the top-level render call using <" + componentName + ">."; + } + } // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + + + var childOwnerAppendix = ''; + + if (childOwner != null && parentOwner !== childOwner) { + var ownerName = null; + + if (typeof childOwner.tag === 'number') { + ownerName = getComponentNameFromFiber(childOwner); + } else if (typeof childOwner.name === 'string') { + ownerName = childOwner.name; + } + + if (ownerName) { + // Give the component that originally created this child. + childOwnerAppendix = " It was passed a child from " + ownerName + "."; + } + } // We create a fake Fiber for the child to log the stack trace from. + // TODO: Refactor the warnForMissingKey calls to happen after fiber creation + // so that we can get access to the fiber that will eventually be created. + // That way the log can show up associated with the right instance in DevTools. + + + var fiber = createFiberFromElement(child, returnFiber.mode, 0); + fiber.return = returnFiber; + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwnerAppendix); + + setCurrentFiber(prevDebugFiber); }; +} // Given a fragment, validate that it can only be provided with fragment props +// We do this here instead of BeginWork because the Fragment fiber doesn't have +// the whole props object, only the children and is shared with arrays. + + +function validateFragmentProps(element, fiber, returnFiber) { + { + var keys = Object.keys(element.props); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + + if (key !== 'children' && key !== 'key') { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); + + setCurrentFiber(prevDebugFiber); + break; + } + } + + if (!enableRefAsProp && element.ref !== null) { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var _prevDebugFiber = getCurrentFiber(); + + setCurrentFiber(fiber); + + error('Invalid attribute `ref` supplied to `React.Fragment`.'); + + setCurrentFiber(_prevDebugFiber); + } + } } function unwrapThenable(thenable) { @@ -6260,7 +6356,9 @@ function createChildReconciler(shouldTrackSideEffects) { var elementType = element.type; if (elementType === REACT_FRAGMENT_TYPE) { - return updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + var updated = updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + validateFragmentProps(element, updated, returnFiber); + return updated; } if (current !== null) { @@ -7004,6 +7102,7 @@ function createChildReconciler(shouldTrackSideEffects) { existing._debugInfo = debugInfo; } + validateFragmentProps(element, existing, returnFiber); return existing; } } else { @@ -7047,6 +7146,7 @@ function createChildReconciler(shouldTrackSideEffects) { created._debugInfo = debugInfo; } + validateFragmentProps(element, created, returnFiber); return created; } else { var _created4 = createFiberFromElement(element, returnFiber.mode, lanes); @@ -7109,6 +7209,7 @@ function createChildReconciler(shouldTrackSideEffects) { var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null; if (isUnkeyedTopLevelFragment) { + validateFragmentProps(newChild, null, returnFiber); newChild = newChild.props.children; } // Handle object types @@ -25117,10 +25218,22 @@ key, pendingProps, owner, mode, lanes) { } var info = ''; + var typeString; { if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; + info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; + } + + if (type === null) { + typeString = 'null'; + } else if (isArray(type)) { + typeString = 'array'; + } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { + typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; + info = ' Did you accidentally export a JSX literal instead of a component?'; + } else { + typeString = typeof type; } var ownerName = owner ? getComponentNameFromOwner(owner) : null; @@ -25130,7 +25243,7 @@ key, pendingProps, owner, mode, lanes) { } } - throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + (type == null ? type : typeof type) + "." + info)); + throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + typeString + "." + info)); } } } diff --git a/compiled/facebook-www/ReactART-prod.classic.js b/compiled/facebook-www/ReactART-prod.classic.js index 24bfc50f45494..f83c756605ceb 100644 --- a/compiled/facebook-www/ReactART-prod.classic.js +++ b/compiled/facebook-www/ReactART-prod.classic.js @@ -10324,7 +10324,7 @@ function createFiberFromTypeAndProps( break a; } throw Error( - formatProdErrorMessage(130, null == type ? type : typeof type, "") + formatProdErrorMessage(130, null === type ? "null" : typeof type, "") ); } pendingProps = createFiber(fiberTag, pendingProps, key, mode); @@ -10648,7 +10648,7 @@ var slice = Array.prototype.slice, return null; }, bundleType: 0, - version: "19.0.0-www-classic-a5d5fa11", + version: "19.0.0-www-classic-5df18b01", rendererPackageName: "react-art" }; var internals$jscomp$inline_1358 = { @@ -10679,7 +10679,7 @@ var internals$jscomp$inline_1358 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-a5d5fa11" + reconcilerVersion: "19.0.0-www-classic-5df18b01" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1359 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled/facebook-www/ReactART-prod.modern.js b/compiled/facebook-www/ReactART-prod.modern.js index 38d1b3066f8d3..5c4f8c23863fa 100644 --- a/compiled/facebook-www/ReactART-prod.modern.js +++ b/compiled/facebook-www/ReactART-prod.modern.js @@ -9839,7 +9839,7 @@ function createFiberFromTypeAndProps( break a; } throw Error( - formatProdErrorMessage(130, null == type ? type : typeof type, "") + formatProdErrorMessage(130, null === type ? "null" : typeof type, "") ); } pendingProps = createFiber(fiberTag, pendingProps, key, mode); @@ -10123,7 +10123,7 @@ var slice = Array.prototype.slice, return null; }, bundleType: 0, - version: "19.0.0-www-modern-fd88c001", + version: "19.0.0-www-modern-0d2856c7", rendererPackageName: "react-art" }; var internals$jscomp$inline_1345 = { @@ -10154,7 +10154,7 @@ var internals$jscomp$inline_1345 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-fd88c001" + reconcilerVersion: "19.0.0-www-modern-0d2856c7" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1346 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled/facebook-www/ReactCacheOld-dev.classic.js b/compiled/facebook-www/ReactCacheOld-dev.classic.js index 6e1994d6fa984..4a31386ddef3d 100644 --- a/compiled/facebook-www/ReactCacheOld-dev.classic.js +++ b/compiled/facebook-www/ReactCacheOld-dev.classic.js @@ -39,8 +39,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; diff --git a/compiled/facebook-www/ReactCacheOld-dev.modern.js b/compiled/facebook-www/ReactCacheOld-dev.modern.js index 6e1994d6fa984..4a31386ddef3d 100644 --- a/compiled/facebook-www/ReactCacheOld-dev.modern.js +++ b/compiled/facebook-www/ReactCacheOld-dev.modern.js @@ -39,8 +39,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; diff --git a/compiled/facebook-www/ReactDOM-dev.classic.js b/compiled/facebook-www/ReactDOM-dev.classic.js index 4c26c12c967cb..808aaa968a1fd 100644 --- a/compiled/facebook-www/ReactDOM-dev.classic.js +++ b/compiled/facebook-www/ReactDOM-dev.classic.js @@ -65,8 +65,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -9832,7 +9832,7 @@ var warnForMissingKey = function (child, returnFiber) {}; return; } - if (!child._store || child._store.validated || child.key != null) { + if (!child._store || (child._store.validated || child.key != null) && child._store.validated !== 2) { return; } @@ -9841,17 +9841,113 @@ var warnForMissingKey = function (child, returnFiber) {}; } // $FlowFixMe[cannot-write] unable to narrow type from mixed to writable object - child._store.validated = true; - var componentName = getComponentNameFromFiber(returnFiber) || 'Component'; + child._store.validated = 1; + var componentName = getComponentNameFromFiber(returnFiber); + var componentKey = componentName || 'null'; - if (ownerHasKeyUseWarning[componentName]) { + if (ownerHasKeyUseWarning[componentKey]) { return; } - ownerHasKeyUseWarning[componentName] = true; + ownerHasKeyUseWarning[componentKey] = true; + var childOwner = child._owner; + var parentOwner = returnFiber._debugOwner; + var currentComponentErrorInfo = ''; - error('Each child in a list should have a unique ' + '"key" prop. See https://react.dev/link/warning-keys for ' + 'more information.'); + if (parentOwner && typeof parentOwner.tag === 'number') { + var name = getComponentNameFromFiber(parentOwner); + + if (name) { + currentComponentErrorInfo = '\n\nCheck the render method of `' + name + '`.'; + } + } + + if (!currentComponentErrorInfo) { + if (componentName) { + currentComponentErrorInfo = "\n\nCheck the top-level render call using <" + componentName + ">."; + } + } // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + + + var childOwnerAppendix = ''; + + if (childOwner != null && parentOwner !== childOwner) { + var ownerName = null; + + if (typeof childOwner.tag === 'number') { + ownerName = getComponentNameFromFiber(childOwner); + } else if (typeof childOwner.name === 'string') { + ownerName = childOwner.name; + } + + if (ownerName) { + // Give the component that originally created this child. + childOwnerAppendix = " It was passed a child from " + ownerName + "."; + } + } // We create a fake Fiber for the child to log the stack trace from. + // TODO: Refactor the warnForMissingKey calls to happen after fiber creation + // so that we can get access to the fiber that will eventually be created. + // That way the log can show up associated with the right instance in DevTools. + + + var fiber = createFiberFromElement(child, returnFiber.mode, 0); + fiber.return = returnFiber; + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwnerAppendix); + + setCurrentFiber(prevDebugFiber); }; +} // Given a fragment, validate that it can only be provided with fragment props +// We do this here instead of BeginWork because the Fragment fiber doesn't have +// the whole props object, only the children and is shared with arrays. + + +function validateFragmentProps(element, fiber, returnFiber) { + { + var keys = Object.keys(element.props); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + + if (key !== 'children' && key !== 'key') { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); + + setCurrentFiber(prevDebugFiber); + break; + } + } + + if (!enableRefAsProp && element.ref !== null) { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var _prevDebugFiber = getCurrentFiber(); + + setCurrentFiber(fiber); + + error('Invalid attribute `ref` supplied to `React.Fragment`.'); + + setCurrentFiber(_prevDebugFiber); + } + } } function unwrapThenable(thenable) { @@ -10075,7 +10171,9 @@ function createChildReconciler(shouldTrackSideEffects) { var elementType = element.type; if (elementType === REACT_FRAGMENT_TYPE) { - return updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + var updated = updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + validateFragmentProps(element, updated, returnFiber); + return updated; } if (current !== null) { @@ -10849,6 +10947,7 @@ function createChildReconciler(shouldTrackSideEffects) { existing._debugInfo = debugInfo; } + validateFragmentProps(element, existing, returnFiber); return existing; } } else { @@ -10892,6 +10991,7 @@ function createChildReconciler(shouldTrackSideEffects) { created._debugInfo = debugInfo; } + validateFragmentProps(element, created, returnFiber); return created; } else { var _created4 = createFiberFromElement(element, returnFiber.mode, lanes); @@ -10954,6 +11054,7 @@ function createChildReconciler(shouldTrackSideEffects) { var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null; if (isUnkeyedTopLevelFragment) { + validateFragmentProps(newChild, null, returnFiber); newChild = newChild.props.children; } // Handle object types @@ -30581,10 +30682,22 @@ key, pendingProps, owner, mode, lanes) { } var info = ''; + var typeString; { if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; + info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; + } + + if (type === null) { + typeString = 'null'; + } else if (isArray(type)) { + typeString = 'array'; + } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { + typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; + info = ' Did you accidentally export a JSX literal instead of a component?'; + } else { + typeString = typeof type; } var ownerName = owner ? getComponentNameFromOwner(owner) : null; @@ -30594,7 +30707,7 @@ key, pendingProps, owner, mode, lanes) { } } - throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + (type == null ? type : typeof type) + "." + info)); + throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + typeString + "." + info)); } } } @@ -30883,7 +30996,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-classic-6551c42e'; +var ReactVersion = '19.0.0-www-classic-6cb291b1'; function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation. implementation) { diff --git a/compiled/facebook-www/ReactDOM-dev.modern.js b/compiled/facebook-www/ReactDOM-dev.modern.js index d633a28c2c744..2f04320a45a6f 100644 --- a/compiled/facebook-www/ReactDOM-dev.modern.js +++ b/compiled/facebook-www/ReactDOM-dev.modern.js @@ -65,8 +65,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -9573,7 +9573,7 @@ var warnForMissingKey = function (child, returnFiber) {}; return; } - if (!child._store || child._store.validated || child.key != null) { + if (!child._store || (child._store.validated || child.key != null) && child._store.validated !== 2) { return; } @@ -9582,17 +9582,113 @@ var warnForMissingKey = function (child, returnFiber) {}; } // $FlowFixMe[cannot-write] unable to narrow type from mixed to writable object - child._store.validated = true; - var componentName = getComponentNameFromFiber(returnFiber) || 'Component'; + child._store.validated = 1; + var componentName = getComponentNameFromFiber(returnFiber); + var componentKey = componentName || 'null'; - if (ownerHasKeyUseWarning[componentName]) { + if (ownerHasKeyUseWarning[componentKey]) { return; } - ownerHasKeyUseWarning[componentName] = true; + ownerHasKeyUseWarning[componentKey] = true; + var childOwner = child._owner; + var parentOwner = returnFiber._debugOwner; + var currentComponentErrorInfo = ''; - error('Each child in a list should have a unique ' + '"key" prop. See https://react.dev/link/warning-keys for ' + 'more information.'); + if (parentOwner && typeof parentOwner.tag === 'number') { + var name = getComponentNameFromFiber(parentOwner); + + if (name) { + currentComponentErrorInfo = '\n\nCheck the render method of `' + name + '`.'; + } + } + + if (!currentComponentErrorInfo) { + if (componentName) { + currentComponentErrorInfo = "\n\nCheck the top-level render call using <" + componentName + ">."; + } + } // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + + + var childOwnerAppendix = ''; + + if (childOwner != null && parentOwner !== childOwner) { + var ownerName = null; + + if (typeof childOwner.tag === 'number') { + ownerName = getComponentNameFromFiber(childOwner); + } else if (typeof childOwner.name === 'string') { + ownerName = childOwner.name; + } + + if (ownerName) { + // Give the component that originally created this child. + childOwnerAppendix = " It was passed a child from " + ownerName + "."; + } + } // We create a fake Fiber for the child to log the stack trace from. + // TODO: Refactor the warnForMissingKey calls to happen after fiber creation + // so that we can get access to the fiber that will eventually be created. + // That way the log can show up associated with the right instance in DevTools. + + + var fiber = createFiberFromElement(child, returnFiber.mode, 0); + fiber.return = returnFiber; + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwnerAppendix); + + setCurrentFiber(prevDebugFiber); }; +} // Given a fragment, validate that it can only be provided with fragment props +// We do this here instead of BeginWork because the Fragment fiber doesn't have +// the whole props object, only the children and is shared with arrays. + + +function validateFragmentProps(element, fiber, returnFiber) { + { + var keys = Object.keys(element.props); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + + if (key !== 'children' && key !== 'key') { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); + + setCurrentFiber(prevDebugFiber); + break; + } + } + + if (!enableRefAsProp && element.ref !== null) { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var _prevDebugFiber = getCurrentFiber(); + + setCurrentFiber(fiber); + + error('Invalid attribute `ref` supplied to `React.Fragment`.'); + + setCurrentFiber(_prevDebugFiber); + } + } } function unwrapThenable(thenable) { @@ -9816,7 +9912,9 @@ function createChildReconciler(shouldTrackSideEffects) { var elementType = element.type; if (elementType === REACT_FRAGMENT_TYPE) { - return updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + var updated = updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + validateFragmentProps(element, updated, returnFiber); + return updated; } if (current !== null) { @@ -10590,6 +10688,7 @@ function createChildReconciler(shouldTrackSideEffects) { existing._debugInfo = debugInfo; } + validateFragmentProps(element, existing, returnFiber); return existing; } } else { @@ -10633,6 +10732,7 @@ function createChildReconciler(shouldTrackSideEffects) { created._debugInfo = debugInfo; } + validateFragmentProps(element, created, returnFiber); return created; } else { var _created4 = createFiberFromElement(element, returnFiber.mode, lanes); @@ -10695,6 +10795,7 @@ function createChildReconciler(shouldTrackSideEffects) { var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null; if (isUnkeyedTopLevelFragment) { + validateFragmentProps(newChild, null, returnFiber); newChild = newChild.props.children; } // Handle object types @@ -29763,10 +29864,22 @@ key, pendingProps, owner, mode, lanes) { } var info = ''; + var typeString; { if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; + info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; + } + + if (type === null) { + typeString = 'null'; + } else if (isArray(type)) { + typeString = 'array'; + } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { + typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; + info = ' Did you accidentally export a JSX literal instead of a component?'; + } else { + typeString = typeof type; } var ownerName = owner ? getComponentNameFromOwner(owner) : null; @@ -29776,7 +29889,7 @@ key, pendingProps, owner, mode, lanes) { } } - throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + (type == null ? type : typeof type) + "." + info)); + throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + typeString + "." + info)); } } } @@ -30058,7 +30171,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-modern-c6c71924'; +var ReactVersion = '19.0.0-www-modern-4d273f8e'; function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation. implementation) { diff --git a/compiled/facebook-www/ReactDOM-prod.classic.js b/compiled/facebook-www/ReactDOM-prod.classic.js index 0a17750c49cb5..de9b59742f729 100644 --- a/compiled/facebook-www/ReactDOM-prod.classic.js +++ b/compiled/facebook-www/ReactDOM-prod.classic.js @@ -12206,7 +12206,7 @@ function createFiberFromTypeAndProps( break a; } throw Error( - formatProdErrorMessage(130, null == type ? type : typeof type, "") + formatProdErrorMessage(130, null === type ? "null" : typeof type, "") ); } pendingProps = createFiber(fiberTag, pendingProps, key, mode); @@ -17069,7 +17069,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1746 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-classic-ad74bc60", + version: "19.0.0-www-classic-824db2c5", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2190 = { @@ -17099,7 +17099,7 @@ var internals$jscomp$inline_2190 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-ad74bc60" + reconcilerVersion: "19.0.0-www-classic-824db2c5" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2191 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -17603,4 +17603,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-classic-ad74bc60"; +exports.version = "19.0.0-www-classic-824db2c5"; diff --git a/compiled/facebook-www/ReactDOM-prod.modern.js b/compiled/facebook-www/ReactDOM-prod.modern.js index 90529eb173779..6ae0370401a36 100644 --- a/compiled/facebook-www/ReactDOM-prod.modern.js +++ b/compiled/facebook-www/ReactDOM-prod.modern.js @@ -11680,7 +11680,7 @@ function createFiberFromTypeAndProps( break a; } throw Error( - formatProdErrorMessage(130, null == type ? type : typeof type, "") + formatProdErrorMessage(130, null === type ? "null" : typeof type, "") ); } pendingProps = createFiber(fiberTag, pendingProps, key, mode); @@ -16432,7 +16432,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1713 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-modern-72670d98", + version: "19.0.0-www-modern-3717c12a", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2182 = { @@ -16462,7 +16462,7 @@ var internals$jscomp$inline_2182 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-72670d98" + reconcilerVersion: "19.0.0-www-modern-3717c12a" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2183 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -16836,4 +16836,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-modern-72670d98"; +exports.version = "19.0.0-www-modern-3717c12a"; diff --git a/compiled/facebook-www/ReactDOM-profiling.classic.js b/compiled/facebook-www/ReactDOM-profiling.classic.js index 32d5596929d38..247e5a8420580 100644 --- a/compiled/facebook-www/ReactDOM-profiling.classic.js +++ b/compiled/facebook-www/ReactDOM-profiling.classic.js @@ -12960,7 +12960,7 @@ function createFiberFromTypeAndProps( break a; } throw Error( - formatProdErrorMessage(130, null == type ? type : typeof type, "") + formatProdErrorMessage(130, null === type ? "null" : typeof type, "") ); } pendingProps = createFiber(fiberTag, pendingProps, key, mode); @@ -17833,7 +17833,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1832 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-classic-97671a1d", + version: "19.0.0-www-classic-2c907cc2", rendererPackageName: "react-dom" }; (function (internals) { @@ -17877,7 +17877,7 @@ var devToolsConfig$jscomp$inline_1832 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-97671a1d" + reconcilerVersion: "19.0.0-www-classic-2c907cc2" }); function ReactDOMRoot(internalRoot) { this._internalRoot = internalRoot; @@ -18368,7 +18368,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-classic-97671a1d"; +exports.version = "19.0.0-www-classic-2c907cc2"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/ReactDOM-profiling.modern.js b/compiled/facebook-www/ReactDOM-profiling.modern.js index 137cdf2c54faf..4e8fb7f098951 100644 --- a/compiled/facebook-www/ReactDOM-profiling.modern.js +++ b/compiled/facebook-www/ReactDOM-profiling.modern.js @@ -12417,7 +12417,7 @@ function createFiberFromTypeAndProps( break a; } throw Error( - formatProdErrorMessage(130, null == type ? type : typeof type, "") + formatProdErrorMessage(130, null === type ? "null" : typeof type, "") ); } pendingProps = createFiber(fiberTag, pendingProps, key, mode); @@ -17179,7 +17179,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1799 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-modern-7cb427ce", + version: "19.0.0-www-modern-c13878e0", rendererPackageName: "react-dom" }; (function (internals) { @@ -17223,7 +17223,7 @@ var devToolsConfig$jscomp$inline_1799 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-7cb427ce" + reconcilerVersion: "19.0.0-www-modern-c13878e0" }); function ReactDOMRoot(internalRoot) { this._internalRoot = internalRoot; @@ -17584,7 +17584,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-modern-7cb427ce"; +exports.version = "19.0.0-www-modern-c13878e0"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/ReactDOMServer-dev.classic.js b/compiled/facebook-www/ReactDOMServer-dev.classic.js index 16aa38df45ad7..a10bf2eb2f97b 100644 --- a/compiled/facebook-www/ReactDOMServer-dev.classic.js +++ b/compiled/facebook-www/ReactDOMServer-dev.classic.js @@ -19,7 +19,7 @@ if (__DEV__) { var React = require('react'); var ReactDOM = require('react-dom'); -var ReactVersion = '19.0.0-www-classic-81f51e28'; +var ReactVersion = '19.0.0-www-classic-6febc8c5'; // This refers to a WWW module. var warningWWW = require('warning'); @@ -52,8 +52,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -9401,7 +9401,12 @@ function createRequest(children, resumableState, renderState, rootFormatContext, onShellError: onShellError === undefined ? noop : onShellError, onFatalError: onFatalError === undefined ? noop : onFatalError, formState: formState === undefined ? null : formState - }; // This segment represents the root fallback. + }; + + { + request.didWarnForKey = null; + } // This segment represents the root fallback. + var rootSegment = createPendingSegment(request, 0, null, rootFormatContext, // Root segments are never embedded in Text on either edge false, false); // There is no parent so conceptually, we're unblocked to flush this segment. @@ -9578,6 +9583,18 @@ function createClassComponentStack(task, type) { parent: task.componentStack, type: type }; +} + +function createComponentStackFromType(task, type) { + if (typeof type === 'string') { + return createBuiltInComponentStack(task, type); + } + + if (shouldConstruct(type)) { + return createClassComponentStack(task, type); + } + + return createFunctionComponentStack(task, type); } // While we track component stacks in prod all the time we only produce a reified stack in dev and // during prerender in Prod. The reason for this is that the stack is useful for prerender where the timeliness // of the request is less critical than the observability of the execution. For renders and resumes however we @@ -10818,6 +10835,46 @@ function replayFragment(request, task, children, childIndex) { } } +function warnForMissingKey(request, task, child) { + { + if (child === null || typeof child !== 'object' || child.$$typeof !== REACT_ELEMENT_TYPE && child.$$typeof !== REACT_PORTAL_TYPE) { + return; + } + + if (!child._store || (child._store.validated || child.key != null) && child._store.validated !== 2) { + return; + } + + if (typeof child._store !== 'object') { + throw new Error('React Component in warnForMissingKey should have a _store. ' + 'This error is likely caused by a bug in React. Please file an issue.'); + } // $FlowFixMe[cannot-write] unable to narrow type from mixed to writable object + + + child._store.validated = 1; + var didWarnForKey = request.didWarnForKey; + + if (didWarnForKey == null) { + didWarnForKey = request.didWarnForKey = new WeakSet(); + } + + var parentStackFrame = task.componentStack; + + if (parentStackFrame === null || didWarnForKey.has(parentStackFrame)) { + // We already warned for other children in this parent. + return; + } + + didWarnForKey.add(parentStackFrame); // We create a fake component stack for the child to log the stack trace from. + + var stackFrame = createComponentStackFromType(task, child.type); + task.componentStack = stackFrame; + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', '', ''); + + task.componentStack = stackFrame.parent; + } +} + function renderChildrenArray(request, task, children, childIndex) { var prevKeyPath = task.keyPath; @@ -10866,6 +10923,11 @@ function renderChildrenArray(request, task, children, childIndex) { for (var _i = 0; _i < totalChildren; _i++) { var _node = children[_i]; + + { + warnForMissingKey(request, task, _node); + } + task.treeContext = pushTreeContext(prevTreeContext, totalChildren, _i); // We need to use the non-destructive form so that we can safely pop back // up and render the sibling if something suspends. diff --git a/compiled/facebook-www/ReactDOMServer-dev.modern.js b/compiled/facebook-www/ReactDOMServer-dev.modern.js index 1bd6c4a0d745d..4e37a927e7ad9 100644 --- a/compiled/facebook-www/ReactDOMServer-dev.modern.js +++ b/compiled/facebook-www/ReactDOMServer-dev.modern.js @@ -19,7 +19,7 @@ if (__DEV__) { var React = require('react'); var ReactDOM = require('react-dom'); -var ReactVersion = '19.0.0-www-modern-3c21a06a'; +var ReactVersion = '19.0.0-www-modern-54a5f0fc'; // This refers to a WWW module. var warningWWW = require('warning'); @@ -52,8 +52,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -9342,7 +9342,12 @@ function createRequest(children, resumableState, renderState, rootFormatContext, onShellError: onShellError === undefined ? noop : onShellError, onFatalError: onFatalError === undefined ? noop : onFatalError, formState: formState === undefined ? null : formState - }; // This segment represents the root fallback. + }; + + { + request.didWarnForKey = null; + } // This segment represents the root fallback. + var rootSegment = createPendingSegment(request, 0, null, rootFormatContext, // Root segments are never embedded in Text on either edge false, false); // There is no parent so conceptually, we're unblocked to flush this segment. @@ -9519,6 +9524,18 @@ function createClassComponentStack(task, type) { parent: task.componentStack, type: type }; +} + +function createComponentStackFromType(task, type) { + if (typeof type === 'string') { + return createBuiltInComponentStack(task, type); + } + + if (shouldConstruct(type)) { + return createClassComponentStack(task, type); + } + + return createFunctionComponentStack(task, type); } // While we track component stacks in prod all the time we only produce a reified stack in dev and // during prerender in Prod. The reason for this is that the stack is useful for prerender where the timeliness // of the request is less critical than the observability of the execution. For renders and resumes however we @@ -10748,6 +10765,46 @@ function replayFragment(request, task, children, childIndex) { } } +function warnForMissingKey(request, task, child) { + { + if (child === null || typeof child !== 'object' || child.$$typeof !== REACT_ELEMENT_TYPE && child.$$typeof !== REACT_PORTAL_TYPE) { + return; + } + + if (!child._store || (child._store.validated || child.key != null) && child._store.validated !== 2) { + return; + } + + if (typeof child._store !== 'object') { + throw new Error('React Component in warnForMissingKey should have a _store. ' + 'This error is likely caused by a bug in React. Please file an issue.'); + } // $FlowFixMe[cannot-write] unable to narrow type from mixed to writable object + + + child._store.validated = 1; + var didWarnForKey = request.didWarnForKey; + + if (didWarnForKey == null) { + didWarnForKey = request.didWarnForKey = new WeakSet(); + } + + var parentStackFrame = task.componentStack; + + if (parentStackFrame === null || didWarnForKey.has(parentStackFrame)) { + // We already warned for other children in this parent. + return; + } + + didWarnForKey.add(parentStackFrame); // We create a fake component stack for the child to log the stack trace from. + + var stackFrame = createComponentStackFromType(task, child.type); + task.componentStack = stackFrame; + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', '', ''); + + task.componentStack = stackFrame.parent; + } +} + function renderChildrenArray(request, task, children, childIndex) { var prevKeyPath = task.keyPath; @@ -10796,6 +10853,11 @@ function renderChildrenArray(request, task, children, childIndex) { for (var _i = 0; _i < totalChildren; _i++) { var _node = children[_i]; + + { + warnForMissingKey(request, task, _node); + } + task.treeContext = pushTreeContext(prevTreeContext, totalChildren, _i); // We need to use the non-destructive form so that we can safely pop back // up and render the sibling if something suspends. diff --git a/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js b/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js index a3d15be2c047f..48bf266237380 100644 --- a/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js +++ b/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js @@ -50,8 +50,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -9257,7 +9257,12 @@ function createRequest(children, resumableState, renderState, rootFormatContext, onShellError: onShellError === undefined ? noop : onShellError, onFatalError: onFatalError === undefined ? noop : onFatalError, formState: formState === undefined ? null : formState - }; // This segment represents the root fallback. + }; + + { + request.didWarnForKey = null; + } // This segment represents the root fallback. + var rootSegment = createPendingSegment(request, 0, null, rootFormatContext, // Root segments are never embedded in Text on either edge false, false); // There is no parent so conceptually, we're unblocked to flush this segment. @@ -9431,6 +9436,18 @@ function createClassComponentStack(task, type) { parent: task.componentStack, type: type }; +} + +function createComponentStackFromType(task, type) { + if (typeof type === 'string') { + return createBuiltInComponentStack(task, type); + } + + if (shouldConstruct(type)) { + return createClassComponentStack(task, type); + } + + return createFunctionComponentStack(task, type); } // While we track component stacks in prod all the time we only produce a reified stack in dev and // during prerender in Prod. The reason for this is that the stack is useful for prerender where the timeliness // of the request is less critical than the observability of the execution. For renders and resumes however we @@ -10660,6 +10677,46 @@ function replayFragment(request, task, children, childIndex) { } } +function warnForMissingKey(request, task, child) { + { + if (child === null || typeof child !== 'object' || child.$$typeof !== REACT_ELEMENT_TYPE && child.$$typeof !== REACT_PORTAL_TYPE) { + return; + } + + if (!child._store || (child._store.validated || child.key != null) && child._store.validated !== 2) { + return; + } + + if (typeof child._store !== 'object') { + throw new Error('React Component in warnForMissingKey should have a _store. ' + 'This error is likely caused by a bug in React. Please file an issue.'); + } // $FlowFixMe[cannot-write] unable to narrow type from mixed to writable object + + + child._store.validated = 1; + var didWarnForKey = request.didWarnForKey; + + if (didWarnForKey == null) { + didWarnForKey = request.didWarnForKey = new WeakSet(); + } + + var parentStackFrame = task.componentStack; + + if (parentStackFrame === null || didWarnForKey.has(parentStackFrame)) { + // We already warned for other children in this parent. + return; + } + + didWarnForKey.add(parentStackFrame); // We create a fake component stack for the child to log the stack trace from. + + var stackFrame = createComponentStackFromType(task, child.type); + task.componentStack = stackFrame; + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', '', ''); + + task.componentStack = stackFrame.parent; + } +} + function renderChildrenArray(request, task, children, childIndex) { var prevKeyPath = task.keyPath; @@ -10708,6 +10765,11 @@ function renderChildrenArray(request, task, children, childIndex) { for (var _i = 0; _i < totalChildren; _i++) { var _node = children[_i]; + + { + warnForMissingKey(request, task, _node); + } + task.treeContext = pushTreeContext(prevTreeContext, totalChildren, _i); // We need to use the non-destructive form so that we can safely pop back // up and render the sibling if something suspends. diff --git a/compiled/facebook-www/ReactDOMTesting-dev.classic.js b/compiled/facebook-www/ReactDOMTesting-dev.classic.js index e5e400164d8f9..41ef6c830bcbc 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.classic.js @@ -59,8 +59,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -9973,7 +9973,7 @@ var warnForMissingKey = function (child, returnFiber) {}; return; } - if (!child._store || child._store.validated || child.key != null) { + if (!child._store || (child._store.validated || child.key != null) && child._store.validated !== 2) { return; } @@ -9982,17 +9982,113 @@ var warnForMissingKey = function (child, returnFiber) {}; } // $FlowFixMe[cannot-write] unable to narrow type from mixed to writable object - child._store.validated = true; - var componentName = getComponentNameFromFiber(returnFiber) || 'Component'; + child._store.validated = 1; + var componentName = getComponentNameFromFiber(returnFiber); + var componentKey = componentName || 'null'; - if (ownerHasKeyUseWarning[componentName]) { + if (ownerHasKeyUseWarning[componentKey]) { return; } - ownerHasKeyUseWarning[componentName] = true; + ownerHasKeyUseWarning[componentKey] = true; + var childOwner = child._owner; + var parentOwner = returnFiber._debugOwner; + var currentComponentErrorInfo = ''; - error('Each child in a list should have a unique ' + '"key" prop. See https://react.dev/link/warning-keys for ' + 'more information.'); + if (parentOwner && typeof parentOwner.tag === 'number') { + var name = getComponentNameFromFiber(parentOwner); + + if (name) { + currentComponentErrorInfo = '\n\nCheck the render method of `' + name + '`.'; + } + } + + if (!currentComponentErrorInfo) { + if (componentName) { + currentComponentErrorInfo = "\n\nCheck the top-level render call using <" + componentName + ">."; + } + } // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + + + var childOwnerAppendix = ''; + + if (childOwner != null && parentOwner !== childOwner) { + var ownerName = null; + + if (typeof childOwner.tag === 'number') { + ownerName = getComponentNameFromFiber(childOwner); + } else if (typeof childOwner.name === 'string') { + ownerName = childOwner.name; + } + + if (ownerName) { + // Give the component that originally created this child. + childOwnerAppendix = " It was passed a child from " + ownerName + "."; + } + } // We create a fake Fiber for the child to log the stack trace from. + // TODO: Refactor the warnForMissingKey calls to happen after fiber creation + // so that we can get access to the fiber that will eventually be created. + // That way the log can show up associated with the right instance in DevTools. + + + var fiber = createFiberFromElement(child, returnFiber.mode, 0); + fiber.return = returnFiber; + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwnerAppendix); + + setCurrentFiber(prevDebugFiber); }; +} // Given a fragment, validate that it can only be provided with fragment props +// We do this here instead of BeginWork because the Fragment fiber doesn't have +// the whole props object, only the children and is shared with arrays. + + +function validateFragmentProps(element, fiber, returnFiber) { + { + var keys = Object.keys(element.props); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + + if (key !== 'children' && key !== 'key') { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); + + setCurrentFiber(prevDebugFiber); + break; + } + } + + if (!enableRefAsProp && element.ref !== null) { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var _prevDebugFiber = getCurrentFiber(); + + setCurrentFiber(fiber); + + error('Invalid attribute `ref` supplied to `React.Fragment`.'); + + setCurrentFiber(_prevDebugFiber); + } + } } function unwrapThenable(thenable) { @@ -10216,7 +10312,9 @@ function createChildReconciler(shouldTrackSideEffects) { var elementType = element.type; if (elementType === REACT_FRAGMENT_TYPE) { - return updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + var updated = updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + validateFragmentProps(element, updated, returnFiber); + return updated; } if (current !== null) { @@ -10990,6 +11088,7 @@ function createChildReconciler(shouldTrackSideEffects) { existing._debugInfo = debugInfo; } + validateFragmentProps(element, existing, returnFiber); return existing; } } else { @@ -11033,6 +11132,7 @@ function createChildReconciler(shouldTrackSideEffects) { created._debugInfo = debugInfo; } + validateFragmentProps(element, created, returnFiber); return created; } else { var _created4 = createFiberFromElement(element, returnFiber.mode, lanes); @@ -11095,6 +11195,7 @@ function createChildReconciler(shouldTrackSideEffects) { var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null; if (isUnkeyedTopLevelFragment) { + validateFragmentProps(newChild, null, returnFiber); newChild = newChild.props.children; } // Handle object types @@ -31147,10 +31248,22 @@ key, pendingProps, owner, mode, lanes) { } var info = ''; + var typeString; { if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; + info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; + } + + if (type === null) { + typeString = 'null'; + } else if (isArray(type)) { + typeString = 'array'; + } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { + typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; + info = ' Did you accidentally export a JSX literal instead of a component?'; + } else { + typeString = typeof type; } var ownerName = owner ? getComponentNameFromOwner(owner) : null; @@ -31160,7 +31273,7 @@ key, pendingProps, owner, mode, lanes) { } } - throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + (type == null ? type : typeof type) + "." + info)); + throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + typeString + "." + info)); } } } @@ -31449,7 +31562,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-classic-29d9d3a8'; +var ReactVersion = '19.0.0-www-classic-8d698026'; function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation. implementation) { diff --git a/compiled/facebook-www/ReactDOMTesting-dev.modern.js b/compiled/facebook-www/ReactDOMTesting-dev.modern.js index e152a65f1ab6a..3f3e518314485 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.modern.js @@ -59,8 +59,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -9714,7 +9714,7 @@ var warnForMissingKey = function (child, returnFiber) {}; return; } - if (!child._store || child._store.validated || child.key != null) { + if (!child._store || (child._store.validated || child.key != null) && child._store.validated !== 2) { return; } @@ -9723,17 +9723,113 @@ var warnForMissingKey = function (child, returnFiber) {}; } // $FlowFixMe[cannot-write] unable to narrow type from mixed to writable object - child._store.validated = true; - var componentName = getComponentNameFromFiber(returnFiber) || 'Component'; + child._store.validated = 1; + var componentName = getComponentNameFromFiber(returnFiber); + var componentKey = componentName || 'null'; - if (ownerHasKeyUseWarning[componentName]) { + if (ownerHasKeyUseWarning[componentKey]) { return; } - ownerHasKeyUseWarning[componentName] = true; + ownerHasKeyUseWarning[componentKey] = true; + var childOwner = child._owner; + var parentOwner = returnFiber._debugOwner; + var currentComponentErrorInfo = ''; - error('Each child in a list should have a unique ' + '"key" prop. See https://react.dev/link/warning-keys for ' + 'more information.'); + if (parentOwner && typeof parentOwner.tag === 'number') { + var name = getComponentNameFromFiber(parentOwner); + + if (name) { + currentComponentErrorInfo = '\n\nCheck the render method of `' + name + '`.'; + } + } + + if (!currentComponentErrorInfo) { + if (componentName) { + currentComponentErrorInfo = "\n\nCheck the top-level render call using <" + componentName + ">."; + } + } // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + + + var childOwnerAppendix = ''; + + if (childOwner != null && parentOwner !== childOwner) { + var ownerName = null; + + if (typeof childOwner.tag === 'number') { + ownerName = getComponentNameFromFiber(childOwner); + } else if (typeof childOwner.name === 'string') { + ownerName = childOwner.name; + } + + if (ownerName) { + // Give the component that originally created this child. + childOwnerAppendix = " It was passed a child from " + ownerName + "."; + } + } // We create a fake Fiber for the child to log the stack trace from. + // TODO: Refactor the warnForMissingKey calls to happen after fiber creation + // so that we can get access to the fiber that will eventually be created. + // That way the log can show up associated with the right instance in DevTools. + + + var fiber = createFiberFromElement(child, returnFiber.mode, 0); + fiber.return = returnFiber; + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwnerAppendix); + + setCurrentFiber(prevDebugFiber); }; +} // Given a fragment, validate that it can only be provided with fragment props +// We do this here instead of BeginWork because the Fragment fiber doesn't have +// the whole props object, only the children and is shared with arrays. + + +function validateFragmentProps(element, fiber, returnFiber) { + { + var keys = Object.keys(element.props); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + + if (key !== 'children' && key !== 'key') { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); + + setCurrentFiber(prevDebugFiber); + break; + } + } + + if (!enableRefAsProp && element.ref !== null) { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var _prevDebugFiber = getCurrentFiber(); + + setCurrentFiber(fiber); + + error('Invalid attribute `ref` supplied to `React.Fragment`.'); + + setCurrentFiber(_prevDebugFiber); + } + } } function unwrapThenable(thenable) { @@ -9957,7 +10053,9 @@ function createChildReconciler(shouldTrackSideEffects) { var elementType = element.type; if (elementType === REACT_FRAGMENT_TYPE) { - return updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + var updated = updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + validateFragmentProps(element, updated, returnFiber); + return updated; } if (current !== null) { @@ -10731,6 +10829,7 @@ function createChildReconciler(shouldTrackSideEffects) { existing._debugInfo = debugInfo; } + validateFragmentProps(element, existing, returnFiber); return existing; } } else { @@ -10774,6 +10873,7 @@ function createChildReconciler(shouldTrackSideEffects) { created._debugInfo = debugInfo; } + validateFragmentProps(element, created, returnFiber); return created; } else { var _created4 = createFiberFromElement(element, returnFiber.mode, lanes); @@ -10836,6 +10936,7 @@ function createChildReconciler(shouldTrackSideEffects) { var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null; if (isUnkeyedTopLevelFragment) { + validateFragmentProps(newChild, null, returnFiber); newChild = newChild.props.children; } // Handle object types @@ -30329,10 +30430,22 @@ key, pendingProps, owner, mode, lanes) { } var info = ''; + var typeString; { if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; + info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; + } + + if (type === null) { + typeString = 'null'; + } else if (isArray(type)) { + typeString = 'array'; + } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { + typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; + info = ' Did you accidentally export a JSX literal instead of a component?'; + } else { + typeString = typeof type; } var ownerName = owner ? getComponentNameFromOwner(owner) : null; @@ -30342,7 +30455,7 @@ key, pendingProps, owner, mode, lanes) { } } - throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + (type == null ? type : typeof type) + "." + info)); + throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + typeString + "." + info)); } } } @@ -30624,7 +30737,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-modern-7421d6e6'; +var ReactVersion = '19.0.0-www-modern-862feb58'; function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation. implementation) { diff --git a/compiled/facebook-www/ReactDOMTesting-prod.classic.js b/compiled/facebook-www/ReactDOMTesting-prod.classic.js index 4f0804309237c..066b3d3e54ec3 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.classic.js @@ -12478,7 +12478,7 @@ function createFiberFromTypeAndProps( break a; } throw Error( - formatProdErrorMessage(130, null == type ? type : typeof type, "") + formatProdErrorMessage(130, null === type ? "null" : typeof type, "") ); } pendingProps = createFiber(fiberTag, pendingProps, key, mode); @@ -17398,7 +17398,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1776 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-classic-7ee5c2f5", + version: "19.0.0-www-classic-5fe02461", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2225 = { @@ -17428,7 +17428,7 @@ var internals$jscomp$inline_2225 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-7ee5c2f5" + reconcilerVersion: "19.0.0-www-classic-5fe02461" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2226 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -18083,4 +18083,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-classic-7ee5c2f5"; +exports.version = "19.0.0-www-classic-5fe02461"; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.modern.js b/compiled/facebook-www/ReactDOMTesting-prod.modern.js index a32bd78d3614b..23b57212d682e 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.modern.js @@ -12011,7 +12011,7 @@ function createFiberFromTypeAndProps( break a; } throw Error( - formatProdErrorMessage(130, null == type ? type : typeof type, "") + formatProdErrorMessage(130, null === type ? "null" : typeof type, "") ); } pendingProps = createFiber(fiberTag, pendingProps, key, mode); @@ -16820,7 +16820,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1743 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-modern-275952a2", + version: "19.0.0-www-modern-03570e44", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2217 = { @@ -16850,7 +16850,7 @@ var internals$jscomp$inline_2217 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-275952a2" + reconcilerVersion: "19.0.0-www-modern-03570e44" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2218 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -17375,4 +17375,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-modern-275952a2"; +exports.version = "19.0.0-www-modern-03570e44"; diff --git a/compiled/facebook-www/ReactIs-dev.classic.js b/compiled/facebook-www/ReactIs-dev.classic.js index c748889aebeaa..83479ab8c845b 100644 --- a/compiled/facebook-www/ReactIs-dev.classic.js +++ b/compiled/facebook-www/ReactIs-dev.classic.js @@ -49,7 +49,9 @@ var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); var REACT_LEGACY_HIDDEN_TYPE = Symbol.for('react.legacy_hidden'); var REACT_TRACING_MARKER_TYPE = Symbol.for('react.tracing_marker'); -var REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference'); +var REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference'); // This function is deprecated. Don't use. Only the renderer knows what a valid type is. +// TODO: Delete this when enableOwnerStacks ships. + function isValidElementType(type) { if (typeof type === 'string' || typeof type === 'function') { return true; diff --git a/compiled/facebook-www/ReactIs-dev.modern.js b/compiled/facebook-www/ReactIs-dev.modern.js index 0a52d0a91c161..e2808e7106a6a 100644 --- a/compiled/facebook-www/ReactIs-dev.modern.js +++ b/compiled/facebook-www/ReactIs-dev.modern.js @@ -49,7 +49,9 @@ var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); var REACT_LEGACY_HIDDEN_TYPE = Symbol.for('react.legacy_hidden'); var REACT_TRACING_MARKER_TYPE = Symbol.for('react.tracing_marker'); -var REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference'); +var REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference'); // This function is deprecated. Don't use. Only the renderer knows what a valid type is. +// TODO: Delete this when enableOwnerStacks ships. + function isValidElementType(type) { if (typeof type === 'string' || typeof type === 'function') { return true; diff --git a/compiled/facebook-www/ReactReconciler-dev.classic.js b/compiled/facebook-www/ReactReconciler-dev.classic.js index 9de927423f5a1..918faaf3de4c6 100644 --- a/compiled/facebook-www/ReactReconciler-dev.classic.js +++ b/compiled/facebook-www/ReactReconciler-dev.classic.js @@ -58,8 +58,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -6763,7 +6763,7 @@ var warnForMissingKey = function (child, returnFiber) {}; return; } - if (!child._store || child._store.validated || child.key != null) { + if (!child._store || (child._store.validated || child.key != null) && child._store.validated !== 2) { return; } @@ -6772,17 +6772,113 @@ var warnForMissingKey = function (child, returnFiber) {}; } // $FlowFixMe[cannot-write] unable to narrow type from mixed to writable object - child._store.validated = true; - var componentName = getComponentNameFromFiber(returnFiber) || 'Component'; + child._store.validated = 1; + var componentName = getComponentNameFromFiber(returnFiber); + var componentKey = componentName || 'null'; - if (ownerHasKeyUseWarning[componentName]) { + if (ownerHasKeyUseWarning[componentKey]) { return; } - ownerHasKeyUseWarning[componentName] = true; + ownerHasKeyUseWarning[componentKey] = true; + var childOwner = child._owner; + var parentOwner = returnFiber._debugOwner; + var currentComponentErrorInfo = ''; - error('Each child in a list should have a unique ' + '"key" prop. See https://react.dev/link/warning-keys for ' + 'more information.'); + if (parentOwner && typeof parentOwner.tag === 'number') { + var name = getComponentNameFromFiber(parentOwner); + + if (name) { + currentComponentErrorInfo = '\n\nCheck the render method of `' + name + '`.'; + } + } + + if (!currentComponentErrorInfo) { + if (componentName) { + currentComponentErrorInfo = "\n\nCheck the top-level render call using <" + componentName + ">."; + } + } // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + + + var childOwnerAppendix = ''; + + if (childOwner != null && parentOwner !== childOwner) { + var ownerName = null; + + if (typeof childOwner.tag === 'number') { + ownerName = getComponentNameFromFiber(childOwner); + } else if (typeof childOwner.name === 'string') { + ownerName = childOwner.name; + } + + if (ownerName) { + // Give the component that originally created this child. + childOwnerAppendix = " It was passed a child from " + ownerName + "."; + } + } // We create a fake Fiber for the child to log the stack trace from. + // TODO: Refactor the warnForMissingKey calls to happen after fiber creation + // so that we can get access to the fiber that will eventually be created. + // That way the log can show up associated with the right instance in DevTools. + + + var fiber = createFiberFromElement(child, returnFiber.mode, 0); + fiber.return = returnFiber; + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwnerAppendix); + + setCurrentFiber(prevDebugFiber); }; +} // Given a fragment, validate that it can only be provided with fragment props +// We do this here instead of BeginWork because the Fragment fiber doesn't have +// the whole props object, only the children and is shared with arrays. + + +function validateFragmentProps(element, fiber, returnFiber) { + { + var keys = Object.keys(element.props); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + + if (key !== 'children' && key !== 'key') { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); + + setCurrentFiber(prevDebugFiber); + break; + } + } + + if (!enableRefAsProp && element.ref !== null) { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var _prevDebugFiber = getCurrentFiber(); + + setCurrentFiber(fiber); + + error('Invalid attribute `ref` supplied to `React.Fragment`.'); + + setCurrentFiber(_prevDebugFiber); + } + } } function unwrapThenable(thenable) { @@ -7006,7 +7102,9 @@ function createChildReconciler(shouldTrackSideEffects) { var elementType = element.type; if (elementType === REACT_FRAGMENT_TYPE) { - return updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + var updated = updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + validateFragmentProps(element, updated, returnFiber); + return updated; } if (current !== null) { @@ -7780,6 +7878,7 @@ function createChildReconciler(shouldTrackSideEffects) { existing._debugInfo = debugInfo; } + validateFragmentProps(element, existing, returnFiber); return existing; } } else { @@ -7823,6 +7922,7 @@ function createChildReconciler(shouldTrackSideEffects) { created._debugInfo = debugInfo; } + validateFragmentProps(element, created, returnFiber); return created; } else { var _created4 = createFiberFromElement(element, returnFiber.mode, lanes); @@ -7885,6 +7985,7 @@ function createChildReconciler(shouldTrackSideEffects) { var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null; if (isUnkeyedTopLevelFragment) { + validateFragmentProps(newChild, null, returnFiber); newChild = newChild.props.children; } // Handle object types @@ -28379,10 +28480,22 @@ key, pendingProps, owner, mode, lanes) { } var info = ''; + var typeString; { if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; + info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; + } + + if (type === null) { + typeString = 'null'; + } else if (isArray(type)) { + typeString = 'array'; + } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { + typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; + info = ' Did you accidentally export a JSX literal instead of a component?'; + } else { + typeString = typeof type; } var ownerName = owner ? getComponentNameFromOwner(owner) : null; @@ -28392,7 +28505,7 @@ key, pendingProps, owner, mode, lanes) { } } - throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + (type == null ? type : typeof type) + "." + info)); + throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + typeString + "." + info)); } } } @@ -28681,7 +28794,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-classic-5780984f'; +var ReactVersion = '19.0.0-www-classic-287510b9'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol diff --git a/compiled/facebook-www/ReactReconciler-dev.modern.js b/compiled/facebook-www/ReactReconciler-dev.modern.js index 7c32cb7ec21fb..0e4a7b6670f9e 100644 --- a/compiled/facebook-www/ReactReconciler-dev.modern.js +++ b/compiled/facebook-www/ReactReconciler-dev.modern.js @@ -58,8 +58,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -6554,7 +6554,7 @@ var warnForMissingKey = function (child, returnFiber) {}; return; } - if (!child._store || child._store.validated || child.key != null) { + if (!child._store || (child._store.validated || child.key != null) && child._store.validated !== 2) { return; } @@ -6563,17 +6563,113 @@ var warnForMissingKey = function (child, returnFiber) {}; } // $FlowFixMe[cannot-write] unable to narrow type from mixed to writable object - child._store.validated = true; - var componentName = getComponentNameFromFiber(returnFiber) || 'Component'; + child._store.validated = 1; + var componentName = getComponentNameFromFiber(returnFiber); + var componentKey = componentName || 'null'; - if (ownerHasKeyUseWarning[componentName]) { + if (ownerHasKeyUseWarning[componentKey]) { return; } - ownerHasKeyUseWarning[componentName] = true; + ownerHasKeyUseWarning[componentKey] = true; + var childOwner = child._owner; + var parentOwner = returnFiber._debugOwner; + var currentComponentErrorInfo = ''; - error('Each child in a list should have a unique ' + '"key" prop. See https://react.dev/link/warning-keys for ' + 'more information.'); + if (parentOwner && typeof parentOwner.tag === 'number') { + var name = getComponentNameFromFiber(parentOwner); + + if (name) { + currentComponentErrorInfo = '\n\nCheck the render method of `' + name + '`.'; + } + } + + if (!currentComponentErrorInfo) { + if (componentName) { + currentComponentErrorInfo = "\n\nCheck the top-level render call using <" + componentName + ">."; + } + } // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + + + var childOwnerAppendix = ''; + + if (childOwner != null && parentOwner !== childOwner) { + var ownerName = null; + + if (typeof childOwner.tag === 'number') { + ownerName = getComponentNameFromFiber(childOwner); + } else if (typeof childOwner.name === 'string') { + ownerName = childOwner.name; + } + + if (ownerName) { + // Give the component that originally created this child. + childOwnerAppendix = " It was passed a child from " + ownerName + "."; + } + } // We create a fake Fiber for the child to log the stack trace from. + // TODO: Refactor the warnForMissingKey calls to happen after fiber creation + // so that we can get access to the fiber that will eventually be created. + // That way the log can show up associated with the right instance in DevTools. + + + var fiber = createFiberFromElement(child, returnFiber.mode, 0); + fiber.return = returnFiber; + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwnerAppendix); + + setCurrentFiber(prevDebugFiber); }; +} // Given a fragment, validate that it can only be provided with fragment props +// We do this here instead of BeginWork because the Fragment fiber doesn't have +// the whole props object, only the children and is shared with arrays. + + +function validateFragmentProps(element, fiber, returnFiber) { + { + var keys = Object.keys(element.props); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + + if (key !== 'children' && key !== 'key') { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); + + setCurrentFiber(prevDebugFiber); + break; + } + } + + if (!enableRefAsProp && element.ref !== null) { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var _prevDebugFiber = getCurrentFiber(); + + setCurrentFiber(fiber); + + error('Invalid attribute `ref` supplied to `React.Fragment`.'); + + setCurrentFiber(_prevDebugFiber); + } + } } function unwrapThenable(thenable) { @@ -6797,7 +6893,9 @@ function createChildReconciler(shouldTrackSideEffects) { var elementType = element.type; if (elementType === REACT_FRAGMENT_TYPE) { - return updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + var updated = updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + validateFragmentProps(element, updated, returnFiber); + return updated; } if (current !== null) { @@ -7571,6 +7669,7 @@ function createChildReconciler(shouldTrackSideEffects) { existing._debugInfo = debugInfo; } + validateFragmentProps(element, existing, returnFiber); return existing; } } else { @@ -7614,6 +7713,7 @@ function createChildReconciler(shouldTrackSideEffects) { created._debugInfo = debugInfo; } + validateFragmentProps(element, created, returnFiber); return created; } else { var _created4 = createFiberFromElement(element, returnFiber.mode, lanes); @@ -7676,6 +7776,7 @@ function createChildReconciler(shouldTrackSideEffects) { var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null; if (isUnkeyedTopLevelFragment) { + validateFragmentProps(newChild, null, returnFiber); newChild = newChild.props.children; } // Handle object types @@ -27652,10 +27753,22 @@ key, pendingProps, owner, mode, lanes) { } var info = ''; + var typeString; { if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; + info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; + } + + if (type === null) { + typeString = 'null'; + } else if (isArray(type)) { + typeString = 'array'; + } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { + typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; + info = ' Did you accidentally export a JSX literal instead of a component?'; + } else { + typeString = typeof type; } var ownerName = owner ? getComponentNameFromOwner(owner) : null; @@ -27665,7 +27778,7 @@ key, pendingProps, owner, mode, lanes) { } } - throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + (type == null ? type : typeof type) + "." + info)); + throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + typeString + "." + info)); } } } @@ -27947,7 +28060,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-modern-e832d486'; +var ReactVersion = '19.0.0-www-modern-09c6ebdb'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol diff --git a/compiled/facebook-www/ReactReconciler-prod.classic.js b/compiled/facebook-www/ReactReconciler-prod.classic.js index 866e6805c93ee..264dfec0bd4a3 100644 --- a/compiled/facebook-www/ReactReconciler-prod.classic.js +++ b/compiled/facebook-www/ReactReconciler-prod.classic.js @@ -11206,7 +11206,11 @@ module.exports = function ($$$config) { break a; } throw Error( - formatProdErrorMessage(130, null == type ? type : typeof type, "") + formatProdErrorMessage( + 130, + null === type ? "null" : typeof type, + "" + ) ); } pendingProps = createFiber(fiberTag, pendingProps, key, mode); @@ -12641,7 +12645,7 @@ module.exports = function ($$$config) { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-be35b40e" + reconcilerVersion: "19.0.0-www-classic-16207949" }; if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) devToolsConfig = !1; diff --git a/compiled/facebook-www/ReactReconciler-prod.modern.js b/compiled/facebook-www/ReactReconciler-prod.modern.js index 66eed58f8d072..c5973c67e77d2 100644 --- a/compiled/facebook-www/ReactReconciler-prod.modern.js +++ b/compiled/facebook-www/ReactReconciler-prod.modern.js @@ -10768,7 +10768,11 @@ module.exports = function ($$$config) { break a; } throw Error( - formatProdErrorMessage(130, null == type ? type : typeof type, "") + formatProdErrorMessage( + 130, + null === type ? "null" : typeof type, + "" + ) ); } pendingProps = createFiber(fiberTag, pendingProps, key, mode); @@ -12154,7 +12158,7 @@ module.exports = function ($$$config) { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-24c867c9" + reconcilerVersion: "19.0.0-www-modern-d82cd544" }; if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) devToolsConfig = !1; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.classic.js b/compiled/facebook-www/ReactTestRenderer-dev.classic.js index 594bd251bb882..c2e3a86ea8528 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.classic.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.classic.js @@ -51,8 +51,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -5395,7 +5395,7 @@ var warnForMissingKey = function (child, returnFiber) {}; return; } - if (!child._store || child._store.validated || child.key != null) { + if (!child._store || (child._store.validated || child.key != null) && child._store.validated !== 2) { return; } @@ -5404,17 +5404,113 @@ var warnForMissingKey = function (child, returnFiber) {}; } // $FlowFixMe[cannot-write] unable to narrow type from mixed to writable object - child._store.validated = true; - var componentName = getComponentNameFromFiber(returnFiber) || 'Component'; + child._store.validated = 1; + var componentName = getComponentNameFromFiber(returnFiber); + var componentKey = componentName || 'null'; - if (ownerHasKeyUseWarning[componentName]) { + if (ownerHasKeyUseWarning[componentKey]) { return; } - ownerHasKeyUseWarning[componentName] = true; + ownerHasKeyUseWarning[componentKey] = true; + var childOwner = child._owner; + var parentOwner = returnFiber._debugOwner; + var currentComponentErrorInfo = ''; - error('Each child in a list should have a unique ' + '"key" prop. See https://react.dev/link/warning-keys for ' + 'more information.'); + if (parentOwner && typeof parentOwner.tag === 'number') { + var name = getComponentNameFromFiber(parentOwner); + + if (name) { + currentComponentErrorInfo = '\n\nCheck the render method of `' + name + '`.'; + } + } + + if (!currentComponentErrorInfo) { + if (componentName) { + currentComponentErrorInfo = "\n\nCheck the top-level render call using <" + componentName + ">."; + } + } // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + + + var childOwnerAppendix = ''; + + if (childOwner != null && parentOwner !== childOwner) { + var ownerName = null; + + if (typeof childOwner.tag === 'number') { + ownerName = getComponentNameFromFiber(childOwner); + } else if (typeof childOwner.name === 'string') { + ownerName = childOwner.name; + } + + if (ownerName) { + // Give the component that originally created this child. + childOwnerAppendix = " It was passed a child from " + ownerName + "."; + } + } // We create a fake Fiber for the child to log the stack trace from. + // TODO: Refactor the warnForMissingKey calls to happen after fiber creation + // so that we can get access to the fiber that will eventually be created. + // That way the log can show up associated with the right instance in DevTools. + + + var fiber = createFiberFromElement(child, returnFiber.mode, 0); + fiber.return = returnFiber; + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwnerAppendix); + + setCurrentFiber(prevDebugFiber); }; +} // Given a fragment, validate that it can only be provided with fragment props +// We do this here instead of BeginWork because the Fragment fiber doesn't have +// the whole props object, only the children and is shared with arrays. + + +function validateFragmentProps(element, fiber, returnFiber) { + { + var keys = Object.keys(element.props); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + + if (key !== 'children' && key !== 'key') { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); + + setCurrentFiber(prevDebugFiber); + break; + } + } + + if (element.ref !== null) { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var _prevDebugFiber = getCurrentFiber(); + + setCurrentFiber(fiber); + + error('Invalid attribute `ref` supplied to `React.Fragment`.'); + + setCurrentFiber(_prevDebugFiber); + } + } } function unwrapThenable(thenable) { @@ -5632,7 +5728,9 @@ function createChildReconciler(shouldTrackSideEffects) { var elementType = element.type; if (elementType === REACT_FRAGMENT_TYPE) { - return updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + var updated = updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + validateFragmentProps(element, updated, returnFiber); + return updated; } if (current !== null) { @@ -6376,6 +6474,7 @@ function createChildReconciler(shouldTrackSideEffects) { existing._debugInfo = debugInfo; } + validateFragmentProps(element, existing, returnFiber); return existing; } } else { @@ -6419,6 +6518,7 @@ function createChildReconciler(shouldTrackSideEffects) { created._debugInfo = debugInfo; } + validateFragmentProps(element, created, returnFiber); return created; } else { var _created4 = createFiberFromElement(element, returnFiber.mode, lanes); @@ -6481,6 +6581,7 @@ function createChildReconciler(shouldTrackSideEffects) { var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null; if (isUnkeyedTopLevelFragment) { + validateFragmentProps(newChild, null, returnFiber); newChild = newChild.props.children; } // Handle object types @@ -22923,10 +23024,22 @@ key, pendingProps, owner, mode, lanes) { } var info = ''; + var typeString; { if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; + info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; + } + + if (type === null) { + typeString = 'null'; + } else if (isArray(type)) { + typeString = 'array'; + } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { + typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; + info = ' Did you accidentally export a JSX literal instead of a component?'; + } else { + typeString = typeof type; } var ownerName = owner ? getComponentNameFromOwner(owner) : null; @@ -22936,7 +23049,7 @@ key, pendingProps, owner, mode, lanes) { } } - throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + (type == null ? type : typeof type) + "." + info)); + throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + typeString + "." + info)); } } } @@ -23161,7 +23274,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-classic-9eaf1ccb'; +var ReactVersion = '19.0.0-www-classic-d66ba86c'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol diff --git a/compiled/facebook-www/ReactTestRenderer-dev.modern.js b/compiled/facebook-www/ReactTestRenderer-dev.modern.js index b82ae6500ff60..343f31294ee70 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.modern.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.modern.js @@ -51,8 +51,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; @@ -5395,7 +5395,7 @@ var warnForMissingKey = function (child, returnFiber) {}; return; } - if (!child._store || child._store.validated || child.key != null) { + if (!child._store || (child._store.validated || child.key != null) && child._store.validated !== 2) { return; } @@ -5404,17 +5404,113 @@ var warnForMissingKey = function (child, returnFiber) {}; } // $FlowFixMe[cannot-write] unable to narrow type from mixed to writable object - child._store.validated = true; - var componentName = getComponentNameFromFiber(returnFiber) || 'Component'; + child._store.validated = 1; + var componentName = getComponentNameFromFiber(returnFiber); + var componentKey = componentName || 'null'; - if (ownerHasKeyUseWarning[componentName]) { + if (ownerHasKeyUseWarning[componentKey]) { return; } - ownerHasKeyUseWarning[componentName] = true; + ownerHasKeyUseWarning[componentKey] = true; + var childOwner = child._owner; + var parentOwner = returnFiber._debugOwner; + var currentComponentErrorInfo = ''; - error('Each child in a list should have a unique ' + '"key" prop. See https://react.dev/link/warning-keys for ' + 'more information.'); + if (parentOwner && typeof parentOwner.tag === 'number') { + var name = getComponentNameFromFiber(parentOwner); + + if (name) { + currentComponentErrorInfo = '\n\nCheck the render method of `' + name + '`.'; + } + } + + if (!currentComponentErrorInfo) { + if (componentName) { + currentComponentErrorInfo = "\n\nCheck the top-level render call using <" + componentName + ">."; + } + } // Usually the current owner is the offender, but if it accepts children as a + // property, it may be the creator of the child that's responsible for + // assigning it a key. + + + var childOwnerAppendix = ''; + + if (childOwner != null && parentOwner !== childOwner) { + var ownerName = null; + + if (typeof childOwner.tag === 'number') { + ownerName = getComponentNameFromFiber(childOwner); + } else if (typeof childOwner.name === 'string') { + ownerName = childOwner.name; + } + + if (ownerName) { + // Give the component that originally created this child. + childOwnerAppendix = " It was passed a child from " + ownerName + "."; + } + } // We create a fake Fiber for the child to log the stack trace from. + // TODO: Refactor the warnForMissingKey calls to happen after fiber creation + // so that we can get access to the fiber that will eventually be created. + // That way the log can show up associated with the right instance in DevTools. + + + var fiber = createFiberFromElement(child, returnFiber.mode, 0); + fiber.return = returnFiber; + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwnerAppendix); + + setCurrentFiber(prevDebugFiber); }; +} // Given a fragment, validate that it can only be provided with fragment props +// We do this here instead of BeginWork because the Fragment fiber doesn't have +// the whole props object, only the children and is shared with arrays. + + +function validateFragmentProps(element, fiber, returnFiber) { + { + var keys = Object.keys(element.props); + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + + if (key !== 'children' && key !== 'key') { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var prevDebugFiber = getCurrentFiber(); + setCurrentFiber(fiber); + + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); + + setCurrentFiber(prevDebugFiber); + break; + } + } + + if (element.ref !== null) { + if (fiber === null) { + // For unkeyed root fragments there's no Fiber. We create a fake one just for + // error stack handling. + fiber = createFiberFromElement(element, returnFiber.mode, 0); + fiber.return = returnFiber; + } + + var _prevDebugFiber = getCurrentFiber(); + + setCurrentFiber(fiber); + + error('Invalid attribute `ref` supplied to `React.Fragment`.'); + + setCurrentFiber(_prevDebugFiber); + } + } } function unwrapThenable(thenable) { @@ -5632,7 +5728,9 @@ function createChildReconciler(shouldTrackSideEffects) { var elementType = element.type; if (elementType === REACT_FRAGMENT_TYPE) { - return updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + var updated = updateFragment(returnFiber, current, element.props.children, lanes, element.key, debugInfo); + validateFragmentProps(element, updated, returnFiber); + return updated; } if (current !== null) { @@ -6376,6 +6474,7 @@ function createChildReconciler(shouldTrackSideEffects) { existing._debugInfo = debugInfo; } + validateFragmentProps(element, existing, returnFiber); return existing; } } else { @@ -6419,6 +6518,7 @@ function createChildReconciler(shouldTrackSideEffects) { created._debugInfo = debugInfo; } + validateFragmentProps(element, created, returnFiber); return created; } else { var _created4 = createFiberFromElement(element, returnFiber.mode, lanes); @@ -6481,6 +6581,7 @@ function createChildReconciler(shouldTrackSideEffects) { var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null; if (isUnkeyedTopLevelFragment) { + validateFragmentProps(newChild, null, returnFiber); newChild = newChild.props.children; } // Handle object types @@ -22923,10 +23024,22 @@ key, pendingProps, owner, mode, lanes) { } var info = ''; + var typeString; { if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; + info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; + } + + if (type === null) { + typeString = 'null'; + } else if (isArray(type)) { + typeString = 'array'; + } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { + typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; + info = ' Did you accidentally export a JSX literal instead of a component?'; + } else { + typeString = typeof type; } var ownerName = owner ? getComponentNameFromOwner(owner) : null; @@ -22936,7 +23049,7 @@ key, pendingProps, owner, mode, lanes) { } } - throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + (type == null ? type : typeof type) + "." + info)); + throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + typeString + "." + info)); } } } @@ -23161,7 +23274,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-modern-9eaf1ccb'; +var ReactVersion = '19.0.0-www-modern-d66ba86c'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol diff --git a/compiled/facebook-www/ReactTestUtils-dev.classic.js b/compiled/facebook-www/ReactTestUtils-dev.classic.js index 3f7abf435bf7a..ff7451b81ae45 100644 --- a/compiled/facebook-www/ReactTestUtils-dev.classic.js +++ b/compiled/facebook-www/ReactTestUtils-dev.classic.js @@ -50,8 +50,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; diff --git a/compiled/facebook-www/ReactTestUtils-dev.modern.js b/compiled/facebook-www/ReactTestUtils-dev.modern.js index 3f7abf435bf7a..ff7451b81ae45 100644 --- a/compiled/facebook-www/ReactTestUtils-dev.modern.js +++ b/compiled/facebook-www/ReactTestUtils-dev.modern.js @@ -50,8 +50,8 @@ function printWarning(level, format, args) { var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // Defensive in case this is fired before React is initialized. - if (ReactSharedInternals != null) { - var stack = ReactSharedInternals.getStackAddendum(); + if (ReactSharedInternals != null && ReactSharedInternals.getCurrentStack) { + var stack = ReactSharedInternals.getCurrentStack(); if (stack !== '') { format += '%s'; diff --git a/compiled/facebook-www/__test_utils__/ReactAllWarnings.js b/compiled/facebook-www/__test_utils__/ReactAllWarnings.js index 6bf413fd1ee8d..11b87ddab8d0a 100644 --- a/compiled/facebook-www/__test_utils__/ReactAllWarnings.js +++ b/compiled/facebook-www/__test_utils__/ReactAllWarnings.js @@ -129,7 +129,6 @@ export default [ "Directly setting property `innerHTML` is not permitted. For more information, lookup documentation on `dangerouslySetInnerHTML`.", "Dispatching inst must not be null", "Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://react.dev/link/rules-of-hooks", - "Each child in a list should have a unique \"key\" prop. See https://react.dev/link/warning-keys for more information.", "Each child in a list should have a unique \"key\" prop.%s%s See https://react.dev/link/warning-keys for more information.", "Encountered a script tag while rendering React component. Scripts inside React components are never executed when rendering on the client. Consider using template tag instead (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template).", "Encountered two children with the same key, `%s`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.",