From 87edb8c1599bd8fded67affbc9e0bf61cad62e67 Mon Sep 17 00:00:00 2001 From: rickhanlonii Date: Fri, 29 Mar 2024 14:15:23 +0000 Subject: [PATCH] Revert "Remove module pattern function component support" (#28670) This breaks internal tests, so must be something in the refactor. Since it's the top commit let's revert and split into two PRs, one that removes the flag and one that does the refactor, so we can find the bug. DiffTrain build for [f2690747239533fa266612d2d4dd9ae88ea92fbc](https://github.com/facebook/react/commit/f2690747239533fa266612d2d4dd9ae88ea92fbc) --- compiled/facebook-www/REVISION | 2 +- compiled/facebook-www/ReactART-dev.classic.js | 280 +++++++--- compiled/facebook-www/ReactART-dev.modern.js | 289 +++++++---- .../facebook-www/ReactART-prod.classic.js | 369 ++++++++------ compiled/facebook-www/ReactART-prod.modern.js | 280 +++++----- compiled/facebook-www/ReactDOM-dev.classic.js | 286 ++++++++--- compiled/facebook-www/ReactDOM-dev.modern.js | 295 +++++++---- .../facebook-www/ReactDOM-prod.classic.js | 481 ++++++++++-------- compiled/facebook-www/ReactDOM-prod.modern.js | 372 +++++++------- .../ReactDOM-profiling.classic.js | 475 +++++++++-------- .../facebook-www/ReactDOM-profiling.modern.js | 366 ++++++------- .../ReactDOMServer-dev.classic.js | 86 +++- .../facebook-www/ReactDOMServer-dev.modern.js | 99 +++- .../ReactDOMServerStreaming-dev.modern.js | 97 +++- .../ReactDOMTesting-dev.classic.js | 286 ++++++++--- .../ReactDOMTesting-dev.modern.js | 295 +++++++---- .../ReactDOMTesting-prod.classic.js | 481 ++++++++++-------- .../ReactDOMTesting-prod.modern.js | 372 +++++++------- .../ReactTestRenderer-dev.classic.js | 272 +++++++--- .../ReactTestRenderer-dev.modern.js | 272 +++++++--- .../ReactTestUtils-dev.classic.js | 1 + .../facebook-www/ReactTestUtils-dev.modern.js | 1 + .../__test_utils__/ReactAllWarnings.js | 1 + 23 files changed, 3536 insertions(+), 2222 deletions(-) diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index 34b653fcecb35..b0f7ca9619362 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -cc56bed38cbe5a5c76dfdc4e9c642fab4884a3fc +f2690747239533fa266612d2d4dd9ae88ea92fbc diff --git a/compiled/facebook-www/ReactART-dev.classic.js b/compiled/facebook-www/ReactART-dev.classic.js index 5ccf98fe8c00b..0ba93d0a5934c 100644 --- a/compiled/facebook-www/ReactART-dev.classic.js +++ b/compiled/facebook-www/ReactART-dev.classic.js @@ -66,7 +66,7 @@ if (__DEV__) { return self; } - var ReactVersion = "19.0.0-www-classic-726e2f78"; + var ReactVersion = "19.0.0-www-classic-3513bb8c"; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -199,6 +199,8 @@ if (__DEV__) { var FunctionComponent = 0; var ClassComponent = 1; + var IndeterminateComponent = 2; // Before we know whether it is function or class + var HostRoot = 3; // Root of a host tree. Could be nested inside another node. var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. @@ -501,6 +503,7 @@ if (__DEV__) { case ClassComponent: case FunctionComponent: case IncompleteClassComponent: + case IndeterminateComponent: case MemoComponent: case SimpleMemoComponent: if (typeof type === "function") { @@ -3764,6 +3767,7 @@ if (__DEV__) { return "SuspenseList"; case FunctionComponent: + case IndeterminateComponent: case SimpleMemoComponent: var fn = fiber.type; return fn.displayName || fn.name || null; @@ -6122,6 +6126,7 @@ if (__DEV__) { return describeBuiltInComponentFrame("SuspenseList"); case FunctionComponent: + case IndeterminateComponent: case SimpleMemoComponent: return describeFunctionComponentFrame(fiber.type); @@ -13831,6 +13836,17 @@ if (__DEV__) { } } + function adoptClassInstance(workInProgress, instance) { + instance.updater = classComponentUpdater; + workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates + + set(instance, workInProgress); + + { + instance._reactInternalInstance = fakeInternalInstance; + } + } + function constructClassInstance(workInProgress, ctor, props) { var isLegacyContextConsumer = false; var unmaskedContext = emptyContextObject; @@ -13906,14 +13922,7 @@ if (__DEV__) { instance.state !== null && instance.state !== undefined ? instance.state : null); - instance.updater = classComponentUpdater; - workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates - - set(instance, workInProgress); - - { - instance._reactInternalInstance = fakeInternalInstance; - } + adoptClassInstance(workInProgress, instance); { if ( @@ -15373,6 +15382,7 @@ if (__DEV__) { ); var didReceiveUpdate = false; var didWarnAboutBadClass; + var didWarnAboutModulePatternComponent; var didWarnAboutContextTypeOnFunctionComponent; var didWarnAboutGetDerivedStateOnFunctionComponent; var didWarnAboutFunctionRefs; @@ -15383,6 +15393,7 @@ if (__DEV__) { { didWarnAboutBadClass = {}; + didWarnAboutModulePatternComponent = {}; didWarnAboutContextTypeOnFunctionComponent = {}; didWarnAboutGetDerivedStateOnFunctionComponent = {}; didWarnAboutFunctionRefs = {}; @@ -16101,39 +16112,6 @@ if (__DEV__) { nextProps, renderLanes ) { - { - if ( - Component.prototype && - typeof Component.prototype.render === "function" - ) { - var componentName = getComponentNameFromType(Component) || "Unknown"; - - if (!didWarnAboutBadClass[componentName]) { - error( - "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + - "This is likely to cause errors. Change %s to extend React.Component instead.", - componentName, - componentName - ); - - didWarnAboutBadClass[componentName] = true; - } - } - - if (workInProgress.mode & StrictLegacyMode) { - ReactStrictModeWarnings.recordLegacyContextWarning( - workInProgress, - null - ); - } - - if (current === null) { - // Some validations were previously done in mountIndeterminateComponent however and are now run - // in updateFuntionComponent but only on mount - validateFunctionComponentInDev(workInProgress, workInProgress.type); - } - } - var context; { @@ -16612,68 +16590,70 @@ if (__DEV__) { var Component = init(payload); // Store the unwrapped component in the type. workInProgress.type = Component; + var resolvedTag = (workInProgress.tag = + resolveLazyComponentTag(Component)); var resolvedProps = resolveDefaultProps(Component, props); + var child; - if (typeof Component === "function") { - if (isFunctionClassComponent(Component)) { - workInProgress.tag = ClassComponent; - + switch (resolvedTag) { + case FunctionComponent: { { + validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = - resolveClassForHotReloading(Component); + resolveFunctionForHotReloading(Component); } - return updateClassComponent( + child = updateFunctionComponent( null, workInProgress, Component, resolvedProps, renderLanes ); - } else { - workInProgress.tag = FunctionComponent; + return child; + } + case ClassComponent: { { - validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = - resolveFunctionForHotReloading(Component); + resolveClassForHotReloading(Component); } - return updateFunctionComponent( + child = updateClassComponent( null, workInProgress, Component, resolvedProps, renderLanes ); + return child; } - } else if (Component !== undefined && Component !== null) { - var $$typeof = Component.$$typeof; - - if ($$typeof === REACT_FORWARD_REF_TYPE) { - workInProgress.tag = ForwardRef; + case ForwardRef: { { workInProgress.type = Component = resolveForwardRefForHotReloading(Component); } - return updateForwardRef( + child = updateForwardRef( null, workInProgress, Component, resolvedProps, renderLanes ); - } else if ($$typeof === REACT_MEMO_TYPE) { - workInProgress.tag = MemoComponent; - return updateMemoComponent( + return child; + } + + case MemoComponent: { + child = updateMemoComponent( null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too renderLanes ); + return child; } } @@ -16735,6 +16715,119 @@ if (__DEV__) { ); } + function mountIndeterminateComponent( + _current, + workInProgress, + Component, + renderLanes + ) { + resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress); + var props = workInProgress.pendingProps; + var context; + + { + var unmaskedContext = getUnmaskedContext( + workInProgress, + Component, + false + ); + context = getMaskedContext(workInProgress, unmaskedContext); + } + + prepareToReadContext(workInProgress, renderLanes); + var value; + + if (enableSchedulingProfiler) { + markComponentRenderStarted(workInProgress); + } + + { + if ( + Component.prototype && + typeof Component.prototype.render === "function" + ) { + var componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutBadClass[componentName]) { + error( + "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + + "This is likely to cause errors. Change %s to extend React.Component instead.", + componentName, + componentName + ); + + didWarnAboutBadClass[componentName] = true; + } + } + + if (workInProgress.mode & StrictLegacyMode) { + ReactStrictModeWarnings.recordLegacyContextWarning( + workInProgress, + null + ); + } + + setIsRendering(true); + ReactCurrentOwner$1.current = workInProgress; + value = renderWithHooks( + null, + workInProgress, + Component, + props, + context, + renderLanes + ); + setIsRendering(false); + } + + if (enableSchedulingProfiler) { + markComponentRenderStopped(); + } // React DevTools reads this flag. + + workInProgress.flags |= PerformedWork; + + { + // Support for module components is deprecated and is removed behind a flag. + // Whether or not it would crash later, we want to show a good message in DEV first. + if ( + typeof value === "object" && + value !== null && + typeof value.render === "function" && + value.$$typeof === undefined + ) { + var _componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutModulePatternComponent[_componentName]) { + error( + "The <%s /> component appears to be a function component that returns a class instance. " + + "Change %s to a class that extends React.Component instead. " + + "If you can't use a class try assigning the prototype on the function as a workaround. " + + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + + "cannot be called with `new` by React.", + _componentName, + _componentName, + _componentName + ); + + didWarnAboutModulePatternComponent[_componentName] = true; + } + } + } + + { + // Proceed under the assumption that this is a function component + workInProgress.tag = FunctionComponent; + + reconcileChildren(null, workInProgress, value, renderLanes); + + { + validateFunctionComponentInDev(workInProgress, Component); + } + + return workInProgress.child; + } + } + function validateFunctionComponentInDev(workInProgress, Component) { { if (Component) { @@ -16771,32 +16864,33 @@ if (__DEV__) { } if (Component.defaultProps !== undefined) { - var _componentName = getComponentNameFromType(Component) || "Unknown"; + var _componentName3 = + getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName]) { + if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName3]) { error( "%s: Support for defaultProps will be removed from function components " + "in a future major release. Use JavaScript default parameters instead.", - _componentName + _componentName3 ); - didWarnAboutDefaultPropsOnFunctionComponent[_componentName] = true; + didWarnAboutDefaultPropsOnFunctionComponent[_componentName3] = true; } } if (typeof Component.getDerivedStateFromProps === "function") { - var _componentName2 = + var _componentName4 = getComponentNameFromType(Component) || "Unknown"; if ( - !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] + !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] ) { error( "%s: Function components do not support getDerivedStateFromProps.", - _componentName2 + _componentName4 ); - didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = + didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] = true; } } @@ -16805,16 +16899,16 @@ if (__DEV__) { typeof Component.contextType === "object" && Component.contextType !== null ) { - var _componentName3 = + var _componentName5 = getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) { + if (!didWarnAboutContextTypeOnFunctionComponent[_componentName5]) { error( "%s: Function components do not support contextType.", - _componentName3 + _componentName5 ); - didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true; + didWarnAboutContextTypeOnFunctionComponent[_componentName5] = true; } } } @@ -18684,6 +18778,15 @@ if (__DEV__) { workInProgress.lanes = NoLanes; switch (workInProgress.tag) { + case IndeterminateComponent: { + return mountIndeterminateComponent( + current, + workInProgress, + workInProgress.type, + renderLanes + ); + } + case LazyComponent: { var elementType = workInProgress.elementType; return mountLazyComponent( @@ -20424,6 +20527,7 @@ if (__DEV__) { var newProps = workInProgress.pendingProps; // Note: This intentionally doesn't check if we're hydrating because comparing switch (workInProgress.tag) { + case IndeterminateComponent: case LazyComponent: case SimpleMemoComponent: case FunctionComponent: @@ -27587,6 +27691,12 @@ if (__DEV__) { } switch (unitOfWork.tag) { + case IndeterminateComponent: { + // Because it suspended with `use`, we can assume it's a + // function component. + unitOfWork.tag = FunctionComponent; // Fallthrough to the next branch. + } + case SimpleMemoComponent: case FunctionComponent: { // Resolve `defaultProps`. This logic is copied from `beginWork`. @@ -28959,6 +29069,7 @@ if (__DEV__) { var tag = fiber.tag; if ( + tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && @@ -29757,8 +29868,22 @@ if (__DEV__) { type.defaultProps === undefined ); } - function isFunctionClassComponent(type) { - return shouldConstruct(type); + function resolveLazyComponentTag(Component) { + if (typeof Component === "function") { + return shouldConstruct(Component) ? ClassComponent : FunctionComponent; + } else if (Component !== undefined && Component !== null) { + var $$typeof = Component.$$typeof; + + if ($$typeof === REACT_FORWARD_REF_TYPE) { + return ForwardRef; + } + + if ($$typeof === REACT_MEMO_TYPE) { + return MemoComponent; + } + } + + return IndeterminateComponent; } // This is used to create an alternate fiber to do work on. function createWorkInProgress(current, pendingProps) { @@ -29843,6 +29968,7 @@ if (__DEV__) { workInProgress._debugNeedsRemount = current._debugNeedsRemount; switch (workInProgress.tag) { + case IndeterminateComponent: case FunctionComponent: case SimpleMemoComponent: workInProgress.type = resolveFunctionForHotReloading(current.type); @@ -29968,7 +30094,7 @@ if (__DEV__) { mode, lanes ) { - var fiberTag = FunctionComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. + var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. var resolvedType = type; diff --git a/compiled/facebook-www/ReactART-dev.modern.js b/compiled/facebook-www/ReactART-dev.modern.js index 89de7b31b9623..3ddf97018148f 100644 --- a/compiled/facebook-www/ReactART-dev.modern.js +++ b/compiled/facebook-www/ReactART-dev.modern.js @@ -66,7 +66,7 @@ if (__DEV__) { return self; } - var ReactVersion = "19.0.0-www-modern-10db1517"; + var ReactVersion = "19.0.0-www-modern-6b2eae4e"; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -199,6 +199,8 @@ if (__DEV__) { var FunctionComponent = 0; var ClassComponent = 1; + var IndeterminateComponent = 2; // Before we know whether it is function or class + var HostRoot = 3; // Root of a host tree. Could be nested inside another node. var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. @@ -501,6 +503,7 @@ if (__DEV__) { case ClassComponent: case FunctionComponent: case IncompleteClassComponent: + case IndeterminateComponent: case MemoComponent: case SimpleMemoComponent: if (typeof type === "function") { @@ -3529,6 +3532,7 @@ if (__DEV__) { return "SuspenseList"; case FunctionComponent: + case IndeterminateComponent: case SimpleMemoComponent: var fn = fiber.type; return fn.displayName || fn.name || null; @@ -5887,6 +5891,7 @@ if (__DEV__) { return describeBuiltInComponentFrame("SuspenseList"); case FunctionComponent: + case IndeterminateComponent: case SimpleMemoComponent: return describeFunctionComponentFrame(fiber.type); @@ -13588,6 +13593,17 @@ if (__DEV__) { } } + function adoptClassInstance(workInProgress, instance) { + instance.updater = classComponentUpdater; + workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates + + set(instance, workInProgress); + + { + instance._reactInternalInstance = fakeInternalInstance; + } + } + function constructClassInstance(workInProgress, ctor, props) { var context = emptyContextObject; var contextType = ctor.contextType; @@ -13653,14 +13669,7 @@ if (__DEV__) { instance.state !== null && instance.state !== undefined ? instance.state : null); - instance.updater = classComponentUpdater; - workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates - - set(instance, workInProgress); - - { - instance._reactInternalInstance = fakeInternalInstance; - } + adoptClassInstance(workInProgress, instance); { if ( @@ -15097,6 +15106,7 @@ if (__DEV__) { ); var didReceiveUpdate = false; var didWarnAboutBadClass; + var didWarnAboutModulePatternComponent; var didWarnAboutContextTypeOnFunctionComponent; var didWarnAboutGetDerivedStateOnFunctionComponent; var didWarnAboutFunctionRefs; @@ -15107,6 +15117,7 @@ if (__DEV__) { { didWarnAboutBadClass = {}; + didWarnAboutModulePatternComponent = {}; didWarnAboutContextTypeOnFunctionComponent = {}; didWarnAboutGetDerivedStateOnFunctionComponent = {}; didWarnAboutFunctionRefs = {}; @@ -15825,47 +15836,6 @@ if (__DEV__) { nextProps, renderLanes ) { - { - if ( - Component.prototype && - typeof Component.prototype.render === "function" - ) { - var componentName = getComponentNameFromType(Component) || "Unknown"; - - if (!didWarnAboutBadClass[componentName]) { - error( - "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + - "This is likely to cause errors. Change %s to extend React.Component instead.", - componentName, - componentName - ); - - didWarnAboutBadClass[componentName] = true; - } - } - - if (workInProgress.mode & StrictLegacyMode) { - ReactStrictModeWarnings.recordLegacyContextWarning( - workInProgress, - null - ); - } - - if (current === null) { - // Some validations were previously done in mountIndeterminateComponent however and are now run - // in updateFuntionComponent but only on mount - validateFunctionComponentInDev(workInProgress, workInProgress.type); - - if (Component.contextTypes) { - error( - "%s uses the legacy contextTypes API which was removed in React 19. " + - "Use React.createContext() with React.useContext() instead.", - getComponentNameFromType(Component) || "Unknown" - ); - } - } - } - var context; var nextChildren; @@ -16314,68 +16284,70 @@ if (__DEV__) { var Component = init(payload); // Store the unwrapped component in the type. workInProgress.type = Component; + var resolvedTag = (workInProgress.tag = + resolveLazyComponentTag(Component)); var resolvedProps = resolveDefaultProps(Component, props); + var child; - if (typeof Component === "function") { - if (isFunctionClassComponent(Component)) { - workInProgress.tag = ClassComponent; - + switch (resolvedTag) { + case FunctionComponent: { { + validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = - resolveClassForHotReloading(Component); + resolveFunctionForHotReloading(Component); } - return updateClassComponent( + child = updateFunctionComponent( null, workInProgress, Component, resolvedProps, renderLanes ); - } else { - workInProgress.tag = FunctionComponent; + return child; + } + case ClassComponent: { { - validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = - resolveFunctionForHotReloading(Component); + resolveClassForHotReloading(Component); } - return updateFunctionComponent( + child = updateClassComponent( null, workInProgress, Component, resolvedProps, renderLanes ); + return child; } - } else if (Component !== undefined && Component !== null) { - var $$typeof = Component.$$typeof; - - if ($$typeof === REACT_FORWARD_REF_TYPE) { - workInProgress.tag = ForwardRef; + case ForwardRef: { { workInProgress.type = Component = resolveForwardRefForHotReloading(Component); } - return updateForwardRef( + child = updateForwardRef( null, workInProgress, Component, resolvedProps, renderLanes ); - } else if ($$typeof === REACT_MEMO_TYPE) { - workInProgress.tag = MemoComponent; - return updateMemoComponent( + return child; + } + + case MemoComponent: { + child = updateMemoComponent( null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too renderLanes ); + return child; } } @@ -16436,6 +16408,120 @@ if (__DEV__) { ); } + function mountIndeterminateComponent( + _current, + workInProgress, + Component, + renderLanes + ) { + resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress); + var props = workInProgress.pendingProps; + var context; + + prepareToReadContext(workInProgress, renderLanes); + var value; + + if (enableSchedulingProfiler) { + markComponentRenderStarted(workInProgress); + } + + { + if ( + Component.prototype && + typeof Component.prototype.render === "function" + ) { + var componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutBadClass[componentName]) { + error( + "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + + "This is likely to cause errors. Change %s to extend React.Component instead.", + componentName, + componentName + ); + + didWarnAboutBadClass[componentName] = true; + } + } + + if (workInProgress.mode & StrictLegacyMode) { + ReactStrictModeWarnings.recordLegacyContextWarning( + workInProgress, + null + ); + } + + setIsRendering(true); + ReactCurrentOwner$1.current = workInProgress; + value = renderWithHooks( + null, + workInProgress, + Component, + props, + context, + renderLanes + ); + setIsRendering(false); + } + + if (enableSchedulingProfiler) { + markComponentRenderStopped(); + } // React DevTools reads this flag. + + workInProgress.flags |= PerformedWork; + + { + // Support for module components is deprecated and is removed behind a flag. + // Whether or not it would crash later, we want to show a good message in DEV first. + if ( + typeof value === "object" && + value !== null && + typeof value.render === "function" && + value.$$typeof === undefined + ) { + var _componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutModulePatternComponent[_componentName]) { + error( + "The <%s /> component appears to be a function component that returns a class instance. " + + "Change %s to a class that extends React.Component instead. " + + "If you can't use a class try assigning the prototype on the function as a workaround. " + + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + + "cannot be called with `new` by React.", + _componentName, + _componentName, + _componentName + ); + + didWarnAboutModulePatternComponent[_componentName] = true; + } + } + } + + { + // Proceed under the assumption that this is a function component + workInProgress.tag = FunctionComponent; + + { + if (Component.contextTypes) { + error( + "%s uses the legacy contextTypes API which was removed in React 19. " + + "Use React.createContext() with React.useContext() instead.", + getComponentNameFromType(Component) || "Unknown" + ); + } + } + + reconcileChildren(null, workInProgress, value, renderLanes); + + { + validateFunctionComponentInDev(workInProgress, Component); + } + + return workInProgress.child; + } + } + function validateFunctionComponentInDev(workInProgress, Component) { { if (Component) { @@ -16472,32 +16558,33 @@ if (__DEV__) { } if (Component.defaultProps !== undefined) { - var _componentName = getComponentNameFromType(Component) || "Unknown"; + var _componentName3 = + getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName]) { + if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName3]) { error( "%s: Support for defaultProps will be removed from function components " + "in a future major release. Use JavaScript default parameters instead.", - _componentName + _componentName3 ); - didWarnAboutDefaultPropsOnFunctionComponent[_componentName] = true; + didWarnAboutDefaultPropsOnFunctionComponent[_componentName3] = true; } } if (typeof Component.getDerivedStateFromProps === "function") { - var _componentName2 = + var _componentName4 = getComponentNameFromType(Component) || "Unknown"; if ( - !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] + !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] ) { error( "%s: Function components do not support getDerivedStateFromProps.", - _componentName2 + _componentName4 ); - didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = + didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] = true; } } @@ -16506,16 +16593,16 @@ if (__DEV__) { typeof Component.contextType === "object" && Component.contextType !== null ) { - var _componentName3 = + var _componentName5 = getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) { + if (!didWarnAboutContextTypeOnFunctionComponent[_componentName5]) { error( "%s: Function components do not support contextType.", - _componentName3 + _componentName5 ); - didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true; + didWarnAboutContextTypeOnFunctionComponent[_componentName5] = true; } } } @@ -18379,6 +18466,15 @@ if (__DEV__) { workInProgress.lanes = NoLanes; switch (workInProgress.tag) { + case IndeterminateComponent: { + return mountIndeterminateComponent( + current, + workInProgress, + workInProgress.type, + renderLanes + ); + } + case LazyComponent: { var elementType = workInProgress.elementType; return mountLazyComponent( @@ -20119,6 +20215,7 @@ if (__DEV__) { var newProps = workInProgress.pendingProps; // Note: This intentionally doesn't check if we're hydrating because comparing switch (workInProgress.tag) { + case IndeterminateComponent: case LazyComponent: case SimpleMemoComponent: case FunctionComponent: @@ -27253,6 +27350,12 @@ if (__DEV__) { } switch (unitOfWork.tag) { + case IndeterminateComponent: { + // Because it suspended with `use`, we can assume it's a + // function component. + unitOfWork.tag = FunctionComponent; // Fallthrough to the next branch. + } + case SimpleMemoComponent: case FunctionComponent: { // Resolve `defaultProps`. This logic is copied from `beginWork`. @@ -28616,6 +28719,7 @@ if (__DEV__) { var tag = fiber.tag; if ( + tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && @@ -29414,8 +29518,22 @@ if (__DEV__) { type.defaultProps === undefined ); } - function isFunctionClassComponent(type) { - return shouldConstruct(type); + function resolveLazyComponentTag(Component) { + if (typeof Component === "function") { + return shouldConstruct(Component) ? ClassComponent : FunctionComponent; + } else if (Component !== undefined && Component !== null) { + var $$typeof = Component.$$typeof; + + if ($$typeof === REACT_FORWARD_REF_TYPE) { + return ForwardRef; + } + + if ($$typeof === REACT_MEMO_TYPE) { + return MemoComponent; + } + } + + return IndeterminateComponent; } // This is used to create an alternate fiber to do work on. function createWorkInProgress(current, pendingProps) { @@ -29500,6 +29618,7 @@ if (__DEV__) { workInProgress._debugNeedsRemount = current._debugNeedsRemount; switch (workInProgress.tag) { + case IndeterminateComponent: case FunctionComponent: case SimpleMemoComponent: workInProgress.type = resolveFunctionForHotReloading(current.type); @@ -29625,7 +29744,7 @@ if (__DEV__) { mode, lanes ) { - var fiberTag = FunctionComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. + var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. var resolvedType = type; diff --git a/compiled/facebook-www/ReactART-prod.classic.js b/compiled/facebook-www/ReactART-prod.classic.js index f416d56876d4f..a7698ca8d7f83 100644 --- a/compiled/facebook-www/ReactART-prod.classic.js +++ b/compiled/facebook-www/ReactART-prod.classic.js @@ -229,6 +229,7 @@ function getComponentNameFromFiber(fiber) { case 1: case 0: case 17: + case 2: case 14: case 15: if ("function" === typeof type) @@ -1663,6 +1664,7 @@ function describeFiber(fiber) { case 19: return describeBuiltInComponentFrame("SuspenseList"); case 0: + case 2: case 15: return (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; case 11: @@ -5611,91 +5613,108 @@ function beginWork(current, workInProgress, renderLanes) { else didReceiveUpdate = !1; workInProgress.lanes = 0; switch (workInProgress.tag) { + case 2: + var Component = workInProgress.type; + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + var context = getMaskedContext( + workInProgress, + contextStackCursor$1.current + ); + prepareToReadContext(workInProgress, renderLanes); + current = renderWithHooks( + null, + workInProgress, + Component, + current, + context, + renderLanes + ); + workInProgress.flags |= 1; + workInProgress.tag = 0; + reconcileChildren(null, workInProgress, current, renderLanes); + workInProgress = workInProgress.child; + return workInProgress; case 16: - var elementType = workInProgress.elementType; + Component = workInProgress.elementType; a: { resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); current = workInProgress.pendingProps; - var init = elementType._init; - elementType = init(elementType._payload); - workInProgress.type = elementType; - current = resolveDefaultProps(elementType, current); - if ("function" === typeof elementType) - shouldConstruct(elementType) - ? ((workInProgress.tag = 1), - (workInProgress = updateClassComponent( - null, - workInProgress, - elementType, - current, - renderLanes - ))) - : ((workInProgress.tag = 0), - (workInProgress = updateFunctionComponent( - null, - workInProgress, - elementType, - current, - renderLanes - ))); - else { - if (void 0 !== elementType && null !== elementType) - if ( - ((init = elementType.$$typeof), init === REACT_FORWARD_REF_TYPE) - ) { - workInProgress.tag = 11; - workInProgress = updateForwardRef( - null, - workInProgress, - elementType, - current, - renderLanes - ); - break a; - } else if (init === REACT_MEMO_TYPE) { - workInProgress.tag = 14; - workInProgress = updateMemoComponent( - null, - workInProgress, - elementType, - resolveDefaultProps(elementType.type, current), - renderLanes - ); - break a; - } - throw Error(formatProdErrorMessage(306, elementType, "")); + context = Component._init; + Component = context(Component._payload); + workInProgress.type = Component; + context = workInProgress.tag = resolveLazyComponentTag(Component); + current = resolveDefaultProps(Component, current); + switch (context) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + Component, + resolveDefaultProps(Component.type, current), + renderLanes + ); + break a; } + throw Error(formatProdErrorMessage(306, Component, "")); } return workInProgress; case 0: return ( - (elementType = workInProgress.type), - (init = workInProgress.pendingProps), - (init = - workInProgress.elementType === elementType - ? init - : resolveDefaultProps(elementType, init)), + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), updateFunctionComponent( current, workInProgress, - elementType, - init, + Component, + context, renderLanes ) ); case 1: return ( - (elementType = workInProgress.type), - (init = workInProgress.pendingProps), - (init = - workInProgress.elementType === elementType - ? init - : resolveDefaultProps(elementType, init)), + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), updateClassComponent( current, workInProgress, - elementType, - init, + Component, + context, renderLanes ) ); @@ -5703,8 +5722,8 @@ function beginWork(current, workInProgress, renderLanes) { pushHostRootContext(workInProgress); if (null === current) throw Error(formatProdErrorMessage(387)); var nextProps = workInProgress.pendingProps; - init = workInProgress.memoizedState; - elementType = init.element; + context = workInProgress.memoizedState; + Component = context.element; cloneUpdateQueue(current, workInProgress); processUpdateQueue(workInProgress, nextProps, null, renderLanes); nextProps = workInProgress.memoizedState; @@ -5713,17 +5732,17 @@ function beginWork(current, workInProgress, renderLanes) { enableTransitionTracing && pushRootMarkerInstance(workInProgress); var nextCache = nextProps.cache; pushProvider(workInProgress, CacheContext, nextCache); - nextCache !== init.cache && + nextCache !== context.cache && propagateContextChange(workInProgress, CacheContext, renderLanes); suspendIfUpdateReadFromEntangledAsyncAction(); - init = nextProps.element; - init === elementType + context = nextProps.element; + context === Component ? (workInProgress = bailoutOnAlreadyFinishedWork( current, workInProgress, renderLanes )) - : (reconcileChildren(current, workInProgress, init, renderLanes), + : (reconcileChildren(current, workInProgress, context, renderLanes), (workInProgress = workInProgress.child)); return workInProgress; case 26: @@ -5731,17 +5750,17 @@ function beginWork(current, workInProgress, renderLanes) { case 5: return ( pushHostContext(workInProgress), - (init = workInProgress.type), + (context = workInProgress.type), (nextProps = workInProgress.pendingProps), (nextCache = null !== current ? current.memoizedProps : null), - (elementType = nextProps.children), - shouldSetTextContent(init, nextProps) - ? (elementType = null) + (Component = nextProps.children), + shouldSetTextContent(context, nextProps) + ? (Component = null) : null !== nextCache && - shouldSetTextContent(init, nextCache) && + shouldSetTextContent(context, nextCache) && (workInProgress.flags |= 32), null !== workInProgress.memoizedState && - ((init = renderWithHooks( + ((context = renderWithHooks( current, workInProgress, TransitionAwareHostComponent, @@ -5749,18 +5768,18 @@ function beginWork(current, workInProgress, renderLanes) { null, renderLanes )), - (HostTransitionContext._currentValue2 = init), + (HostTransitionContext._currentValue2 = context), enableLazyContextPropagation || (didReceiveUpdate && null !== current && - current.memoizedState.memoizedState !== init && + current.memoizedState.memoizedState !== context && propagateContextChange( workInProgress, HostTransitionContext, renderLanes ))), markRef(current, workInProgress), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 6: @@ -5773,35 +5792,30 @@ function beginWork(current, workInProgress, renderLanes) { workInProgress, workInProgress.stateNode.containerInfo ), - (elementType = workInProgress.pendingProps), + (Component = workInProgress.pendingProps), null === current ? (workInProgress.child = reconcileChildFibers( workInProgress, null, - elementType, + Component, renderLanes )) - : reconcileChildren( - current, - workInProgress, - elementType, - renderLanes - ), + : reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 11: return ( - (elementType = workInProgress.type), - (init = workInProgress.pendingProps), - (init = - workInProgress.elementType === elementType - ? init - : resolveDefaultProps(elementType, init)), + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), updateForwardRef( current, workInProgress, - elementType, - init, + Component, + context, renderLanes ) ); @@ -5837,17 +5851,17 @@ function beginWork(current, workInProgress, renderLanes) { ); case 10: a: { - elementType = enableRenderableContext + Component = enableRenderableContext ? workInProgress.type : workInProgress.type._context; - init = workInProgress.pendingProps; + context = workInProgress.pendingProps; nextProps = workInProgress.memoizedProps; - nextCache = init.value; - pushProvider(workInProgress, elementType, nextCache); + nextCache = context.value; + pushProvider(workInProgress, Component, nextCache); if (!enableLazyContextPropagation && null !== nextProps) if (objectIs(nextProps.value, nextCache)) { if ( - nextProps.children === init.children && + nextProps.children === context.children && !didPerformWorkStackCursor.current ) { workInProgress = bailoutOnAlreadyFinishedWork( @@ -5857,35 +5871,39 @@ function beginWork(current, workInProgress, renderLanes) { ); break a; } - } else - propagateContextChange(workInProgress, elementType, renderLanes); - reconcileChildren(current, workInProgress, init.children, renderLanes); + } else propagateContextChange(workInProgress, Component, renderLanes); + reconcileChildren( + current, + workInProgress, + context.children, + renderLanes + ); workInProgress = workInProgress.child; } return workInProgress; case 9: return ( - (init = enableRenderableContext + (context = enableRenderableContext ? workInProgress.type._context : workInProgress.type), - (elementType = workInProgress.pendingProps.children), + (Component = workInProgress.pendingProps.children), prepareToReadContext(workInProgress, renderLanes), - (init = readContext(init)), - (elementType = elementType(init)), + (context = readContext(context)), + (Component = Component(context)), (workInProgress.flags |= 1), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 14: return ( - (elementType = workInProgress.type), - (init = resolveDefaultProps(elementType, workInProgress.pendingProps)), - (init = resolveDefaultProps(elementType.type, init)), + (Component = workInProgress.type), + (context = resolveDefaultProps(Component, workInProgress.pendingProps)), + (context = resolveDefaultProps(Component.type, context)), updateMemoComponent( current, workInProgress, - elementType, - init, + Component, + context, renderLanes ) ); @@ -5899,24 +5917,24 @@ function beginWork(current, workInProgress, renderLanes) { ); case 17: return ( - (elementType = workInProgress.type), - (init = workInProgress.pendingProps), - (init = - workInProgress.elementType === elementType - ? init - : resolveDefaultProps(elementType, init)), + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), (workInProgress.tag = 1), - isContextProvider(elementType) + isContextProvider(Component) ? ((current = !0), pushContextProvider(workInProgress)) : (current = !1), prepareToReadContext(workInProgress, renderLanes), - constructClassInstance(workInProgress, elementType, init), - mountClassInstance(workInProgress, elementType, init, renderLanes), + constructClassInstance(workInProgress, Component, context), + mountClassInstance(workInProgress, Component, context, renderLanes), finishClassComponent( null, workInProgress, - elementType, + Component, !0, current, renderLanes @@ -5926,9 +5944,9 @@ function beginWork(current, workInProgress, renderLanes) { return updateSuspenseListComponent(current, workInProgress, renderLanes); case 21: return ( - (elementType = workInProgress.pendingProps.children), + (Component = workInProgress.pendingProps.children), markRef(current, workInProgress), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 22: @@ -5938,39 +5956,39 @@ function beginWork(current, workInProgress, renderLanes) { case 24: return ( prepareToReadContext(workInProgress, renderLanes), - (elementType = readContext(CacheContext)), + (Component = readContext(CacheContext)), null === current - ? ((init = peekCacheFromPool()), - null === init && - ((init = workInProgressRoot), + ? ((context = peekCacheFromPool()), + null === context && + ((context = workInProgressRoot), (nextProps = createCache()), - (init.pooledCache = nextProps), + (context.pooledCache = nextProps), nextProps.refCount++, - null !== nextProps && (init.pooledCacheLanes |= renderLanes), - (init = nextProps)), + null !== nextProps && (context.pooledCacheLanes |= renderLanes), + (context = nextProps)), (workInProgress.memoizedState = { - parent: elementType, - cache: init + parent: Component, + cache: context }), initializeUpdateQueue(workInProgress), - pushProvider(workInProgress, CacheContext, init)) + pushProvider(workInProgress, CacheContext, context)) : (0 !== (current.lanes & renderLanes) && (cloneUpdateQueue(current, workInProgress), processUpdateQueue(workInProgress, null, null, renderLanes), suspendIfUpdateReadFromEntangledAsyncAction()), - (init = current.memoizedState), + (context = current.memoizedState), (nextProps = workInProgress.memoizedState), - init.parent !== elementType - ? ((init = { parent: elementType, cache: elementType }), - (workInProgress.memoizedState = init), + context.parent !== Component + ? ((context = { parent: Component, cache: Component }), + (workInProgress.memoizedState = context), 0 === workInProgress.lanes && (workInProgress.memoizedState = workInProgress.updateQueue.baseState = - init), - pushProvider(workInProgress, CacheContext, elementType)) - : ((elementType = nextProps.cache), - pushProvider(workInProgress, CacheContext, elementType), - elementType !== init.cache && + context), + pushProvider(workInProgress, CacheContext, Component)) + : ((Component = nextProps.cache), + pushProvider(workInProgress, CacheContext, Component), + Component !== context.cache && propagateContextChange( workInProgress, CacheContext, @@ -5989,22 +6007,22 @@ function beginWork(current, workInProgress, renderLanes) { return ( enableTransitionTracing ? (null === current && - ((elementType = enableTransitionTracing + ((Component = enableTransitionTracing ? transitionStack.current : null), - null !== elementType && - ((elementType = { + null !== Component && + ((Component = { tag: 1, - transitions: new Set(elementType), + transitions: new Set(Component), pendingBoundaries: null, name: workInProgress.pendingProps.name, aborts: null }), - (workInProgress.stateNode = elementType), + (workInProgress.stateNode = Component), (workInProgress.flags |= 2048))), - (elementType = workInProgress.stateNode), - null !== elementType && - pushMarkerInstance(workInProgress, elementType), + (Component = workInProgress.stateNode), + null !== Component && + pushMarkerInstance(workInProgress, Component), reconcileChildren( current, workInProgress, @@ -6526,6 +6544,7 @@ function bubbleProperties(completedWork) { function completeWork(current, workInProgress, renderLanes) { var newProps = workInProgress.pendingProps; switch (workInProgress.tag) { + case 2: case 16: case 15: case 0: @@ -9611,6 +9630,8 @@ function performUnitOfWork(unitOfWork) { function replaySuspendedUnitOfWork(unitOfWork) { var current = unitOfWork.alternate; switch (unitOfWork.tag) { + case 2: + unitOfWork.tag = 0; case 15: case 0: var Component = unitOfWork.type, @@ -10082,6 +10103,16 @@ function shouldConstruct(Component) { Component = Component.prototype; return !(!Component || !Component.isReactComponent); } +function resolveLazyComponentTag(Component) { + if ("function" === typeof Component) + return shouldConstruct(Component) ? 1 : 0; + if (void 0 !== Component && null !== Component) { + Component = Component.$$typeof; + if (Component === REACT_FORWARD_REF_TYPE) return 11; + if (Component === REACT_MEMO_TYPE) return 14; + } + return 2; +} function createWorkInProgress(current, pendingProps) { var workInProgress = current.alternate; null === workInProgress @@ -10159,7 +10190,7 @@ function createFiberFromTypeAndProps( mode, lanes ) { - var fiberTag = 0; + var fiberTag = 2; owner = type; if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); else if ("string" === typeof type) fiberTag = 5; @@ -10581,19 +10612,19 @@ var slice = Array.prototype.slice, }; return Text; })(React.Component), - devToolsConfig$jscomp$inline_1105 = { + devToolsConfig$jscomp$inline_1119 = { findFiberByHostInstance: function () { return null; }, bundleType: 0, - version: "19.0.0-www-classic-5fe4dc7b", + version: "19.0.0-www-classic-1ca45163", rendererPackageName: "react-art" }; -var internals$jscomp$inline_1307 = { - bundleType: devToolsConfig$jscomp$inline_1105.bundleType, - version: devToolsConfig$jscomp$inline_1105.version, - rendererPackageName: devToolsConfig$jscomp$inline_1105.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1105.rendererConfig, +var internals$jscomp$inline_1324 = { + bundleType: devToolsConfig$jscomp$inline_1119.bundleType, + version: devToolsConfig$jscomp$inline_1119.version, + rendererPackageName: devToolsConfig$jscomp$inline_1119.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1119.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10610,26 +10641,26 @@ var internals$jscomp$inline_1307 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1105.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1119.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-5fe4dc7b" + reconcilerVersion: "19.0.0-www-classic-1ca45163" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1308 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1325 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1308.isDisabled && - hook$jscomp$inline_1308.supportsFiber + !hook$jscomp$inline_1325.isDisabled && + hook$jscomp$inline_1325.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1308.inject( - internals$jscomp$inline_1307 + (rendererID = hook$jscomp$inline_1325.inject( + internals$jscomp$inline_1324 )), - (injectedHook = hook$jscomp$inline_1308); + (injectedHook = hook$jscomp$inline_1325); } catch (err) {} } var Path = Mode$1.Path; diff --git a/compiled/facebook-www/ReactART-prod.modern.js b/compiled/facebook-www/ReactART-prod.modern.js index 85b1446901dd5..d174c6ad104dd 100644 --- a/compiled/facebook-www/ReactART-prod.modern.js +++ b/compiled/facebook-www/ReactART-prod.modern.js @@ -1460,6 +1460,7 @@ function describeFiber(fiber) { case 19: return describeBuiltInComponentFrame("SuspenseList"); case 0: + case 2: case 15: return (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; case 11: @@ -5354,90 +5355,103 @@ function beginWork(current, workInProgress, renderLanes) { else didReceiveUpdate = !1; workInProgress.lanes = 0; switch (workInProgress.tag) { + case 2: + var Component = workInProgress.type; + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + prepareToReadContext(workInProgress, renderLanes); + current = renderWithHooks( + null, + workInProgress, + Component, + current, + void 0, + renderLanes + ); + workInProgress.flags |= 1; + workInProgress.tag = 0; + reconcileChildren(null, workInProgress, current, renderLanes); + workInProgress = workInProgress.child; + return workInProgress; case 16: - var elementType = workInProgress.elementType; + Component = workInProgress.elementType; a: { resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); current = workInProgress.pendingProps; - var init = elementType._init; - elementType = init(elementType._payload); - workInProgress.type = elementType; - current = resolveDefaultProps(elementType, current); - if ("function" === typeof elementType) - shouldConstruct(elementType) - ? ((workInProgress.tag = 1), - (workInProgress = updateClassComponent( - null, - workInProgress, - elementType, - current, - renderLanes - ))) - : ((workInProgress.tag = 0), - (workInProgress = updateFunctionComponent( - null, - workInProgress, - elementType, - current, - renderLanes - ))); - else { - if (void 0 !== elementType && null !== elementType) - if ( - ((init = elementType.$$typeof), init === REACT_FORWARD_REF_TYPE) - ) { - workInProgress.tag = 11; - workInProgress = updateForwardRef( - null, - workInProgress, - elementType, - current, - renderLanes - ); - break a; - } else if (init === REACT_MEMO_TYPE) { - workInProgress.tag = 14; - workInProgress = updateMemoComponent( - null, - workInProgress, - elementType, - resolveDefaultProps(elementType.type, current), - renderLanes - ); - break a; - } - throw Error(formatProdErrorMessage(306, elementType, "")); + var init = Component._init; + Component = init(Component._payload); + workInProgress.type = Component; + init = workInProgress.tag = resolveLazyComponentTag(Component); + current = resolveDefaultProps(Component, current); + switch (init) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + Component, + resolveDefaultProps(Component.type, current), + renderLanes + ); + break a; } + throw Error(formatProdErrorMessage(306, Component, "")); } return workInProgress; case 0: return ( - (elementType = workInProgress.type), + (Component = workInProgress.type), (init = workInProgress.pendingProps), (init = - workInProgress.elementType === elementType + workInProgress.elementType === Component ? init - : resolveDefaultProps(elementType, init)), + : resolveDefaultProps(Component, init)), updateFunctionComponent( current, workInProgress, - elementType, + Component, init, renderLanes ) ); case 1: return ( - (elementType = workInProgress.type), + (Component = workInProgress.type), (init = workInProgress.pendingProps), (init = - workInProgress.elementType === elementType + workInProgress.elementType === Component ? init - : resolveDefaultProps(elementType, init)), + : resolveDefaultProps(Component, init)), updateClassComponent( current, workInProgress, - elementType, + Component, init, renderLanes ) @@ -5447,7 +5461,7 @@ function beginWork(current, workInProgress, renderLanes) { if (null === current) throw Error(formatProdErrorMessage(387)); var nextProps = workInProgress.pendingProps; init = workInProgress.memoizedState; - elementType = init.element; + Component = init.element; cloneUpdateQueue(current, workInProgress); processUpdateQueue(workInProgress, nextProps, null, renderLanes); nextProps = workInProgress.memoizedState; @@ -5460,7 +5474,7 @@ function beginWork(current, workInProgress, renderLanes) { propagateContextChange(workInProgress, CacheContext, renderLanes); suspendIfUpdateReadFromEntangledAsyncAction(); init = nextProps.element; - init === elementType + init === Component ? (workInProgress = bailoutOnAlreadyFinishedWork( current, workInProgress, @@ -5477,9 +5491,9 @@ function beginWork(current, workInProgress, renderLanes) { (init = workInProgress.type), (nextProps = workInProgress.pendingProps), (nextCache = null !== current ? current.memoizedProps : null), - (elementType = nextProps.children), + (Component = nextProps.children), shouldSetTextContent(init, nextProps) - ? (elementType = null) + ? (Component = null) : null !== nextCache && shouldSetTextContent(init, nextCache) && (workInProgress.flags |= 32), @@ -5503,7 +5517,7 @@ function beginWork(current, workInProgress, renderLanes) { renderLanes ))), markRef(current, workInProgress), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 6: @@ -5516,37 +5530,26 @@ function beginWork(current, workInProgress, renderLanes) { workInProgress, workInProgress.stateNode.containerInfo ), - (elementType = workInProgress.pendingProps), + (Component = workInProgress.pendingProps), null === current ? (workInProgress.child = reconcileChildFibers( workInProgress, null, - elementType, + Component, renderLanes )) - : reconcileChildren( - current, - workInProgress, - elementType, - renderLanes - ), + : reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 11: return ( - (elementType = workInProgress.type), + (Component = workInProgress.type), (init = workInProgress.pendingProps), (init = - workInProgress.elementType === elementType + workInProgress.elementType === Component ? init - : resolveDefaultProps(elementType, init)), - updateForwardRef( - current, - workInProgress, - elementType, - init, - renderLanes - ) + : resolveDefaultProps(Component, init)), + updateForwardRef(current, workInProgress, Component, init, renderLanes) ); case 7: return ( @@ -5580,13 +5583,13 @@ function beginWork(current, workInProgress, renderLanes) { ); case 10: a: { - elementType = enableRenderableContext + Component = enableRenderableContext ? workInProgress.type : workInProgress.type._context; init = workInProgress.pendingProps; nextProps = workInProgress.memoizedProps; nextCache = init.value; - pushProvider(workInProgress, elementType, nextCache); + pushProvider(workInProgress, Component, nextCache); if (!enableLazyContextPropagation && null !== nextProps) if (objectIs(nextProps.value, nextCache)) { if (nextProps.children === init.children) { @@ -5597,8 +5600,7 @@ function beginWork(current, workInProgress, renderLanes) { ); break a; } - } else - propagateContextChange(workInProgress, elementType, renderLanes); + } else propagateContextChange(workInProgress, Component, renderLanes); reconcileChildren(current, workInProgress, init.children, renderLanes); workInProgress = workInProgress.child; } @@ -5608,23 +5610,23 @@ function beginWork(current, workInProgress, renderLanes) { (init = enableRenderableContext ? workInProgress.type._context : workInProgress.type), - (elementType = workInProgress.pendingProps.children), + (Component = workInProgress.pendingProps.children), prepareToReadContext(workInProgress, renderLanes), (init = readContext(init)), - (elementType = elementType(init)), + (Component = Component(init)), (workInProgress.flags |= 1), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 14: return ( - (elementType = workInProgress.type), - (init = resolveDefaultProps(elementType, workInProgress.pendingProps)), - (init = resolveDefaultProps(elementType.type, init)), + (Component = workInProgress.type), + (init = resolveDefaultProps(Component, workInProgress.pendingProps)), + (init = resolveDefaultProps(Component.type, init)), updateMemoComponent( current, workInProgress, - elementType, + Component, init, renderLanes ) @@ -5639,21 +5641,21 @@ function beginWork(current, workInProgress, renderLanes) { ); case 17: return ( - (elementType = workInProgress.type), + (Component = workInProgress.type), (init = workInProgress.pendingProps), (init = - workInProgress.elementType === elementType + workInProgress.elementType === Component ? init - : resolveDefaultProps(elementType, init)), + : resolveDefaultProps(Component, init)), resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), (workInProgress.tag = 1), prepareToReadContext(workInProgress, renderLanes), - constructClassInstance(workInProgress, elementType, init), - mountClassInstance(workInProgress, elementType, init, renderLanes), + constructClassInstance(workInProgress, Component, init), + mountClassInstance(workInProgress, Component, init, renderLanes), finishClassComponent( null, workInProgress, - elementType, + Component, !0, !1, renderLanes @@ -5663,9 +5665,9 @@ function beginWork(current, workInProgress, renderLanes) { return updateSuspenseListComponent(current, workInProgress, renderLanes); case 21: return ( - (elementType = workInProgress.pendingProps.children), + (Component = workInProgress.pendingProps.children), markRef(current, workInProgress), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 22: @@ -5675,7 +5677,7 @@ function beginWork(current, workInProgress, renderLanes) { case 24: return ( prepareToReadContext(workInProgress, renderLanes), - (elementType = readContext(CacheContext)), + (Component = readContext(CacheContext)), null === current ? ((init = peekCacheFromPool()), null === init && @@ -5685,10 +5687,7 @@ function beginWork(current, workInProgress, renderLanes) { nextProps.refCount++, null !== nextProps && (init.pooledCacheLanes |= renderLanes), (init = nextProps)), - (workInProgress.memoizedState = { - parent: elementType, - cache: init - }), + (workInProgress.memoizedState = { parent: Component, cache: init }), initializeUpdateQueue(workInProgress), pushProvider(workInProgress, CacheContext, init)) : (0 !== (current.lanes & renderLanes) && @@ -5697,17 +5696,17 @@ function beginWork(current, workInProgress, renderLanes) { suspendIfUpdateReadFromEntangledAsyncAction()), (init = current.memoizedState), (nextProps = workInProgress.memoizedState), - init.parent !== elementType - ? ((init = { parent: elementType, cache: elementType }), + init.parent !== Component + ? ((init = { parent: Component, cache: Component }), (workInProgress.memoizedState = init), 0 === workInProgress.lanes && (workInProgress.memoizedState = workInProgress.updateQueue.baseState = init), - pushProvider(workInProgress, CacheContext, elementType)) - : ((elementType = nextProps.cache), - pushProvider(workInProgress, CacheContext, elementType), - elementType !== init.cache && + pushProvider(workInProgress, CacheContext, Component)) + : ((Component = nextProps.cache), + pushProvider(workInProgress, CacheContext, Component), + Component !== init.cache && propagateContextChange( workInProgress, CacheContext, @@ -5726,22 +5725,22 @@ function beginWork(current, workInProgress, renderLanes) { return ( enableTransitionTracing ? (null === current && - ((elementType = enableTransitionTracing + ((Component = enableTransitionTracing ? transitionStack.current : null), - null !== elementType && - ((elementType = { + null !== Component && + ((Component = { tag: 1, - transitions: new Set(elementType), + transitions: new Set(Component), pendingBoundaries: null, name: workInProgress.pendingProps.name, aborts: null }), - (workInProgress.stateNode = elementType), + (workInProgress.stateNode = Component), (workInProgress.flags |= 2048))), - (elementType = workInProgress.stateNode), - null !== elementType && - pushMarkerInstance(workInProgress, elementType), + (Component = workInProgress.stateNode), + null !== Component && + pushMarkerInstance(workInProgress, Component), reconcileChildren( current, workInProgress, @@ -6263,6 +6262,7 @@ function bubbleProperties(completedWork) { function completeWork(current, workInProgress, renderLanes) { var newProps = workInProgress.pendingProps; switch (workInProgress.tag) { + case 2: case 16: case 15: case 0: @@ -9329,6 +9329,8 @@ function performUnitOfWork(unitOfWork) { function replaySuspendedUnitOfWork(unitOfWork) { var current = unitOfWork.alternate; switch (unitOfWork.tag) { + case 2: + unitOfWork.tag = 0; case 15: case 0: var Component = unitOfWork.type, @@ -9796,6 +9798,16 @@ function shouldConstruct(Component) { Component = Component.prototype; return !(!Component || !Component.isReactComponent); } +function resolveLazyComponentTag(Component) { + if ("function" === typeof Component) + return shouldConstruct(Component) ? 1 : 0; + if (void 0 !== Component && null !== Component) { + Component = Component.$$typeof; + if (Component === REACT_FORWARD_REF_TYPE) return 11; + if (Component === REACT_MEMO_TYPE) return 14; + } + return 2; +} function createWorkInProgress(current, pendingProps) { var workInProgress = current.alternate; null === workInProgress @@ -9873,7 +9885,7 @@ function createFiberFromTypeAndProps( mode, lanes ) { - var fiberTag = 0; + var fiberTag = 2; owner = type; if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); else if ("string" === typeof type) fiberTag = 5; @@ -10255,19 +10267,19 @@ var slice = Array.prototype.slice, }; return Text; })(React.Component), - devToolsConfig$jscomp$inline_1086 = { + devToolsConfig$jscomp$inline_1099 = { findFiberByHostInstance: function () { return null; }, bundleType: 0, - version: "19.0.0-www-modern-00b5a4bc", + version: "19.0.0-www-modern-ba56ad23", rendererPackageName: "react-art" }; -var internals$jscomp$inline_1288 = { - bundleType: devToolsConfig$jscomp$inline_1086.bundleType, - version: devToolsConfig$jscomp$inline_1086.version, - rendererPackageName: devToolsConfig$jscomp$inline_1086.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1086.rendererConfig, +var internals$jscomp$inline_1304 = { + bundleType: devToolsConfig$jscomp$inline_1099.bundleType, + version: devToolsConfig$jscomp$inline_1099.version, + rendererPackageName: devToolsConfig$jscomp$inline_1099.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1099.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10284,26 +10296,26 @@ var internals$jscomp$inline_1288 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1086.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1099.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-00b5a4bc" + reconcilerVersion: "19.0.0-www-modern-ba56ad23" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1289 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1305 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1289.isDisabled && - hook$jscomp$inline_1289.supportsFiber + !hook$jscomp$inline_1305.isDisabled && + hook$jscomp$inline_1305.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1289.inject( - internals$jscomp$inline_1288 + (rendererID = hook$jscomp$inline_1305.inject( + internals$jscomp$inline_1304 )), - (injectedHook = hook$jscomp$inline_1289); + (injectedHook = hook$jscomp$inline_1305); } catch (err) {} } var Path = Mode$1.Path; diff --git a/compiled/facebook-www/ReactDOM-dev.classic.js b/compiled/facebook-www/ReactDOM-dev.classic.js index 80f4286a1143b..c66924d339565 100644 --- a/compiled/facebook-www/ReactDOM-dev.classic.js +++ b/compiled/facebook-www/ReactDOM-dev.classic.js @@ -167,6 +167,8 @@ if (__DEV__) { var FunctionComponent = 0; var ClassComponent = 1; + var IndeterminateComponent = 2; // Before we know whether it is function or class + var HostRoot = 3; // Root of a host tree. Could be nested inside another node. var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. @@ -469,6 +471,7 @@ if (__DEV__) { case ClassComponent: case FunctionComponent: case IncompleteClassComponent: + case IndeterminateComponent: case MemoComponent: case SimpleMemoComponent: if (typeof type === "function") { @@ -3716,6 +3719,7 @@ if (__DEV__) { return describeBuiltInComponentFrame("SuspenseList"); case FunctionComponent: + case IndeterminateComponent: case SimpleMemoComponent: return describeFunctionComponentFrame(fiber.type); @@ -8189,6 +8193,7 @@ if (__DEV__) { return "SuspenseList"; case FunctionComponent: + case IndeterminateComponent: case SimpleMemoComponent: var fn = fiber.type; return fn.displayName || fn.name || null; @@ -18554,6 +18559,17 @@ if (__DEV__) { } } + function adoptClassInstance(workInProgress, instance) { + instance.updater = classComponentUpdater; + workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates + + set(instance, workInProgress); + + { + instance._reactInternalInstance = fakeInternalInstance; + } + } + function constructClassInstance(workInProgress, ctor, props) { var isLegacyContextConsumer = false; var unmaskedContext = emptyContextObject; @@ -18629,14 +18645,7 @@ if (__DEV__) { instance.state !== null && instance.state !== undefined ? instance.state : null); - instance.updater = classComponentUpdater; - workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates - - set(instance, workInProgress); - - { - instance._reactInternalInstance = fakeInternalInstance; - } + adoptClassInstance(workInProgress, instance); { if ( @@ -20183,6 +20192,7 @@ if (__DEV__) { ); var didReceiveUpdate = false; var didWarnAboutBadClass; + var didWarnAboutModulePatternComponent; var didWarnAboutContextTypeOnFunctionComponent; var didWarnAboutGetDerivedStateOnFunctionComponent; var didWarnAboutFunctionRefs; @@ -20193,6 +20203,7 @@ if (__DEV__) { { didWarnAboutBadClass = {}; + didWarnAboutModulePatternComponent = {}; didWarnAboutContextTypeOnFunctionComponent = {}; didWarnAboutGetDerivedStateOnFunctionComponent = {}; didWarnAboutFunctionRefs = {}; @@ -20917,39 +20928,6 @@ if (__DEV__) { nextProps, renderLanes ) { - { - if ( - Component.prototype && - typeof Component.prototype.render === "function" - ) { - var componentName = getComponentNameFromType(Component) || "Unknown"; - - if (!didWarnAboutBadClass[componentName]) { - error( - "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + - "This is likely to cause errors. Change %s to extend React.Component instead.", - componentName, - componentName - ); - - didWarnAboutBadClass[componentName] = true; - } - } - - if (workInProgress.mode & StrictLegacyMode) { - ReactStrictModeWarnings.recordLegacyContextWarning( - workInProgress, - null - ); - } - - if (current === null) { - // Some validations were previously done in mountIndeterminateComponent however and are now run - // in updateFuntionComponent but only on mount - validateFunctionComponentInDev(workInProgress, workInProgress.type); - } - } - var context; { @@ -21594,68 +21572,70 @@ if (__DEV__) { var Component = init(payload); // Store the unwrapped component in the type. workInProgress.type = Component; + var resolvedTag = (workInProgress.tag = + resolveLazyComponentTag(Component)); var resolvedProps = resolveDefaultProps(Component, props); + var child; - if (typeof Component === "function") { - if (isFunctionClassComponent(Component)) { - workInProgress.tag = ClassComponent; - + switch (resolvedTag) { + case FunctionComponent: { { + validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = - resolveClassForHotReloading(Component); + resolveFunctionForHotReloading(Component); } - return updateClassComponent( + child = updateFunctionComponent( null, workInProgress, Component, resolvedProps, renderLanes ); - } else { - workInProgress.tag = FunctionComponent; + return child; + } + case ClassComponent: { { - validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = - resolveFunctionForHotReloading(Component); + resolveClassForHotReloading(Component); } - return updateFunctionComponent( + child = updateClassComponent( null, workInProgress, Component, resolvedProps, renderLanes ); + return child; } - } else if (Component !== undefined && Component !== null) { - var $$typeof = Component.$$typeof; - - if ($$typeof === REACT_FORWARD_REF_TYPE) { - workInProgress.tag = ForwardRef; + case ForwardRef: { { workInProgress.type = Component = resolveForwardRefForHotReloading(Component); } - return updateForwardRef( + child = updateForwardRef( null, workInProgress, Component, resolvedProps, renderLanes ); - } else if ($$typeof === REACT_MEMO_TYPE) { - workInProgress.tag = MemoComponent; - return updateMemoComponent( + return child; + } + + case MemoComponent: { + child = updateMemoComponent( null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too renderLanes ); + return child; } } @@ -21717,6 +21697,125 @@ if (__DEV__) { ); } + function mountIndeterminateComponent( + _current, + workInProgress, + Component, + renderLanes + ) { + resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress); + var props = workInProgress.pendingProps; + var context; + + { + var unmaskedContext = getUnmaskedContext( + workInProgress, + Component, + false + ); + context = getMaskedContext(workInProgress, unmaskedContext); + } + + prepareToReadContext(workInProgress, renderLanes); + var value; + var hasId; + + if (enableSchedulingProfiler) { + markComponentRenderStarted(workInProgress); + } + + { + if ( + Component.prototype && + typeof Component.prototype.render === "function" + ) { + var componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutBadClass[componentName]) { + error( + "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + + "This is likely to cause errors. Change %s to extend React.Component instead.", + componentName, + componentName + ); + + didWarnAboutBadClass[componentName] = true; + } + } + + if (workInProgress.mode & StrictLegacyMode) { + ReactStrictModeWarnings.recordLegacyContextWarning( + workInProgress, + null + ); + } + + setIsRendering(true); + ReactCurrentOwner$2.current = workInProgress; + value = renderWithHooks( + null, + workInProgress, + Component, + props, + context, + renderLanes + ); + hasId = checkDidRenderIdHook(); + setIsRendering(false); + } + + if (enableSchedulingProfiler) { + markComponentRenderStopped(); + } // React DevTools reads this flag. + + workInProgress.flags |= PerformedWork; + + { + // Support for module components is deprecated and is removed behind a flag. + // Whether or not it would crash later, we want to show a good message in DEV first. + if ( + typeof value === "object" && + value !== null && + typeof value.render === "function" && + value.$$typeof === undefined + ) { + var _componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutModulePatternComponent[_componentName]) { + error( + "The <%s /> component appears to be a function component that returns a class instance. " + + "Change %s to a class that extends React.Component instead. " + + "If you can't use a class try assigning the prototype on the function as a workaround. " + + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + + "cannot be called with `new` by React.", + _componentName, + _componentName, + _componentName + ); + + didWarnAboutModulePatternComponent[_componentName] = true; + } + } + } + + { + // Proceed under the assumption that this is a function component + workInProgress.tag = FunctionComponent; + + if (getIsHydrating() && hasId) { + pushMaterializedTreeId(workInProgress); + } + + reconcileChildren(null, workInProgress, value, renderLanes); + + { + validateFunctionComponentInDev(workInProgress, Component); + } + + return workInProgress.child; + } + } + function validateFunctionComponentInDev(workInProgress, Component) { { if (Component) { @@ -21753,32 +21852,33 @@ if (__DEV__) { } if (Component.defaultProps !== undefined) { - var _componentName = getComponentNameFromType(Component) || "Unknown"; + var _componentName3 = + getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName]) { + if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName3]) { error( "%s: Support for defaultProps will be removed from function components " + "in a future major release. Use JavaScript default parameters instead.", - _componentName + _componentName3 ); - didWarnAboutDefaultPropsOnFunctionComponent[_componentName] = true; + didWarnAboutDefaultPropsOnFunctionComponent[_componentName3] = true; } } if (typeof Component.getDerivedStateFromProps === "function") { - var _componentName2 = + var _componentName4 = getComponentNameFromType(Component) || "Unknown"; if ( - !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] + !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] ) { error( "%s: Function components do not support getDerivedStateFromProps.", - _componentName2 + _componentName4 ); - didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = + didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] = true; } } @@ -21787,16 +21887,16 @@ if (__DEV__) { typeof Component.contextType === "object" && Component.contextType !== null ) { - var _componentName3 = + var _componentName5 = getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) { + if (!didWarnAboutContextTypeOnFunctionComponent[_componentName5]) { error( "%s: Function components do not support contextType.", - _componentName3 + _componentName5 ); - didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true; + didWarnAboutContextTypeOnFunctionComponent[_componentName5] = true; } } } @@ -23754,6 +23854,15 @@ if (__DEV__) { workInProgress.lanes = NoLanes; switch (workInProgress.tag) { + case IndeterminateComponent: { + return mountIndeterminateComponent( + current, + workInProgress, + workInProgress.type, + renderLanes + ); + } + case LazyComponent: { var elementType = workInProgress.elementType; return mountLazyComponent( @@ -25541,6 +25650,7 @@ if (__DEV__) { popTreeContext(workInProgress); switch (workInProgress.tag) { + case IndeterminateComponent: case LazyComponent: case SimpleMemoComponent: case FunctionComponent: @@ -33275,6 +33385,12 @@ if (__DEV__) { } switch (unitOfWork.tag) { + case IndeterminateComponent: { + // Because it suspended with `use`, we can assume it's a + // function component. + unitOfWork.tag = FunctionComponent; // Fallthrough to the next branch. + } + case SimpleMemoComponent: case FunctionComponent: { // Resolve `defaultProps`. This logic is copied from `beginWork`. @@ -34695,6 +34811,7 @@ if (__DEV__) { var tag = fiber.tag; if ( + tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && @@ -35493,8 +35610,22 @@ if (__DEV__) { type.defaultProps === undefined ); } - function isFunctionClassComponent(type) { - return shouldConstruct(type); + function resolveLazyComponentTag(Component) { + if (typeof Component === "function") { + return shouldConstruct(Component) ? ClassComponent : FunctionComponent; + } else if (Component !== undefined && Component !== null) { + var $$typeof = Component.$$typeof; + + if ($$typeof === REACT_FORWARD_REF_TYPE) { + return ForwardRef; + } + + if ($$typeof === REACT_MEMO_TYPE) { + return MemoComponent; + } + } + + return IndeterminateComponent; } // This is used to create an alternate fiber to do work on. function createWorkInProgress(current, pendingProps) { @@ -35579,6 +35710,7 @@ if (__DEV__) { workInProgress._debugNeedsRemount = current._debugNeedsRemount; switch (workInProgress.tag) { + case IndeterminateComponent: case FunctionComponent: case SimpleMemoComponent: workInProgress.type = resolveFunctionForHotReloading(current.type); @@ -35704,7 +35836,7 @@ if (__DEV__) { mode, lanes ) { - var fiberTag = FunctionComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. + var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. var resolvedType = type; @@ -36219,7 +36351,7 @@ if (__DEV__) { return root; } - var ReactVersion = "19.0.0-www-classic-8b22fef9"; + var ReactVersion = "19.0.0-www-classic-31c745b2"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOM-dev.modern.js b/compiled/facebook-www/ReactDOM-dev.modern.js index 3a722ecf4bf56..ddfa28fb1b785 100644 --- a/compiled/facebook-www/ReactDOM-dev.modern.js +++ b/compiled/facebook-www/ReactDOM-dev.modern.js @@ -2380,6 +2380,8 @@ if (__DEV__) { var FunctionComponent = 0; var ClassComponent = 1; + var IndeterminateComponent = 2; // Before we know whether it is function or class + var HostRoot = 3; // Root of a host tree. Could be nested inside another node. var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. @@ -3319,6 +3321,7 @@ if (__DEV__) { return describeBuiltInComponentFrame("SuspenseList"); case FunctionComponent: + case IndeterminateComponent: case SimpleMemoComponent: return describeFunctionComponentFrame(fiber.type); @@ -3597,6 +3600,7 @@ if (__DEV__) { case ClassComponent: case FunctionComponent: case IncompleteClassComponent: + case IndeterminateComponent: case MemoComponent: case SimpleMemoComponent: if (typeof type === "function") { @@ -8152,6 +8156,7 @@ if (__DEV__) { return "SuspenseList"; case FunctionComponent: + case IndeterminateComponent: case SimpleMemoComponent: var fn = fiber.type; return fn.displayName || fn.name || null; @@ -18509,6 +18514,17 @@ if (__DEV__) { } } + function adoptClassInstance(workInProgress, instance) { + instance.updater = classComponentUpdater; + workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates + + set(instance, workInProgress); + + { + instance._reactInternalInstance = fakeInternalInstance; + } + } + function constructClassInstance(workInProgress, ctor, props) { var context = emptyContextObject; var contextType = ctor.contextType; @@ -18574,14 +18590,7 @@ if (__DEV__) { instance.state !== null && instance.state !== undefined ? instance.state : null); - instance.updater = classComponentUpdater; - workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates - - set(instance, workInProgress); - - { - instance._reactInternalInstance = fakeInternalInstance; - } + adoptClassInstance(workInProgress, instance); { if ( @@ -20105,6 +20114,7 @@ if (__DEV__) { ); var didReceiveUpdate = false; var didWarnAboutBadClass; + var didWarnAboutModulePatternComponent; var didWarnAboutContextTypeOnFunctionComponent; var didWarnAboutGetDerivedStateOnFunctionComponent; var didWarnAboutFunctionRefs; @@ -20115,6 +20125,7 @@ if (__DEV__) { { didWarnAboutBadClass = {}; + didWarnAboutModulePatternComponent = {}; didWarnAboutContextTypeOnFunctionComponent = {}; didWarnAboutGetDerivedStateOnFunctionComponent = {}; didWarnAboutFunctionRefs = {}; @@ -20839,47 +20850,6 @@ if (__DEV__) { nextProps, renderLanes ) { - { - if ( - Component.prototype && - typeof Component.prototype.render === "function" - ) { - var componentName = getComponentNameFromType(Component) || "Unknown"; - - if (!didWarnAboutBadClass[componentName]) { - error( - "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + - "This is likely to cause errors. Change %s to extend React.Component instead.", - componentName, - componentName - ); - - didWarnAboutBadClass[componentName] = true; - } - } - - if (workInProgress.mode & StrictLegacyMode) { - ReactStrictModeWarnings.recordLegacyContextWarning( - workInProgress, - null - ); - } - - if (current === null) { - // Some validations were previously done in mountIndeterminateComponent however and are now run - // in updateFuntionComponent but only on mount - validateFunctionComponentInDev(workInProgress, workInProgress.type); - - if (Component.contextTypes) { - error( - "%s uses the legacy contextTypes API which was removed in React 19. " + - "Use React.createContext() with React.useContext() instead.", - getComponentNameFromType(Component) || "Unknown" - ); - } - } - } - var context; var nextChildren; @@ -21494,68 +21464,70 @@ if (__DEV__) { var Component = init(payload); // Store the unwrapped component in the type. workInProgress.type = Component; + var resolvedTag = (workInProgress.tag = + resolveLazyComponentTag(Component)); var resolvedProps = resolveDefaultProps(Component, props); + var child; - if (typeof Component === "function") { - if (isFunctionClassComponent(Component)) { - workInProgress.tag = ClassComponent; - + switch (resolvedTag) { + case FunctionComponent: { { + validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = - resolveClassForHotReloading(Component); + resolveFunctionForHotReloading(Component); } - return updateClassComponent( + child = updateFunctionComponent( null, workInProgress, Component, resolvedProps, renderLanes ); - } else { - workInProgress.tag = FunctionComponent; + return child; + } + case ClassComponent: { { - validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = - resolveFunctionForHotReloading(Component); + resolveClassForHotReloading(Component); } - return updateFunctionComponent( + child = updateClassComponent( null, workInProgress, Component, resolvedProps, renderLanes ); + return child; } - } else if (Component !== undefined && Component !== null) { - var $$typeof = Component.$$typeof; - - if ($$typeof === REACT_FORWARD_REF_TYPE) { - workInProgress.tag = ForwardRef; + case ForwardRef: { { workInProgress.type = Component = resolveForwardRefForHotReloading(Component); } - return updateForwardRef( + child = updateForwardRef( null, workInProgress, Component, resolvedProps, renderLanes ); - } else if ($$typeof === REACT_MEMO_TYPE) { - workInProgress.tag = MemoComponent; - return updateMemoComponent( + return child; + } + + case MemoComponent: { + child = updateMemoComponent( null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too renderLanes ); + return child; } } @@ -21616,6 +21588,126 @@ if (__DEV__) { ); } + function mountIndeterminateComponent( + _current, + workInProgress, + Component, + renderLanes + ) { + resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress); + var props = workInProgress.pendingProps; + var context; + + prepareToReadContext(workInProgress, renderLanes); + var value; + var hasId; + + if (enableSchedulingProfiler) { + markComponentRenderStarted(workInProgress); + } + + { + if ( + Component.prototype && + typeof Component.prototype.render === "function" + ) { + var componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutBadClass[componentName]) { + error( + "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + + "This is likely to cause errors. Change %s to extend React.Component instead.", + componentName, + componentName + ); + + didWarnAboutBadClass[componentName] = true; + } + } + + if (workInProgress.mode & StrictLegacyMode) { + ReactStrictModeWarnings.recordLegacyContextWarning( + workInProgress, + null + ); + } + + setIsRendering(true); + ReactCurrentOwner$2.current = workInProgress; + value = renderWithHooks( + null, + workInProgress, + Component, + props, + context, + renderLanes + ); + hasId = checkDidRenderIdHook(); + setIsRendering(false); + } + + if (enableSchedulingProfiler) { + markComponentRenderStopped(); + } // React DevTools reads this flag. + + workInProgress.flags |= PerformedWork; + + { + // Support for module components is deprecated and is removed behind a flag. + // Whether or not it would crash later, we want to show a good message in DEV first. + if ( + typeof value === "object" && + value !== null && + typeof value.render === "function" && + value.$$typeof === undefined + ) { + var _componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutModulePatternComponent[_componentName]) { + error( + "The <%s /> component appears to be a function component that returns a class instance. " + + "Change %s to a class that extends React.Component instead. " + + "If you can't use a class try assigning the prototype on the function as a workaround. " + + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + + "cannot be called with `new` by React.", + _componentName, + _componentName, + _componentName + ); + + didWarnAboutModulePatternComponent[_componentName] = true; + } + } + } + + { + // Proceed under the assumption that this is a function component + workInProgress.tag = FunctionComponent; + + { + if (Component.contextTypes) { + error( + "%s uses the legacy contextTypes API which was removed in React 19. " + + "Use React.createContext() with React.useContext() instead.", + getComponentNameFromType(Component) || "Unknown" + ); + } + } + + if (getIsHydrating() && hasId) { + pushMaterializedTreeId(workInProgress); + } + + reconcileChildren(null, workInProgress, value, renderLanes); + + { + validateFunctionComponentInDev(workInProgress, Component); + } + + return workInProgress.child; + } + } + function validateFunctionComponentInDev(workInProgress, Component) { { if (Component) { @@ -21652,32 +21744,33 @@ if (__DEV__) { } if (Component.defaultProps !== undefined) { - var _componentName = getComponentNameFromType(Component) || "Unknown"; + var _componentName3 = + getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName]) { + if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName3]) { error( "%s: Support for defaultProps will be removed from function components " + "in a future major release. Use JavaScript default parameters instead.", - _componentName + _componentName3 ); - didWarnAboutDefaultPropsOnFunctionComponent[_componentName] = true; + didWarnAboutDefaultPropsOnFunctionComponent[_componentName3] = true; } } if (typeof Component.getDerivedStateFromProps === "function") { - var _componentName2 = + var _componentName4 = getComponentNameFromType(Component) || "Unknown"; if ( - !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] + !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] ) { error( "%s: Function components do not support getDerivedStateFromProps.", - _componentName2 + _componentName4 ); - didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = + didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] = true; } } @@ -21686,16 +21779,16 @@ if (__DEV__) { typeof Component.contextType === "object" && Component.contextType !== null ) { - var _componentName3 = + var _componentName5 = getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) { + if (!didWarnAboutContextTypeOnFunctionComponent[_componentName5]) { error( "%s: Function components do not support contextType.", - _componentName3 + _componentName5 ); - didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true; + didWarnAboutContextTypeOnFunctionComponent[_componentName5] = true; } } } @@ -23647,6 +23740,15 @@ if (__DEV__) { workInProgress.lanes = NoLanes; switch (workInProgress.tag) { + case IndeterminateComponent: { + return mountIndeterminateComponent( + current, + workInProgress, + workInProgress.type, + renderLanes + ); + } + case LazyComponent: { var elementType = workInProgress.elementType; return mountLazyComponent( @@ -25434,6 +25536,7 @@ if (__DEV__) { popTreeContext(workInProgress); switch (workInProgress.tag) { + case IndeterminateComponent: case LazyComponent: case SimpleMemoComponent: case FunctionComponent: @@ -33139,6 +33242,12 @@ if (__DEV__) { } switch (unitOfWork.tag) { + case IndeterminateComponent: { + // Because it suspended with `use`, we can assume it's a + // function component. + unitOfWork.tag = FunctionComponent; // Fallthrough to the next branch. + } + case SimpleMemoComponent: case FunctionComponent: { // Resolve `defaultProps`. This logic is copied from `beginWork`. @@ -34550,6 +34659,7 @@ if (__DEV__) { var tag = fiber.tag; if ( + tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && @@ -35348,8 +35458,22 @@ if (__DEV__) { type.defaultProps === undefined ); } - function isFunctionClassComponent(type) { - return shouldConstruct(type); + function resolveLazyComponentTag(Component) { + if (typeof Component === "function") { + return shouldConstruct(Component) ? ClassComponent : FunctionComponent; + } else if (Component !== undefined && Component !== null) { + var $$typeof = Component.$$typeof; + + if ($$typeof === REACT_FORWARD_REF_TYPE) { + return ForwardRef; + } + + if ($$typeof === REACT_MEMO_TYPE) { + return MemoComponent; + } + } + + return IndeterminateComponent; } // This is used to create an alternate fiber to do work on. function createWorkInProgress(current, pendingProps) { @@ -35434,6 +35558,7 @@ if (__DEV__) { workInProgress._debugNeedsRemount = current._debugNeedsRemount; switch (workInProgress.tag) { + case IndeterminateComponent: case FunctionComponent: case SimpleMemoComponent: workInProgress.type = resolveFunctionForHotReloading(current.type); @@ -35559,7 +35684,7 @@ if (__DEV__) { mode, lanes ) { - var fiberTag = FunctionComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. + var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. var resolvedType = type; @@ -36074,7 +36199,7 @@ if (__DEV__) { return root; } - var ReactVersion = "19.0.0-www-modern-2963deed"; + var ReactVersion = "19.0.0-www-modern-c752b0b8"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOM-prod.classic.js b/compiled/facebook-www/ReactDOM-prod.classic.js index 6d6882a7999c4..a7f270b2dfca1 100644 --- a/compiled/facebook-www/ReactDOM-prod.classic.js +++ b/compiled/facebook-www/ReactDOM-prod.classic.js @@ -211,6 +211,7 @@ function getComponentNameFromFiber(fiber) { case 1: case 0: case 17: + case 2: case 14: case 15: if ("function" === typeof type) @@ -990,6 +991,7 @@ function describeFiber(fiber) { case 19: return describeBuiltInComponentFrame("SuspenseList"); case 0: + case 2: case 15: return (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; case 11: @@ -6623,91 +6625,110 @@ function beginWork(current, workInProgress, renderLanes) { pushTreeId(workInProgress, treeForkCount, workInProgress.index); workInProgress.lanes = 0; switch (workInProgress.tag) { + case 2: + var Component = workInProgress.type; + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + var context = getMaskedContext( + workInProgress, + contextStackCursor.current + ); + prepareToReadContext(workInProgress, renderLanes); + current = renderWithHooks( + null, + workInProgress, + Component, + current, + context, + renderLanes + ); + Component = checkDidRenderIdHook(); + workInProgress.flags |= 1; + workInProgress.tag = 0; + isHydrating && Component && pushMaterializedTreeId(workInProgress); + reconcileChildren(null, workInProgress, current, renderLanes); + workInProgress = workInProgress.child; + return workInProgress; case 16: - var elementType = workInProgress.elementType; + Component = workInProgress.elementType; a: { resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); current = workInProgress.pendingProps; - var init = elementType._init; - elementType = init(elementType._payload); - workInProgress.type = elementType; - current = resolveDefaultProps(elementType, current); - if ("function" === typeof elementType) - shouldConstruct(elementType) - ? ((workInProgress.tag = 1), - (workInProgress = updateClassComponent( - null, - workInProgress, - elementType, - current, - renderLanes - ))) - : ((workInProgress.tag = 0), - (workInProgress = updateFunctionComponent( - null, - workInProgress, - elementType, - current, - renderLanes - ))); - else { - if (void 0 !== elementType && null !== elementType) - if ( - ((init = elementType.$$typeof), init === REACT_FORWARD_REF_TYPE) - ) { - workInProgress.tag = 11; - workInProgress = updateForwardRef( - null, - workInProgress, - elementType, - current, - renderLanes - ); - break a; - } else if (init === REACT_MEMO_TYPE) { - workInProgress.tag = 14; - workInProgress = updateMemoComponent( - null, - workInProgress, - elementType, - resolveDefaultProps(elementType.type, current), - renderLanes - ); - break a; - } - throw Error(formatProdErrorMessage(306, elementType, "")); + context = Component._init; + Component = context(Component._payload); + workInProgress.type = Component; + context = workInProgress.tag = resolveLazyComponentTag(Component); + current = resolveDefaultProps(Component, current); + switch (context) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + Component, + resolveDefaultProps(Component.type, current), + renderLanes + ); + break a; } + throw Error(formatProdErrorMessage(306, Component, "")); } return workInProgress; case 0: return ( - (elementType = workInProgress.type), - (init = workInProgress.pendingProps), - (init = - workInProgress.elementType === elementType - ? init - : resolveDefaultProps(elementType, init)), + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), updateFunctionComponent( current, workInProgress, - elementType, - init, + Component, + context, renderLanes ) ); case 1: return ( - (elementType = workInProgress.type), - (init = workInProgress.pendingProps), - (init = - workInProgress.elementType === elementType - ? init - : resolveDefaultProps(elementType, init)), + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), updateClassComponent( current, workInProgress, - elementType, - init, + Component, + context, renderLanes ) ); @@ -6715,25 +6736,25 @@ function beginWork(current, workInProgress, renderLanes) { a: { pushHostRootContext(workInProgress); if (null === current) throw Error(formatProdErrorMessage(387)); - init = workInProgress.pendingProps; + context = workInProgress.pendingProps; var prevState = workInProgress.memoizedState; - elementType = prevState.element; + Component = prevState.element; cloneUpdateQueue(current, workInProgress); - processUpdateQueue(workInProgress, init, null, renderLanes); + processUpdateQueue(workInProgress, context, null, renderLanes); var nextState = workInProgress.memoizedState; enableTransitionTracing && push(transitionStack, workInProgressTransitions); enableTransitionTracing && pushRootMarkerInstance(workInProgress); - init = nextState.cache; - pushProvider(workInProgress, CacheContext, init); - init !== prevState.cache && + context = nextState.cache; + pushProvider(workInProgress, CacheContext, context); + context !== prevState.cache && propagateContextChange(workInProgress, CacheContext, renderLanes); suspendIfUpdateReadFromEntangledAsyncAction(); - init = nextState.element; + context = nextState.element; if (prevState.isDehydrated) if ( ((prevState = { - element: init, + element: context, isDehydrated: !1, cache: nextState.cache }), @@ -6741,29 +6762,29 @@ function beginWork(current, workInProgress, renderLanes) { (workInProgress.memoizedState = prevState), workInProgress.flags & 256) ) { - elementType = createCapturedValueAtFiber( + Component = createCapturedValueAtFiber( Error(formatProdErrorMessage(423)), workInProgress ); workInProgress = mountHostRootWithoutHydrating( current, workInProgress, - init, + context, renderLanes, - elementType + Component ); break a; - } else if (init !== elementType) { - elementType = createCapturedValueAtFiber( + } else if (context !== Component) { + Component = createCapturedValueAtFiber( Error(formatProdErrorMessage(424)), workInProgress ); workInProgress = mountHostRootWithoutHydrating( current, workInProgress, - init, + context, renderLanes, - elementType + Component ); break a; } else @@ -6778,7 +6799,7 @@ function beginWork(current, workInProgress, renderLanes) { renderLanes = mountChildFibers( workInProgress, null, - init, + context, renderLanes ), workInProgress.child = renderLanes; @@ -6789,7 +6810,7 @@ function beginWork(current, workInProgress, renderLanes) { (renderLanes = renderLanes.sibling); else { resetHydrationState(); - if (init === elementType) { + if (context === Component) { workInProgress = bailoutOnAlreadyFinishedWork( current, workInProgress, @@ -6797,7 +6818,7 @@ function beginWork(current, workInProgress, renderLanes) { ); break a; } - reconcileChildren(current, workInProgress, init, renderLanes); + reconcileChildren(current, workInProgress, context, renderLanes); } workInProgress = workInProgress.child; } @@ -6816,14 +6837,14 @@ function beginWork(current, workInProgress, renderLanes) { null !== renderLanes || ((renderLanes = workInProgress.type), (current = workInProgress.pendingProps), - (elementType = getOwnerDocumentFromRootContainer( + (Component = getOwnerDocumentFromRootContainer( rootInstanceStackCursor.current ).createElement(renderLanes)), - (elementType[internalInstanceKey] = workInProgress), - (elementType[internalPropsKey] = current), - setInitialProperties(elementType, renderLanes, current), - markNodeAsHoistable(elementType), - (workInProgress.stateNode = elementType)), + (Component[internalInstanceKey] = workInProgress), + (Component[internalPropsKey] = current), + setInitialProperties(Component, renderLanes, current), + markNodeAsHoistable(Component), + (workInProgress.stateNode = Component)), null ); case 27: @@ -6831,7 +6852,7 @@ function beginWork(current, workInProgress, renderLanes) { pushHostContext(workInProgress), null === current && isHydrating && - ((elementType = workInProgress.stateNode = + ((Component = workInProgress.stateNode = resolveSingletonInstance( workInProgress.type, workInProgress.pendingProps, @@ -6839,14 +6860,14 @@ function beginWork(current, workInProgress, renderLanes) { )), (hydrationParentFiber = workInProgress), (rootOrSingletonContext = !0), - (nextHydratableInstance = getNextHydratable(elementType.firstChild))), - (elementType = workInProgress.pendingProps.children), + (nextHydratableInstance = getNextHydratable(Component.firstChild))), + (Component = workInProgress.pendingProps.children), null !== current || isHydrating - ? reconcileChildren(current, workInProgress, elementType, renderLanes) + ? reconcileChildren(current, workInProgress, Component, renderLanes) : (workInProgress.child = reconcileChildFibers( workInProgress, null, - elementType, + Component, renderLanes )), markRef(current, workInProgress), @@ -6854,36 +6875,36 @@ function beginWork(current, workInProgress, renderLanes) { ); case 5: if (null === current && isHydrating) { - if ((init = elementType = nextHydratableInstance)) - (elementType = canHydrateInstance( - elementType, + if ((context = Component = nextHydratableInstance)) + (Component = canHydrateInstance( + Component, workInProgress.type, workInProgress.pendingProps, rootOrSingletonContext )), - null !== elementType - ? ((workInProgress.stateNode = elementType), + null !== Component + ? ((workInProgress.stateNode = Component), (hydrationParentFiber = workInProgress), (nextHydratableInstance = getNextHydratable( - elementType.firstChild + Component.firstChild )), (rootOrSingletonContext = !1), - (init = !0)) - : (init = !1); - init || throwOnHydrationMismatch(); + (context = !0)) + : (context = !1); + context || throwOnHydrationMismatch(); } pushHostContext(workInProgress); - init = workInProgress.type; + context = workInProgress.type; prevState = workInProgress.pendingProps; nextState = null !== current ? current.memoizedProps : null; - elementType = prevState.children; - shouldSetTextContent(init, prevState) - ? (elementType = null) + Component = prevState.children; + shouldSetTextContent(context, prevState) + ? (Component = null) : null !== nextState && - shouldSetTextContent(init, nextState) && + shouldSetTextContent(context, nextState) && (workInProgress.flags |= 32); null !== workInProgress.memoizedState && - ((init = renderWithHooks( + ((context = renderWithHooks( current, workInProgress, TransitionAwareHostComponent, @@ -6891,18 +6912,18 @@ function beginWork(current, workInProgress, renderLanes) { null, renderLanes )), - (HostTransitionContext._currentValue = init), + (HostTransitionContext._currentValue = context), enableLazyContextPropagation || (didReceiveUpdate && null !== current && - current.memoizedState.memoizedState !== init && + current.memoizedState.memoizedState !== context && propagateContextChange( workInProgress, HostTransitionContext, renderLanes ))); markRef(current, workInProgress); - reconcileChildren(current, workInProgress, elementType, renderLanes); + reconcileChildren(current, workInProgress, Component, renderLanes); return workInProgress.child; case 6: if (null === current && isHydrating) { @@ -6929,35 +6950,30 @@ function beginWork(current, workInProgress, renderLanes) { workInProgress, workInProgress.stateNode.containerInfo ), - (elementType = workInProgress.pendingProps), + (Component = workInProgress.pendingProps), null === current ? (workInProgress.child = reconcileChildFibers( workInProgress, null, - elementType, + Component, renderLanes )) - : reconcileChildren( - current, - workInProgress, - elementType, - renderLanes - ), + : reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 11: return ( - (elementType = workInProgress.type), - (init = workInProgress.pendingProps), - (init = - workInProgress.elementType === elementType - ? init - : resolveDefaultProps(elementType, init)), + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), updateForwardRef( current, workInProgress, - elementType, - init, + Component, + context, renderLanes ) ); @@ -6993,17 +7009,17 @@ function beginWork(current, workInProgress, renderLanes) { ); case 10: a: { - elementType = enableRenderableContext + Component = enableRenderableContext ? workInProgress.type : workInProgress.type._context; - init = workInProgress.pendingProps; + context = workInProgress.pendingProps; prevState = workInProgress.memoizedProps; - nextState = init.value; - pushProvider(workInProgress, elementType, nextState); + nextState = context.value; + pushProvider(workInProgress, Component, nextState); if (!enableLazyContextPropagation && null !== prevState) if (objectIs(prevState.value, nextState)) { if ( - prevState.children === init.children && + prevState.children === context.children && !didPerformWorkStackCursor.current ) { workInProgress = bailoutOnAlreadyFinishedWork( @@ -7013,35 +7029,39 @@ function beginWork(current, workInProgress, renderLanes) { ); break a; } - } else - propagateContextChange(workInProgress, elementType, renderLanes); - reconcileChildren(current, workInProgress, init.children, renderLanes); + } else propagateContextChange(workInProgress, Component, renderLanes); + reconcileChildren( + current, + workInProgress, + context.children, + renderLanes + ); workInProgress = workInProgress.child; } return workInProgress; case 9: return ( - (init = enableRenderableContext + (context = enableRenderableContext ? workInProgress.type._context : workInProgress.type), - (elementType = workInProgress.pendingProps.children), + (Component = workInProgress.pendingProps.children), prepareToReadContext(workInProgress, renderLanes), - (init = readContext(init)), - (elementType = elementType(init)), + (context = readContext(context)), + (Component = Component(context)), (workInProgress.flags |= 1), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 14: return ( - (elementType = workInProgress.type), - (init = resolveDefaultProps(elementType, workInProgress.pendingProps)), - (init = resolveDefaultProps(elementType.type, init)), + (Component = workInProgress.type), + (context = resolveDefaultProps(Component, workInProgress.pendingProps)), + (context = resolveDefaultProps(Component.type, context)), updateMemoComponent( current, workInProgress, - elementType, - init, + Component, + context, renderLanes ) ); @@ -7055,24 +7075,24 @@ function beginWork(current, workInProgress, renderLanes) { ); case 17: return ( - (elementType = workInProgress.type), - (init = workInProgress.pendingProps), - (init = - workInProgress.elementType === elementType - ? init - : resolveDefaultProps(elementType, init)), + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), (workInProgress.tag = 1), - isContextProvider(elementType) + isContextProvider(Component) ? ((current = !0), pushContextProvider(workInProgress)) : (current = !1), prepareToReadContext(workInProgress, renderLanes), - constructClassInstance(workInProgress, elementType, init), - mountClassInstance(workInProgress, elementType, init, renderLanes), + constructClassInstance(workInProgress, Component, context), + mountClassInstance(workInProgress, Component, context, renderLanes), finishClassComponent( null, workInProgress, - elementType, + Component, !0, current, renderLanes @@ -7082,9 +7102,9 @@ function beginWork(current, workInProgress, renderLanes) { return updateSuspenseListComponent(current, workInProgress, renderLanes); case 21: return ( - (elementType = workInProgress.pendingProps.children), + (Component = workInProgress.pendingProps.children), markRef(current, workInProgress), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 22: @@ -7094,39 +7114,39 @@ function beginWork(current, workInProgress, renderLanes) { case 24: return ( prepareToReadContext(workInProgress, renderLanes), - (elementType = readContext(CacheContext)), + (Component = readContext(CacheContext)), null === current - ? ((init = peekCacheFromPool()), - null === init && - ((init = workInProgressRoot), + ? ((context = peekCacheFromPool()), + null === context && + ((context = workInProgressRoot), (prevState = createCache()), - (init.pooledCache = prevState), + (context.pooledCache = prevState), prevState.refCount++, - null !== prevState && (init.pooledCacheLanes |= renderLanes), - (init = prevState)), + null !== prevState && (context.pooledCacheLanes |= renderLanes), + (context = prevState)), (workInProgress.memoizedState = { - parent: elementType, - cache: init + parent: Component, + cache: context }), initializeUpdateQueue(workInProgress), - pushProvider(workInProgress, CacheContext, init)) + pushProvider(workInProgress, CacheContext, context)) : (0 !== (current.lanes & renderLanes) && (cloneUpdateQueue(current, workInProgress), processUpdateQueue(workInProgress, null, null, renderLanes), suspendIfUpdateReadFromEntangledAsyncAction()), - (init = current.memoizedState), + (context = current.memoizedState), (prevState = workInProgress.memoizedState), - init.parent !== elementType - ? ((init = { parent: elementType, cache: elementType }), - (workInProgress.memoizedState = init), + context.parent !== Component + ? ((context = { parent: Component, cache: Component }), + (workInProgress.memoizedState = context), 0 === workInProgress.lanes && (workInProgress.memoizedState = workInProgress.updateQueue.baseState = - init), - pushProvider(workInProgress, CacheContext, elementType)) - : ((elementType = prevState.cache), - pushProvider(workInProgress, CacheContext, elementType), - elementType !== init.cache && + context), + pushProvider(workInProgress, CacheContext, Component)) + : ((Component = prevState.cache), + pushProvider(workInProgress, CacheContext, Component), + Component !== context.cache && propagateContextChange( workInProgress, CacheContext, @@ -7145,22 +7165,22 @@ function beginWork(current, workInProgress, renderLanes) { return ( enableTransitionTracing ? (null === current && - ((elementType = enableTransitionTracing + ((Component = enableTransitionTracing ? transitionStack.current : null), - null !== elementType && - ((elementType = { + null !== Component && + ((Component = { tag: 1, - transitions: new Set(elementType), + transitions: new Set(Component), pendingBoundaries: null, name: workInProgress.pendingProps.name, aborts: null }), - (workInProgress.stateNode = elementType), + (workInProgress.stateNode = Component), (workInProgress.flags |= 2048))), - (elementType = workInProgress.stateNode), - null !== elementType && - pushMarkerInstance(workInProgress, elementType), + (Component = workInProgress.stateNode), + null !== Component && + pushMarkerInstance(workInProgress, Component), reconcileChildren( current, workInProgress, @@ -7710,6 +7730,7 @@ function completeWork(current, workInProgress, renderLanes) { var newProps = workInProgress.pendingProps; popTreeContext(workInProgress); switch (workInProgress.tag) { + case 2: case 16: case 15: case 0: @@ -11465,6 +11486,8 @@ function performUnitOfWork(unitOfWork) { function replaySuspendedUnitOfWork(unitOfWork) { var current = unitOfWork.alternate; switch (unitOfWork.tag) { + case 2: + unitOfWork.tag = 0; case 15: case 0: var Component = unitOfWork.type, @@ -11963,6 +11986,16 @@ function shouldConstruct(Component) { Component = Component.prototype; return !(!Component || !Component.isReactComponent); } +function resolveLazyComponentTag(Component) { + if ("function" === typeof Component) + return shouldConstruct(Component) ? 1 : 0; + if (void 0 !== Component && null !== Component) { + Component = Component.$$typeof; + if (Component === REACT_FORWARD_REF_TYPE) return 11; + if (Component === REACT_MEMO_TYPE) return 14; + } + return 2; +} function createWorkInProgress(current, pendingProps) { var workInProgress = current.alternate; null === workInProgress @@ -12040,7 +12073,7 @@ function createFiberFromTypeAndProps( mode, lanes ) { - var fiberTag = 0; + var fiberTag = 2; owner = type; if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); else if ("string" === typeof type) @@ -13028,19 +13061,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$346; + var JSCompiler_inline_result$jscomp$347; if (canUseDOM) { - var isSupported$jscomp$inline_1482 = "oninput" in document; - if (!isSupported$jscomp$inline_1482) { - var element$jscomp$inline_1483 = document.createElement("div"); - element$jscomp$inline_1483.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1482 = - "function" === typeof element$jscomp$inline_1483.oninput; + var isSupported$jscomp$inline_1497 = "oninput" in document; + if (!isSupported$jscomp$inline_1497) { + var element$jscomp$inline_1498 = document.createElement("div"); + element$jscomp$inline_1498.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1497 = + "function" === typeof element$jscomp$inline_1498.oninput; } - JSCompiler_inline_result$jscomp$346 = isSupported$jscomp$inline_1482; - } else JSCompiler_inline_result$jscomp$346 = !1; + JSCompiler_inline_result$jscomp$347 = isSupported$jscomp$inline_1497; + } else JSCompiler_inline_result$jscomp$347 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$346 && + JSCompiler_inline_result$jscomp$347 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -13412,20 +13445,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1523 = 0; - i$jscomp$inline_1523 < simpleEventPluginEvents.length; - i$jscomp$inline_1523++ + var i$jscomp$inline_1538 = 0; + i$jscomp$inline_1538 < simpleEventPluginEvents.length; + i$jscomp$inline_1538++ ) { - var eventName$jscomp$inline_1524 = - simpleEventPluginEvents[i$jscomp$inline_1523], - domEventName$jscomp$inline_1525 = - eventName$jscomp$inline_1524.toLowerCase(), - capitalizedEvent$jscomp$inline_1526 = - eventName$jscomp$inline_1524[0].toUpperCase() + - eventName$jscomp$inline_1524.slice(1); + var eventName$jscomp$inline_1539 = + simpleEventPluginEvents[i$jscomp$inline_1538], + domEventName$jscomp$inline_1540 = + eventName$jscomp$inline_1539.toLowerCase(), + capitalizedEvent$jscomp$inline_1541 = + eventName$jscomp$inline_1539[0].toUpperCase() + + eventName$jscomp$inline_1539.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1525, - "on" + capitalizedEvent$jscomp$inline_1526 + domEventName$jscomp$inline_1540, + "on" + capitalizedEvent$jscomp$inline_1541 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -17075,17 +17108,17 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1717 = { +var devToolsConfig$jscomp$inline_1732 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-classic-6bfbbc21", + version: "19.0.0-www-classic-9df81848", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2142 = { - bundleType: devToolsConfig$jscomp$inline_1717.bundleType, - version: devToolsConfig$jscomp$inline_1717.version, - rendererPackageName: devToolsConfig$jscomp$inline_1717.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1717.rendererConfig, +var internals$jscomp$inline_2160 = { + bundleType: devToolsConfig$jscomp$inline_1732.bundleType, + version: devToolsConfig$jscomp$inline_1732.version, + rendererPackageName: devToolsConfig$jscomp$inline_1732.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1732.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17101,26 +17134,26 @@ var internals$jscomp$inline_2142 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1717.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1732.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-6bfbbc21" + reconcilerVersion: "19.0.0-www-classic-9df81848" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2143 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2161 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2143.isDisabled && - hook$jscomp$inline_2143.supportsFiber + !hook$jscomp$inline_2161.isDisabled && + hook$jscomp$inline_2161.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2143.inject( - internals$jscomp$inline_2142 + (rendererID = hook$jscomp$inline_2161.inject( + internals$jscomp$inline_2160 )), - (injectedHook = hook$jscomp$inline_2143); + (injectedHook = hook$jscomp$inline_2161); } catch (err) {} } var ReactFiberErrorDialogWWW = require("ReactFiberErrorDialog"); @@ -17558,4 +17591,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactCurrentDispatcher$2.current.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-classic-6bfbbc21"; +exports.version = "19.0.0-www-classic-9df81848"; diff --git a/compiled/facebook-www/ReactDOM-prod.modern.js b/compiled/facebook-www/ReactDOM-prod.modern.js index 3580759a6bf86..1d237f8fb93ed 100644 --- a/compiled/facebook-www/ReactDOM-prod.modern.js +++ b/compiled/facebook-www/ReactDOM-prod.modern.js @@ -846,6 +846,7 @@ function describeFiber(fiber) { case 19: return describeBuiltInComponentFrame("SuspenseList"); case 0: + case 2: case 15: return (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; case 11: @@ -6469,90 +6470,105 @@ function beginWork(current, workInProgress, renderLanes) { pushTreeId(workInProgress, treeForkCount, workInProgress.index); workInProgress.lanes = 0; switch (workInProgress.tag) { + case 2: + var Component = workInProgress.type; + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + prepareToReadContext(workInProgress, renderLanes); + current = renderWithHooks( + null, + workInProgress, + Component, + current, + void 0, + renderLanes + ); + Component = checkDidRenderIdHook(); + workInProgress.flags |= 1; + workInProgress.tag = 0; + isHydrating && Component && pushMaterializedTreeId(workInProgress); + reconcileChildren(null, workInProgress, current, renderLanes); + workInProgress = workInProgress.child; + return workInProgress; case 16: - var elementType = workInProgress.elementType; + Component = workInProgress.elementType; a: { resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); current = workInProgress.pendingProps; - var init = elementType._init; - elementType = init(elementType._payload); - workInProgress.type = elementType; - current = resolveDefaultProps(elementType, current); - if ("function" === typeof elementType) - shouldConstruct(elementType) - ? ((workInProgress.tag = 1), - (workInProgress = updateClassComponent( - null, - workInProgress, - elementType, - current, - renderLanes - ))) - : ((workInProgress.tag = 0), - (workInProgress = updateFunctionComponent( - null, - workInProgress, - elementType, - current, - renderLanes - ))); - else { - if (void 0 !== elementType && null !== elementType) - if ( - ((init = elementType.$$typeof), init === REACT_FORWARD_REF_TYPE) - ) { - workInProgress.tag = 11; - workInProgress = updateForwardRef( - null, - workInProgress, - elementType, - current, - renderLanes - ); - break a; - } else if (init === REACT_MEMO_TYPE) { - workInProgress.tag = 14; - workInProgress = updateMemoComponent( - null, - workInProgress, - elementType, - resolveDefaultProps(elementType.type, current), - renderLanes - ); - break a; - } - throw Error(formatProdErrorMessage(306, elementType, "")); + var init = Component._init; + Component = init(Component._payload); + workInProgress.type = Component; + init = workInProgress.tag = resolveLazyComponentTag(Component); + current = resolveDefaultProps(Component, current); + switch (init) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + Component, + resolveDefaultProps(Component.type, current), + renderLanes + ); + break a; } + throw Error(formatProdErrorMessage(306, Component, "")); } return workInProgress; case 0: return ( - (elementType = workInProgress.type), + (Component = workInProgress.type), (init = workInProgress.pendingProps), (init = - workInProgress.elementType === elementType + workInProgress.elementType === Component ? init - : resolveDefaultProps(elementType, init)), + : resolveDefaultProps(Component, init)), updateFunctionComponent( current, workInProgress, - elementType, + Component, init, renderLanes ) ); case 1: return ( - (elementType = workInProgress.type), + (Component = workInProgress.type), (init = workInProgress.pendingProps), (init = - workInProgress.elementType === elementType + workInProgress.elementType === Component ? init - : resolveDefaultProps(elementType, init)), + : resolveDefaultProps(Component, init)), updateClassComponent( current, workInProgress, - elementType, + Component, init, renderLanes ) @@ -6566,7 +6582,7 @@ function beginWork(current, workInProgress, renderLanes) { if (null === current) throw Error(formatProdErrorMessage(387)); init = workInProgress.pendingProps; var prevState = workInProgress.memoizedState; - elementType = prevState.element; + Component = prevState.element; cloneUpdateQueue(current, workInProgress); processUpdateQueue(workInProgress, init, null, renderLanes); var nextState = workInProgress.memoizedState; @@ -6590,7 +6606,7 @@ function beginWork(current, workInProgress, renderLanes) { (workInProgress.memoizedState = prevState), workInProgress.flags & 256) ) { - elementType = createCapturedValueAtFiber( + Component = createCapturedValueAtFiber( Error(formatProdErrorMessage(423)), workInProgress ); @@ -6599,11 +6615,11 @@ function beginWork(current, workInProgress, renderLanes) { workInProgress, init, renderLanes, - elementType + Component ); break a; - } else if (init !== elementType) { - elementType = createCapturedValueAtFiber( + } else if (init !== Component) { + Component = createCapturedValueAtFiber( Error(formatProdErrorMessage(424)), workInProgress ); @@ -6612,7 +6628,7 @@ function beginWork(current, workInProgress, renderLanes) { workInProgress, init, renderLanes, - elementType + Component ); break a; } else @@ -6638,7 +6654,7 @@ function beginWork(current, workInProgress, renderLanes) { (renderLanes = renderLanes.sibling); else { resetHydrationState(); - if (init === elementType) { + if (init === Component) { workInProgress = bailoutOnAlreadyFinishedWork( current, workInProgress, @@ -6665,14 +6681,14 @@ function beginWork(current, workInProgress, renderLanes) { null !== renderLanes || ((renderLanes = workInProgress.type), (current = workInProgress.pendingProps), - (elementType = getOwnerDocumentFromRootContainer( + (Component = getOwnerDocumentFromRootContainer( rootInstanceStackCursor.current ).createElement(renderLanes)), - (elementType[internalInstanceKey] = workInProgress), - (elementType[internalPropsKey] = current), - setInitialProperties(elementType, renderLanes, current), - markNodeAsHoistable(elementType), - (workInProgress.stateNode = elementType)), + (Component[internalInstanceKey] = workInProgress), + (Component[internalPropsKey] = current), + setInitialProperties(Component, renderLanes, current), + markNodeAsHoistable(Component), + (workInProgress.stateNode = Component)), null ); case 27: @@ -6680,7 +6696,7 @@ function beginWork(current, workInProgress, renderLanes) { pushHostContext(workInProgress), null === current && isHydrating && - ((elementType = workInProgress.stateNode = + ((Component = workInProgress.stateNode = resolveSingletonInstance( workInProgress.type, workInProgress.pendingProps, @@ -6688,14 +6704,14 @@ function beginWork(current, workInProgress, renderLanes) { )), (hydrationParentFiber = workInProgress), (rootOrSingletonContext = !0), - (nextHydratableInstance = getNextHydratable(elementType.firstChild))), - (elementType = workInProgress.pendingProps.children), + (nextHydratableInstance = getNextHydratable(Component.firstChild))), + (Component = workInProgress.pendingProps.children), null !== current || isHydrating - ? reconcileChildren(current, workInProgress, elementType, renderLanes) + ? reconcileChildren(current, workInProgress, Component, renderLanes) : (workInProgress.child = reconcileChildFibers( workInProgress, null, - elementType, + Component, renderLanes )), markRef(current, workInProgress), @@ -6703,18 +6719,18 @@ function beginWork(current, workInProgress, renderLanes) { ); case 5: if (null === current && isHydrating) { - if ((init = elementType = nextHydratableInstance)) - (elementType = canHydrateInstance( - elementType, + if ((init = Component = nextHydratableInstance)) + (Component = canHydrateInstance( + Component, workInProgress.type, workInProgress.pendingProps, rootOrSingletonContext )), - null !== elementType - ? ((workInProgress.stateNode = elementType), + null !== Component + ? ((workInProgress.stateNode = Component), (hydrationParentFiber = workInProgress), (nextHydratableInstance = getNextHydratable( - elementType.firstChild + Component.firstChild )), (rootOrSingletonContext = !1), (init = !0)) @@ -6725,9 +6741,9 @@ function beginWork(current, workInProgress, renderLanes) { init = workInProgress.type; prevState = workInProgress.pendingProps; nextState = null !== current ? current.memoizedProps : null; - elementType = prevState.children; + Component = prevState.children; shouldSetTextContent(init, prevState) - ? (elementType = null) + ? (Component = null) : null !== nextState && shouldSetTextContent(init, nextState) && (workInProgress.flags |= 32); @@ -6751,7 +6767,7 @@ function beginWork(current, workInProgress, renderLanes) { renderLanes ))); markRef(current, workInProgress); - reconcileChildren(current, workInProgress, elementType, renderLanes); + reconcileChildren(current, workInProgress, Component, renderLanes); return workInProgress.child; case 6: if (null === current && isHydrating) { @@ -6778,37 +6794,26 @@ function beginWork(current, workInProgress, renderLanes) { workInProgress, workInProgress.stateNode.containerInfo ), - (elementType = workInProgress.pendingProps), + (Component = workInProgress.pendingProps), null === current ? (workInProgress.child = reconcileChildFibers( workInProgress, null, - elementType, + Component, renderLanes )) - : reconcileChildren( - current, - workInProgress, - elementType, - renderLanes - ), + : reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 11: return ( - (elementType = workInProgress.type), + (Component = workInProgress.type), (init = workInProgress.pendingProps), (init = - workInProgress.elementType === elementType + workInProgress.elementType === Component ? init - : resolveDefaultProps(elementType, init)), - updateForwardRef( - current, - workInProgress, - elementType, - init, - renderLanes - ) + : resolveDefaultProps(Component, init)), + updateForwardRef(current, workInProgress, Component, init, renderLanes) ); case 7: return ( @@ -6842,13 +6847,13 @@ function beginWork(current, workInProgress, renderLanes) { ); case 10: a: { - elementType = enableRenderableContext + Component = enableRenderableContext ? workInProgress.type : workInProgress.type._context; init = workInProgress.pendingProps; prevState = workInProgress.memoizedProps; nextState = init.value; - pushProvider(workInProgress, elementType, nextState); + pushProvider(workInProgress, Component, nextState); if (!enableLazyContextPropagation && null !== prevState) if (objectIs(prevState.value, nextState)) { if (prevState.children === init.children) { @@ -6859,8 +6864,7 @@ function beginWork(current, workInProgress, renderLanes) { ); break a; } - } else - propagateContextChange(workInProgress, elementType, renderLanes); + } else propagateContextChange(workInProgress, Component, renderLanes); reconcileChildren(current, workInProgress, init.children, renderLanes); workInProgress = workInProgress.child; } @@ -6870,23 +6874,23 @@ function beginWork(current, workInProgress, renderLanes) { (init = enableRenderableContext ? workInProgress.type._context : workInProgress.type), - (elementType = workInProgress.pendingProps.children), + (Component = workInProgress.pendingProps.children), prepareToReadContext(workInProgress, renderLanes), (init = readContext(init)), - (elementType = elementType(init)), + (Component = Component(init)), (workInProgress.flags |= 1), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 14: return ( - (elementType = workInProgress.type), - (init = resolveDefaultProps(elementType, workInProgress.pendingProps)), - (init = resolveDefaultProps(elementType.type, init)), + (Component = workInProgress.type), + (init = resolveDefaultProps(Component, workInProgress.pendingProps)), + (init = resolveDefaultProps(Component.type, init)), updateMemoComponent( current, workInProgress, - elementType, + Component, init, renderLanes ) @@ -6901,21 +6905,21 @@ function beginWork(current, workInProgress, renderLanes) { ); case 17: return ( - (elementType = workInProgress.type), + (Component = workInProgress.type), (init = workInProgress.pendingProps), (init = - workInProgress.elementType === elementType + workInProgress.elementType === Component ? init - : resolveDefaultProps(elementType, init)), + : resolveDefaultProps(Component, init)), resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), (workInProgress.tag = 1), prepareToReadContext(workInProgress, renderLanes), - constructClassInstance(workInProgress, elementType, init), - mountClassInstance(workInProgress, elementType, init, renderLanes), + constructClassInstance(workInProgress, Component, init), + mountClassInstance(workInProgress, Component, init, renderLanes), finishClassComponent( null, workInProgress, - elementType, + Component, !0, !1, renderLanes @@ -6925,9 +6929,9 @@ function beginWork(current, workInProgress, renderLanes) { return updateSuspenseListComponent(current, workInProgress, renderLanes); case 21: return ( - (elementType = workInProgress.pendingProps.children), + (Component = workInProgress.pendingProps.children), markRef(current, workInProgress), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 22: @@ -6937,7 +6941,7 @@ function beginWork(current, workInProgress, renderLanes) { case 24: return ( prepareToReadContext(workInProgress, renderLanes), - (elementType = readContext(CacheContext)), + (Component = readContext(CacheContext)), null === current ? ((init = peekCacheFromPool()), null === init && @@ -6947,10 +6951,7 @@ function beginWork(current, workInProgress, renderLanes) { prevState.refCount++, null !== prevState && (init.pooledCacheLanes |= renderLanes), (init = prevState)), - (workInProgress.memoizedState = { - parent: elementType, - cache: init - }), + (workInProgress.memoizedState = { parent: Component, cache: init }), initializeUpdateQueue(workInProgress), pushProvider(workInProgress, CacheContext, init)) : (0 !== (current.lanes & renderLanes) && @@ -6959,17 +6960,17 @@ function beginWork(current, workInProgress, renderLanes) { suspendIfUpdateReadFromEntangledAsyncAction()), (init = current.memoizedState), (prevState = workInProgress.memoizedState), - init.parent !== elementType - ? ((init = { parent: elementType, cache: elementType }), + init.parent !== Component + ? ((init = { parent: Component, cache: Component }), (workInProgress.memoizedState = init), 0 === workInProgress.lanes && (workInProgress.memoizedState = workInProgress.updateQueue.baseState = init), - pushProvider(workInProgress, CacheContext, elementType)) - : ((elementType = prevState.cache), - pushProvider(workInProgress, CacheContext, elementType), - elementType !== init.cache && + pushProvider(workInProgress, CacheContext, Component)) + : ((Component = prevState.cache), + pushProvider(workInProgress, CacheContext, Component), + Component !== init.cache && propagateContextChange( workInProgress, CacheContext, @@ -6988,22 +6989,22 @@ function beginWork(current, workInProgress, renderLanes) { return ( enableTransitionTracing ? (null === current && - ((elementType = enableTransitionTracing + ((Component = enableTransitionTracing ? transitionStack.current : null), - null !== elementType && - ((elementType = { + null !== Component && + ((Component = { tag: 1, - transitions: new Set(elementType), + transitions: new Set(Component), pendingBoundaries: null, name: workInProgress.pendingProps.name, aborts: null }), - (workInProgress.stateNode = elementType), + (workInProgress.stateNode = Component), (workInProgress.flags |= 2048))), - (elementType = workInProgress.stateNode), - null !== elementType && - pushMarkerInstance(workInProgress, elementType), + (Component = workInProgress.stateNode), + null !== Component && + pushMarkerInstance(workInProgress, Component), reconcileChildren( current, workInProgress, @@ -7553,6 +7554,7 @@ function completeWork(current, workInProgress, renderLanes) { var newProps = workInProgress.pendingProps; popTreeContext(workInProgress); switch (workInProgress.tag) { + case 2: case 16: case 15: case 0: @@ -11290,6 +11292,8 @@ function performUnitOfWork(unitOfWork) { function replaySuspendedUnitOfWork(unitOfWork) { var current = unitOfWork.alternate; switch (unitOfWork.tag) { + case 2: + unitOfWork.tag = 0; case 15: case 0: var Component = unitOfWork.type, @@ -11784,6 +11788,16 @@ function shouldConstruct(Component) { Component = Component.prototype; return !(!Component || !Component.isReactComponent); } +function resolveLazyComponentTag(Component) { + if ("function" === typeof Component) + return shouldConstruct(Component) ? 1 : 0; + if (void 0 !== Component && null !== Component) { + Component = Component.$$typeof; + if (Component === REACT_FORWARD_REF_TYPE) return 11; + if (Component === REACT_MEMO_TYPE) return 14; + } + return 2; +} function createWorkInProgress(current, pendingProps) { var workInProgress = current.alternate; null === workInProgress @@ -11861,7 +11875,7 @@ function createFiberFromTypeAndProps( mode, lanes ) { - var fiberTag = 0; + var fiberTag = 2; owner = type; if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); else if ("string" === typeof type) @@ -13417,19 +13431,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$341; + var JSCompiler_inline_result$jscomp$342; if (canUseDOM) { - var isSupported$jscomp$inline_1480 = "oninput" in document; - if (!isSupported$jscomp$inline_1480) { - var element$jscomp$inline_1481 = document.createElement("div"); - element$jscomp$inline_1481.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1480 = - "function" === typeof element$jscomp$inline_1481.oninput; + var isSupported$jscomp$inline_1494 = "oninput" in document; + if (!isSupported$jscomp$inline_1494) { + var element$jscomp$inline_1495 = document.createElement("div"); + element$jscomp$inline_1495.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1494 = + "function" === typeof element$jscomp$inline_1495.oninput; } - JSCompiler_inline_result$jscomp$341 = isSupported$jscomp$inline_1480; - } else JSCompiler_inline_result$jscomp$341 = !1; + JSCompiler_inline_result$jscomp$342 = isSupported$jscomp$inline_1494; + } else JSCompiler_inline_result$jscomp$342 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$341 && + JSCompiler_inline_result$jscomp$342 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -13738,20 +13752,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1521 = 0; - i$jscomp$inline_1521 < simpleEventPluginEvents.length; - i$jscomp$inline_1521++ + var i$jscomp$inline_1535 = 0; + i$jscomp$inline_1535 < simpleEventPluginEvents.length; + i$jscomp$inline_1535++ ) { - var eventName$jscomp$inline_1522 = - simpleEventPluginEvents[i$jscomp$inline_1521], - domEventName$jscomp$inline_1523 = - eventName$jscomp$inline_1522.toLowerCase(), - capitalizedEvent$jscomp$inline_1524 = - eventName$jscomp$inline_1522[0].toUpperCase() + - eventName$jscomp$inline_1522.slice(1); + var eventName$jscomp$inline_1536 = + simpleEventPluginEvents[i$jscomp$inline_1535], + domEventName$jscomp$inline_1537 = + eventName$jscomp$inline_1536.toLowerCase(), + capitalizedEvent$jscomp$inline_1538 = + eventName$jscomp$inline_1536[0].toUpperCase() + + eventName$jscomp$inline_1536.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1523, - "on" + capitalizedEvent$jscomp$inline_1524 + domEventName$jscomp$inline_1537, + "on" + capitalizedEvent$jscomp$inline_1538 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16608,17 +16622,17 @@ Internals.Events = [ restoreStateIfNeeded, unstable_batchedUpdates ]; -var devToolsConfig$jscomp$inline_1679 = { +var devToolsConfig$jscomp$inline_1693 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-modern-d24a2178", + version: "19.0.0-www-modern-8e569007", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2105 = { - bundleType: devToolsConfig$jscomp$inline_1679.bundleType, - version: devToolsConfig$jscomp$inline_1679.version, - rendererPackageName: devToolsConfig$jscomp$inline_1679.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1679.rendererConfig, +var internals$jscomp$inline_2122 = { + bundleType: devToolsConfig$jscomp$inline_1693.bundleType, + version: devToolsConfig$jscomp$inline_1693.version, + rendererPackageName: devToolsConfig$jscomp$inline_1693.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1693.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16634,26 +16648,26 @@ var internals$jscomp$inline_2105 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1679.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1693.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-d24a2178" + reconcilerVersion: "19.0.0-www-modern-8e569007" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2106 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2123 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2106.isDisabled && - hook$jscomp$inline_2106.supportsFiber + !hook$jscomp$inline_2123.isDisabled && + hook$jscomp$inline_2123.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2106.inject( - internals$jscomp$inline_2105 + (rendererID = hook$jscomp$inline_2123.inject( + internals$jscomp$inline_2122 )), - (injectedHook = hook$jscomp$inline_2106); + (injectedHook = hook$jscomp$inline_2123); } catch (err) {} } var ReactFiberErrorDialogWWW = require("ReactFiberErrorDialog"); @@ -16944,4 +16958,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactCurrentDispatcher$2.current.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-modern-d24a2178"; +exports.version = "19.0.0-www-modern-8e569007"; diff --git a/compiled/facebook-www/ReactDOM-profiling.classic.js b/compiled/facebook-www/ReactDOM-profiling.classic.js index f1a6d828b3715..3bc77fffae4b2 100644 --- a/compiled/facebook-www/ReactDOM-profiling.classic.js +++ b/compiled/facebook-www/ReactDOM-profiling.classic.js @@ -216,6 +216,7 @@ function getComponentNameFromFiber(fiber) { case 1: case 0: case 17: + case 2: case 14: case 15: if ("function" === typeof type) @@ -1126,6 +1127,7 @@ function describeFiber(fiber) { case 19: return describeBuiltInComponentFrame("SuspenseList"); case 0: + case 2: case 15: return (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; case 11: @@ -6865,91 +6867,112 @@ function beginWork(current, workInProgress, renderLanes) { pushTreeId(workInProgress, treeForkCount, workInProgress.index); workInProgress.lanes = 0; switch (workInProgress.tag) { + case 2: + var Component = workInProgress.type; + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + var context = getMaskedContext( + workInProgress, + contextStackCursor.current + ); + prepareToReadContext(workInProgress, renderLanes); + enableSchedulingProfiler && markComponentRenderStarted(workInProgress); + current = renderWithHooks( + null, + workInProgress, + Component, + current, + context, + renderLanes + ); + Component = checkDidRenderIdHook(); + enableSchedulingProfiler && markComponentRenderStopped(); + workInProgress.flags |= 1; + workInProgress.tag = 0; + isHydrating && Component && pushMaterializedTreeId(workInProgress); + reconcileChildren(null, workInProgress, current, renderLanes); + workInProgress = workInProgress.child; + return workInProgress; case 16: - var elementType = workInProgress.elementType; + Component = workInProgress.elementType; a: { resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); current = workInProgress.pendingProps; - var init = elementType._init; - elementType = init(elementType._payload); - workInProgress.type = elementType; - current = resolveDefaultProps(elementType, current); - if ("function" === typeof elementType) - shouldConstruct(elementType) - ? ((workInProgress.tag = 1), - (workInProgress = updateClassComponent( - null, - workInProgress, - elementType, - current, - renderLanes - ))) - : ((workInProgress.tag = 0), - (workInProgress = updateFunctionComponent( - null, - workInProgress, - elementType, - current, - renderLanes - ))); - else { - if (void 0 !== elementType && null !== elementType) - if ( - ((init = elementType.$$typeof), init === REACT_FORWARD_REF_TYPE) - ) { - workInProgress.tag = 11; - workInProgress = updateForwardRef( - null, - workInProgress, - elementType, - current, - renderLanes - ); - break a; - } else if (init === REACT_MEMO_TYPE) { - workInProgress.tag = 14; - workInProgress = updateMemoComponent( - null, - workInProgress, - elementType, - resolveDefaultProps(elementType.type, current), - renderLanes - ); - break a; - } - throw Error(formatProdErrorMessage(306, elementType, "")); + context = Component._init; + Component = context(Component._payload); + workInProgress.type = Component; + context = workInProgress.tag = resolveLazyComponentTag(Component); + current = resolveDefaultProps(Component, current); + switch (context) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + Component, + resolveDefaultProps(Component.type, current), + renderLanes + ); + break a; } + throw Error(formatProdErrorMessage(306, Component, "")); } return workInProgress; case 0: return ( - (elementType = workInProgress.type), - (init = workInProgress.pendingProps), - (init = - workInProgress.elementType === elementType - ? init - : resolveDefaultProps(elementType, init)), + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), updateFunctionComponent( current, workInProgress, - elementType, - init, + Component, + context, renderLanes ) ); case 1: return ( - (elementType = workInProgress.type), - (init = workInProgress.pendingProps), - (init = - workInProgress.elementType === elementType - ? init - : resolveDefaultProps(elementType, init)), + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), updateClassComponent( current, workInProgress, - elementType, - init, + Component, + context, renderLanes ) ); @@ -6957,25 +6980,25 @@ function beginWork(current, workInProgress, renderLanes) { a: { pushHostRootContext(workInProgress); if (null === current) throw Error(formatProdErrorMessage(387)); - init = workInProgress.pendingProps; + context = workInProgress.pendingProps; var prevState = workInProgress.memoizedState; - elementType = prevState.element; + Component = prevState.element; cloneUpdateQueue(current, workInProgress); - processUpdateQueue(workInProgress, init, null, renderLanes); + processUpdateQueue(workInProgress, context, null, renderLanes); var nextState = workInProgress.memoizedState; enableTransitionTracing && push(transitionStack, workInProgressTransitions); enableTransitionTracing && pushRootMarkerInstance(workInProgress); - init = nextState.cache; - pushProvider(workInProgress, CacheContext, init); - init !== prevState.cache && + context = nextState.cache; + pushProvider(workInProgress, CacheContext, context); + context !== prevState.cache && propagateContextChange(workInProgress, CacheContext, renderLanes); suspendIfUpdateReadFromEntangledAsyncAction(); - init = nextState.element; + context = nextState.element; if (prevState.isDehydrated) if ( ((prevState = { - element: init, + element: context, isDehydrated: !1, cache: nextState.cache }), @@ -6983,29 +7006,29 @@ function beginWork(current, workInProgress, renderLanes) { (workInProgress.memoizedState = prevState), workInProgress.flags & 256) ) { - elementType = createCapturedValueAtFiber( + Component = createCapturedValueAtFiber( Error(formatProdErrorMessage(423)), workInProgress ); workInProgress = mountHostRootWithoutHydrating( current, workInProgress, - init, + context, renderLanes, - elementType + Component ); break a; - } else if (init !== elementType) { - elementType = createCapturedValueAtFiber( + } else if (context !== Component) { + Component = createCapturedValueAtFiber( Error(formatProdErrorMessage(424)), workInProgress ); workInProgress = mountHostRootWithoutHydrating( current, workInProgress, - init, + context, renderLanes, - elementType + Component ); break a; } else @@ -7020,7 +7043,7 @@ function beginWork(current, workInProgress, renderLanes) { renderLanes = mountChildFibers( workInProgress, null, - init, + context, renderLanes ), workInProgress.child = renderLanes; @@ -7031,7 +7054,7 @@ function beginWork(current, workInProgress, renderLanes) { (renderLanes = renderLanes.sibling); else { resetHydrationState(); - if (init === elementType) { + if (context === Component) { workInProgress = bailoutOnAlreadyFinishedWork( current, workInProgress, @@ -7039,7 +7062,7 @@ function beginWork(current, workInProgress, renderLanes) { ); break a; } - reconcileChildren(current, workInProgress, init, renderLanes); + reconcileChildren(current, workInProgress, context, renderLanes); } workInProgress = workInProgress.child; } @@ -7058,14 +7081,14 @@ function beginWork(current, workInProgress, renderLanes) { null !== renderLanes || ((renderLanes = workInProgress.type), (current = workInProgress.pendingProps), - (elementType = getOwnerDocumentFromRootContainer( + (Component = getOwnerDocumentFromRootContainer( rootInstanceStackCursor.current ).createElement(renderLanes)), - (elementType[internalInstanceKey] = workInProgress), - (elementType[internalPropsKey] = current), - setInitialProperties(elementType, renderLanes, current), - markNodeAsHoistable(elementType), - (workInProgress.stateNode = elementType)), + (Component[internalInstanceKey] = workInProgress), + (Component[internalPropsKey] = current), + setInitialProperties(Component, renderLanes, current), + markNodeAsHoistable(Component), + (workInProgress.stateNode = Component)), null ); case 27: @@ -7073,7 +7096,7 @@ function beginWork(current, workInProgress, renderLanes) { pushHostContext(workInProgress), null === current && isHydrating && - ((elementType = workInProgress.stateNode = + ((Component = workInProgress.stateNode = resolveSingletonInstance( workInProgress.type, workInProgress.pendingProps, @@ -7081,14 +7104,14 @@ function beginWork(current, workInProgress, renderLanes) { )), (hydrationParentFiber = workInProgress), (rootOrSingletonContext = !0), - (nextHydratableInstance = getNextHydratable(elementType.firstChild))), - (elementType = workInProgress.pendingProps.children), + (nextHydratableInstance = getNextHydratable(Component.firstChild))), + (Component = workInProgress.pendingProps.children), null !== current || isHydrating - ? reconcileChildren(current, workInProgress, elementType, renderLanes) + ? reconcileChildren(current, workInProgress, Component, renderLanes) : (workInProgress.child = reconcileChildFibers( workInProgress, null, - elementType, + Component, renderLanes )), markRef(current, workInProgress), @@ -7096,36 +7119,36 @@ function beginWork(current, workInProgress, renderLanes) { ); case 5: if (null === current && isHydrating) { - if ((init = elementType = nextHydratableInstance)) - (elementType = canHydrateInstance( - elementType, + if ((context = Component = nextHydratableInstance)) + (Component = canHydrateInstance( + Component, workInProgress.type, workInProgress.pendingProps, rootOrSingletonContext )), - null !== elementType - ? ((workInProgress.stateNode = elementType), + null !== Component + ? ((workInProgress.stateNode = Component), (hydrationParentFiber = workInProgress), (nextHydratableInstance = getNextHydratable( - elementType.firstChild + Component.firstChild )), (rootOrSingletonContext = !1), - (init = !0)) - : (init = !1); - init || throwOnHydrationMismatch(); + (context = !0)) + : (context = !1); + context || throwOnHydrationMismatch(); } pushHostContext(workInProgress); - init = workInProgress.type; + context = workInProgress.type; prevState = workInProgress.pendingProps; nextState = null !== current ? current.memoizedProps : null; - elementType = prevState.children; - shouldSetTextContent(init, prevState) - ? (elementType = null) + Component = prevState.children; + shouldSetTextContent(context, prevState) + ? (Component = null) : null !== nextState && - shouldSetTextContent(init, nextState) && + shouldSetTextContent(context, nextState) && (workInProgress.flags |= 32); null !== workInProgress.memoizedState && - ((init = renderWithHooks( + ((context = renderWithHooks( current, workInProgress, TransitionAwareHostComponent, @@ -7133,18 +7156,18 @@ function beginWork(current, workInProgress, renderLanes) { null, renderLanes )), - (HostTransitionContext._currentValue = init), + (HostTransitionContext._currentValue = context), enableLazyContextPropagation || (didReceiveUpdate && null !== current && - current.memoizedState.memoizedState !== init && + current.memoizedState.memoizedState !== context && propagateContextChange( workInProgress, HostTransitionContext, renderLanes ))); markRef(current, workInProgress); - reconcileChildren(current, workInProgress, elementType, renderLanes); + reconcileChildren(current, workInProgress, Component, renderLanes); return workInProgress.child; case 6: if (null === current && isHydrating) { @@ -7171,35 +7194,30 @@ function beginWork(current, workInProgress, renderLanes) { workInProgress, workInProgress.stateNode.containerInfo ), - (elementType = workInProgress.pendingProps), + (Component = workInProgress.pendingProps), null === current ? (workInProgress.child = reconcileChildFibers( workInProgress, null, - elementType, + Component, renderLanes )) - : reconcileChildren( - current, - workInProgress, - elementType, - renderLanes - ), + : reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 11: return ( - (elementType = workInProgress.type), - (init = workInProgress.pendingProps), - (init = - workInProgress.elementType === elementType - ? init - : resolveDefaultProps(elementType, init)), + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), updateForwardRef( current, workInProgress, - elementType, - init, + Component, + context, renderLanes ) ); @@ -7226,9 +7244,9 @@ function beginWork(current, workInProgress, renderLanes) { case 12: return ( (workInProgress.flags |= 4), - (elementType = workInProgress.stateNode), - (elementType.effectDuration = 0), - (elementType.passiveEffectDuration = 0), + (Component = workInProgress.stateNode), + (Component.effectDuration = 0), + (Component.passiveEffectDuration = 0), reconcileChildren( current, workInProgress, @@ -7239,17 +7257,17 @@ function beginWork(current, workInProgress, renderLanes) { ); case 10: a: { - elementType = enableRenderableContext + Component = enableRenderableContext ? workInProgress.type : workInProgress.type._context; - init = workInProgress.pendingProps; + context = workInProgress.pendingProps; prevState = workInProgress.memoizedProps; - nextState = init.value; - pushProvider(workInProgress, elementType, nextState); + nextState = context.value; + pushProvider(workInProgress, Component, nextState); if (!enableLazyContextPropagation && null !== prevState) if (objectIs(prevState.value, nextState)) { if ( - prevState.children === init.children && + prevState.children === context.children && !didPerformWorkStackCursor.current ) { workInProgress = bailoutOnAlreadyFinishedWork( @@ -7259,37 +7277,41 @@ function beginWork(current, workInProgress, renderLanes) { ); break a; } - } else - propagateContextChange(workInProgress, elementType, renderLanes); - reconcileChildren(current, workInProgress, init.children, renderLanes); + } else propagateContextChange(workInProgress, Component, renderLanes); + reconcileChildren( + current, + workInProgress, + context.children, + renderLanes + ); workInProgress = workInProgress.child; } return workInProgress; case 9: return ( - (init = enableRenderableContext + (context = enableRenderableContext ? workInProgress.type._context : workInProgress.type), - (elementType = workInProgress.pendingProps.children), + (Component = workInProgress.pendingProps.children), prepareToReadContext(workInProgress, renderLanes), - (init = readContext(init)), + (context = readContext(context)), enableSchedulingProfiler && markComponentRenderStarted(workInProgress), - (elementType = elementType(init)), + (Component = Component(context)), enableSchedulingProfiler && markComponentRenderStopped(), (workInProgress.flags |= 1), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 14: return ( - (elementType = workInProgress.type), - (init = resolveDefaultProps(elementType, workInProgress.pendingProps)), - (init = resolveDefaultProps(elementType.type, init)), + (Component = workInProgress.type), + (context = resolveDefaultProps(Component, workInProgress.pendingProps)), + (context = resolveDefaultProps(Component.type, context)), updateMemoComponent( current, workInProgress, - elementType, - init, + Component, + context, renderLanes ) ); @@ -7303,24 +7325,24 @@ function beginWork(current, workInProgress, renderLanes) { ); case 17: return ( - (elementType = workInProgress.type), - (init = workInProgress.pendingProps), - (init = - workInProgress.elementType === elementType - ? init - : resolveDefaultProps(elementType, init)), + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), (workInProgress.tag = 1), - isContextProvider(elementType) + isContextProvider(Component) ? ((current = !0), pushContextProvider(workInProgress)) : (current = !1), prepareToReadContext(workInProgress, renderLanes), - constructClassInstance(workInProgress, elementType, init), - mountClassInstance(workInProgress, elementType, init, renderLanes), + constructClassInstance(workInProgress, Component, context), + mountClassInstance(workInProgress, Component, context, renderLanes), finishClassComponent( null, workInProgress, - elementType, + Component, !0, current, renderLanes @@ -7330,9 +7352,9 @@ function beginWork(current, workInProgress, renderLanes) { return updateSuspenseListComponent(current, workInProgress, renderLanes); case 21: return ( - (elementType = workInProgress.pendingProps.children), + (Component = workInProgress.pendingProps.children), markRef(current, workInProgress), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 22: @@ -7342,39 +7364,39 @@ function beginWork(current, workInProgress, renderLanes) { case 24: return ( prepareToReadContext(workInProgress, renderLanes), - (elementType = readContext(CacheContext)), + (Component = readContext(CacheContext)), null === current - ? ((init = peekCacheFromPool()), - null === init && - ((init = workInProgressRoot), + ? ((context = peekCacheFromPool()), + null === context && + ((context = workInProgressRoot), (prevState = createCache()), - (init.pooledCache = prevState), + (context.pooledCache = prevState), prevState.refCount++, - null !== prevState && (init.pooledCacheLanes |= renderLanes), - (init = prevState)), + null !== prevState && (context.pooledCacheLanes |= renderLanes), + (context = prevState)), (workInProgress.memoizedState = { - parent: elementType, - cache: init + parent: Component, + cache: context }), initializeUpdateQueue(workInProgress), - pushProvider(workInProgress, CacheContext, init)) + pushProvider(workInProgress, CacheContext, context)) : (0 !== (current.lanes & renderLanes) && (cloneUpdateQueue(current, workInProgress), processUpdateQueue(workInProgress, null, null, renderLanes), suspendIfUpdateReadFromEntangledAsyncAction()), - (init = current.memoizedState), + (context = current.memoizedState), (prevState = workInProgress.memoizedState), - init.parent !== elementType - ? ((init = { parent: elementType, cache: elementType }), - (workInProgress.memoizedState = init), + context.parent !== Component + ? ((context = { parent: Component, cache: Component }), + (workInProgress.memoizedState = context), 0 === workInProgress.lanes && (workInProgress.memoizedState = workInProgress.updateQueue.baseState = - init), - pushProvider(workInProgress, CacheContext, elementType)) - : ((elementType = prevState.cache), - pushProvider(workInProgress, CacheContext, elementType), - elementType !== init.cache && + context), + pushProvider(workInProgress, CacheContext, Component)) + : ((Component = prevState.cache), + pushProvider(workInProgress, CacheContext, Component), + Component !== context.cache && propagateContextChange( workInProgress, CacheContext, @@ -7393,22 +7415,22 @@ function beginWork(current, workInProgress, renderLanes) { return ( enableTransitionTracing ? (null === current && - ((elementType = enableTransitionTracing + ((Component = enableTransitionTracing ? transitionStack.current : null), - null !== elementType && - ((elementType = { + null !== Component && + ((Component = { tag: 1, - transitions: new Set(elementType), + transitions: new Set(Component), pendingBoundaries: null, name: workInProgress.pendingProps.name, aborts: null }), - (workInProgress.stateNode = elementType), + (workInProgress.stateNode = Component), (workInProgress.flags |= 2048))), - (elementType = workInProgress.stateNode), - null !== elementType && - pushMarkerInstance(workInProgress, elementType), + (Component = workInProgress.stateNode), + null !== Component && + pushMarkerInstance(workInProgress, Component), reconcileChildren( current, workInProgress, @@ -7994,6 +8016,7 @@ function completeWork(current, workInProgress, renderLanes) { var newProps = workInProgress.pendingProps; popTreeContext(workInProgress); switch (workInProgress.tag) { + case 2: case 16: case 15: case 0: @@ -12128,6 +12151,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { isProfilingMode = 0 !== (unitOfWork.mode & 2); isProfilingMode && startProfilerTimer(unitOfWork); switch (unitOfWork.tag) { + case 2: + unitOfWork.tag = 0; case 15: case 0: var Component = unitOfWork.type, @@ -12692,6 +12717,16 @@ function shouldConstruct(Component) { Component = Component.prototype; return !(!Component || !Component.isReactComponent); } +function resolveLazyComponentTag(Component) { + if ("function" === typeof Component) + return shouldConstruct(Component) ? 1 : 0; + if (void 0 !== Component && null !== Component) { + Component = Component.$$typeof; + if (Component === REACT_FORWARD_REF_TYPE) return 11; + if (Component === REACT_MEMO_TYPE) return 14; + } + return 2; +} function createWorkInProgress(current, pendingProps) { var workInProgress = current.alternate; null === workInProgress @@ -12777,7 +12812,7 @@ function createFiberFromTypeAndProps( mode, lanes ) { - var fiberTag = 0; + var fiberTag = 2; owner = type; if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); else if ("string" === typeof type) @@ -13776,19 +13811,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$367; + var JSCompiler_inline_result$jscomp$368; if (canUseDOM) { - var isSupported$jscomp$inline_1568 = "oninput" in document; - if (!isSupported$jscomp$inline_1568) { - var element$jscomp$inline_1569 = document.createElement("div"); - element$jscomp$inline_1569.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1568 = - "function" === typeof element$jscomp$inline_1569.oninput; + var isSupported$jscomp$inline_1583 = "oninput" in document; + if (!isSupported$jscomp$inline_1583) { + var element$jscomp$inline_1584 = document.createElement("div"); + element$jscomp$inline_1584.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1583 = + "function" === typeof element$jscomp$inline_1584.oninput; } - JSCompiler_inline_result$jscomp$367 = isSupported$jscomp$inline_1568; - } else JSCompiler_inline_result$jscomp$367 = !1; + JSCompiler_inline_result$jscomp$368 = isSupported$jscomp$inline_1583; + } else JSCompiler_inline_result$jscomp$368 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$367 && + JSCompiler_inline_result$jscomp$368 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -14160,20 +14195,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1609 = 0; - i$jscomp$inline_1609 < simpleEventPluginEvents.length; - i$jscomp$inline_1609++ + var i$jscomp$inline_1624 = 0; + i$jscomp$inline_1624 < simpleEventPluginEvents.length; + i$jscomp$inline_1624++ ) { - var eventName$jscomp$inline_1610 = - simpleEventPluginEvents[i$jscomp$inline_1609], - domEventName$jscomp$inline_1611 = - eventName$jscomp$inline_1610.toLowerCase(), - capitalizedEvent$jscomp$inline_1612 = - eventName$jscomp$inline_1610[0].toUpperCase() + - eventName$jscomp$inline_1610.slice(1); + var eventName$jscomp$inline_1625 = + simpleEventPluginEvents[i$jscomp$inline_1624], + domEventName$jscomp$inline_1626 = + eventName$jscomp$inline_1625.toLowerCase(), + capitalizedEvent$jscomp$inline_1627 = + eventName$jscomp$inline_1625[0].toUpperCase() + + eventName$jscomp$inline_1625.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1611, - "on" + capitalizedEvent$jscomp$inline_1612 + domEventName$jscomp$inline_1626, + "on" + capitalizedEvent$jscomp$inline_1627 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -17823,10 +17858,10 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1803 = { +var devToolsConfig$jscomp$inline_1818 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-classic-e7c0316f", + version: "19.0.0-www-classic-e6369628", rendererPackageName: "react-dom" }; (function (internals) { @@ -17844,10 +17879,10 @@ var devToolsConfig$jscomp$inline_1803 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1803.bundleType, - version: devToolsConfig$jscomp$inline_1803.version, - rendererPackageName: devToolsConfig$jscomp$inline_1803.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1803.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1818.bundleType, + version: devToolsConfig$jscomp$inline_1818.version, + rendererPackageName: devToolsConfig$jscomp$inline_1818.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1818.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17863,14 +17898,14 @@ var devToolsConfig$jscomp$inline_1803 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1803.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1818.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-e7c0316f" + reconcilerVersion: "19.0.0-www-classic-e6369628" }); var ReactFiberErrorDialogWWW = require("ReactFiberErrorDialog"); if ("function" !== typeof ReactFiberErrorDialogWWW.showErrorDialog) @@ -18307,7 +18342,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactCurrentDispatcher$2.current.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-classic-e7c0316f"; +exports.version = "19.0.0-www-classic-e6369628"; "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 b594551853fae..9d069198ca989 100644 --- a/compiled/facebook-www/ReactDOM-profiling.modern.js +++ b/compiled/facebook-www/ReactDOM-profiling.modern.js @@ -982,6 +982,7 @@ function describeFiber(fiber) { case 19: return describeBuiltInComponentFrame("SuspenseList"); case 0: + case 2: case 15: return (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; case 11: @@ -6705,90 +6706,107 @@ function beginWork(current, workInProgress, renderLanes) { pushTreeId(workInProgress, treeForkCount, workInProgress.index); workInProgress.lanes = 0; switch (workInProgress.tag) { + case 2: + var Component = workInProgress.type; + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + prepareToReadContext(workInProgress, renderLanes); + enableSchedulingProfiler && markComponentRenderStarted(workInProgress); + current = renderWithHooks( + null, + workInProgress, + Component, + current, + void 0, + renderLanes + ); + Component = checkDidRenderIdHook(); + enableSchedulingProfiler && markComponentRenderStopped(); + workInProgress.flags |= 1; + workInProgress.tag = 0; + isHydrating && Component && pushMaterializedTreeId(workInProgress); + reconcileChildren(null, workInProgress, current, renderLanes); + workInProgress = workInProgress.child; + return workInProgress; case 16: - var elementType = workInProgress.elementType; + Component = workInProgress.elementType; a: { resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); current = workInProgress.pendingProps; - var init = elementType._init; - elementType = init(elementType._payload); - workInProgress.type = elementType; - current = resolveDefaultProps(elementType, current); - if ("function" === typeof elementType) - shouldConstruct(elementType) - ? ((workInProgress.tag = 1), - (workInProgress = updateClassComponent( - null, - workInProgress, - elementType, - current, - renderLanes - ))) - : ((workInProgress.tag = 0), - (workInProgress = updateFunctionComponent( - null, - workInProgress, - elementType, - current, - renderLanes - ))); - else { - if (void 0 !== elementType && null !== elementType) - if ( - ((init = elementType.$$typeof), init === REACT_FORWARD_REF_TYPE) - ) { - workInProgress.tag = 11; - workInProgress = updateForwardRef( - null, - workInProgress, - elementType, - current, - renderLanes - ); - break a; - } else if (init === REACT_MEMO_TYPE) { - workInProgress.tag = 14; - workInProgress = updateMemoComponent( - null, - workInProgress, - elementType, - resolveDefaultProps(elementType.type, current), - renderLanes - ); - break a; - } - throw Error(formatProdErrorMessage(306, elementType, "")); + var init = Component._init; + Component = init(Component._payload); + workInProgress.type = Component; + init = workInProgress.tag = resolveLazyComponentTag(Component); + current = resolveDefaultProps(Component, current); + switch (init) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + Component, + resolveDefaultProps(Component.type, current), + renderLanes + ); + break a; } + throw Error(formatProdErrorMessage(306, Component, "")); } return workInProgress; case 0: return ( - (elementType = workInProgress.type), + (Component = workInProgress.type), (init = workInProgress.pendingProps), (init = - workInProgress.elementType === elementType + workInProgress.elementType === Component ? init - : resolveDefaultProps(elementType, init)), + : resolveDefaultProps(Component, init)), updateFunctionComponent( current, workInProgress, - elementType, + Component, init, renderLanes ) ); case 1: return ( - (elementType = workInProgress.type), + (Component = workInProgress.type), (init = workInProgress.pendingProps), (init = - workInProgress.elementType === elementType + workInProgress.elementType === Component ? init - : resolveDefaultProps(elementType, init)), + : resolveDefaultProps(Component, init)), updateClassComponent( current, workInProgress, - elementType, + Component, init, renderLanes ) @@ -6802,7 +6820,7 @@ function beginWork(current, workInProgress, renderLanes) { if (null === current) throw Error(formatProdErrorMessage(387)); init = workInProgress.pendingProps; var prevState = workInProgress.memoizedState; - elementType = prevState.element; + Component = prevState.element; cloneUpdateQueue(current, workInProgress); processUpdateQueue(workInProgress, init, null, renderLanes); var nextState = workInProgress.memoizedState; @@ -6826,7 +6844,7 @@ function beginWork(current, workInProgress, renderLanes) { (workInProgress.memoizedState = prevState), workInProgress.flags & 256) ) { - elementType = createCapturedValueAtFiber( + Component = createCapturedValueAtFiber( Error(formatProdErrorMessage(423)), workInProgress ); @@ -6835,11 +6853,11 @@ function beginWork(current, workInProgress, renderLanes) { workInProgress, init, renderLanes, - elementType + Component ); break a; - } else if (init !== elementType) { - elementType = createCapturedValueAtFiber( + } else if (init !== Component) { + Component = createCapturedValueAtFiber( Error(formatProdErrorMessage(424)), workInProgress ); @@ -6848,7 +6866,7 @@ function beginWork(current, workInProgress, renderLanes) { workInProgress, init, renderLanes, - elementType + Component ); break a; } else @@ -6874,7 +6892,7 @@ function beginWork(current, workInProgress, renderLanes) { (renderLanes = renderLanes.sibling); else { resetHydrationState(); - if (init === elementType) { + if (init === Component) { workInProgress = bailoutOnAlreadyFinishedWork( current, workInProgress, @@ -6901,14 +6919,14 @@ function beginWork(current, workInProgress, renderLanes) { null !== renderLanes || ((renderLanes = workInProgress.type), (current = workInProgress.pendingProps), - (elementType = getOwnerDocumentFromRootContainer( + (Component = getOwnerDocumentFromRootContainer( rootInstanceStackCursor.current ).createElement(renderLanes)), - (elementType[internalInstanceKey] = workInProgress), - (elementType[internalPropsKey] = current), - setInitialProperties(elementType, renderLanes, current), - markNodeAsHoistable(elementType), - (workInProgress.stateNode = elementType)), + (Component[internalInstanceKey] = workInProgress), + (Component[internalPropsKey] = current), + setInitialProperties(Component, renderLanes, current), + markNodeAsHoistable(Component), + (workInProgress.stateNode = Component)), null ); case 27: @@ -6916,7 +6934,7 @@ function beginWork(current, workInProgress, renderLanes) { pushHostContext(workInProgress), null === current && isHydrating && - ((elementType = workInProgress.stateNode = + ((Component = workInProgress.stateNode = resolveSingletonInstance( workInProgress.type, workInProgress.pendingProps, @@ -6924,14 +6942,14 @@ function beginWork(current, workInProgress, renderLanes) { )), (hydrationParentFiber = workInProgress), (rootOrSingletonContext = !0), - (nextHydratableInstance = getNextHydratable(elementType.firstChild))), - (elementType = workInProgress.pendingProps.children), + (nextHydratableInstance = getNextHydratable(Component.firstChild))), + (Component = workInProgress.pendingProps.children), null !== current || isHydrating - ? reconcileChildren(current, workInProgress, elementType, renderLanes) + ? reconcileChildren(current, workInProgress, Component, renderLanes) : (workInProgress.child = reconcileChildFibers( workInProgress, null, - elementType, + Component, renderLanes )), markRef(current, workInProgress), @@ -6939,18 +6957,18 @@ function beginWork(current, workInProgress, renderLanes) { ); case 5: if (null === current && isHydrating) { - if ((init = elementType = nextHydratableInstance)) - (elementType = canHydrateInstance( - elementType, + if ((init = Component = nextHydratableInstance)) + (Component = canHydrateInstance( + Component, workInProgress.type, workInProgress.pendingProps, rootOrSingletonContext )), - null !== elementType - ? ((workInProgress.stateNode = elementType), + null !== Component + ? ((workInProgress.stateNode = Component), (hydrationParentFiber = workInProgress), (nextHydratableInstance = getNextHydratable( - elementType.firstChild + Component.firstChild )), (rootOrSingletonContext = !1), (init = !0)) @@ -6961,9 +6979,9 @@ function beginWork(current, workInProgress, renderLanes) { init = workInProgress.type; prevState = workInProgress.pendingProps; nextState = null !== current ? current.memoizedProps : null; - elementType = prevState.children; + Component = prevState.children; shouldSetTextContent(init, prevState) - ? (elementType = null) + ? (Component = null) : null !== nextState && shouldSetTextContent(init, nextState) && (workInProgress.flags |= 32); @@ -6987,7 +7005,7 @@ function beginWork(current, workInProgress, renderLanes) { renderLanes ))); markRef(current, workInProgress); - reconcileChildren(current, workInProgress, elementType, renderLanes); + reconcileChildren(current, workInProgress, Component, renderLanes); return workInProgress.child; case 6: if (null === current && isHydrating) { @@ -7014,37 +7032,26 @@ function beginWork(current, workInProgress, renderLanes) { workInProgress, workInProgress.stateNode.containerInfo ), - (elementType = workInProgress.pendingProps), + (Component = workInProgress.pendingProps), null === current ? (workInProgress.child = reconcileChildFibers( workInProgress, null, - elementType, + Component, renderLanes )) - : reconcileChildren( - current, - workInProgress, - elementType, - renderLanes - ), + : reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 11: return ( - (elementType = workInProgress.type), + (Component = workInProgress.type), (init = workInProgress.pendingProps), (init = - workInProgress.elementType === elementType + workInProgress.elementType === Component ? init - : resolveDefaultProps(elementType, init)), - updateForwardRef( - current, - workInProgress, - elementType, - init, - renderLanes - ) + : resolveDefaultProps(Component, init)), + updateForwardRef(current, workInProgress, Component, init, renderLanes) ); case 7: return ( @@ -7069,9 +7076,9 @@ function beginWork(current, workInProgress, renderLanes) { case 12: return ( (workInProgress.flags |= 4), - (elementType = workInProgress.stateNode), - (elementType.effectDuration = 0), - (elementType.passiveEffectDuration = 0), + (Component = workInProgress.stateNode), + (Component.effectDuration = 0), + (Component.passiveEffectDuration = 0), reconcileChildren( current, workInProgress, @@ -7082,13 +7089,13 @@ function beginWork(current, workInProgress, renderLanes) { ); case 10: a: { - elementType = enableRenderableContext + Component = enableRenderableContext ? workInProgress.type : workInProgress.type._context; init = workInProgress.pendingProps; prevState = workInProgress.memoizedProps; nextState = init.value; - pushProvider(workInProgress, elementType, nextState); + pushProvider(workInProgress, Component, nextState); if (!enableLazyContextPropagation && null !== prevState) if (objectIs(prevState.value, nextState)) { if (prevState.children === init.children) { @@ -7099,8 +7106,7 @@ function beginWork(current, workInProgress, renderLanes) { ); break a; } - } else - propagateContextChange(workInProgress, elementType, renderLanes); + } else propagateContextChange(workInProgress, Component, renderLanes); reconcileChildren(current, workInProgress, init.children, renderLanes); workInProgress = workInProgress.child; } @@ -7110,25 +7116,25 @@ function beginWork(current, workInProgress, renderLanes) { (init = enableRenderableContext ? workInProgress.type._context : workInProgress.type), - (elementType = workInProgress.pendingProps.children), + (Component = workInProgress.pendingProps.children), prepareToReadContext(workInProgress, renderLanes), (init = readContext(init)), enableSchedulingProfiler && markComponentRenderStarted(workInProgress), - (elementType = elementType(init)), + (Component = Component(init)), enableSchedulingProfiler && markComponentRenderStopped(), (workInProgress.flags |= 1), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 14: return ( - (elementType = workInProgress.type), - (init = resolveDefaultProps(elementType, workInProgress.pendingProps)), - (init = resolveDefaultProps(elementType.type, init)), + (Component = workInProgress.type), + (init = resolveDefaultProps(Component, workInProgress.pendingProps)), + (init = resolveDefaultProps(Component.type, init)), updateMemoComponent( current, workInProgress, - elementType, + Component, init, renderLanes ) @@ -7143,21 +7149,21 @@ function beginWork(current, workInProgress, renderLanes) { ); case 17: return ( - (elementType = workInProgress.type), + (Component = workInProgress.type), (init = workInProgress.pendingProps), (init = - workInProgress.elementType === elementType + workInProgress.elementType === Component ? init - : resolveDefaultProps(elementType, init)), + : resolveDefaultProps(Component, init)), resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), (workInProgress.tag = 1), prepareToReadContext(workInProgress, renderLanes), - constructClassInstance(workInProgress, elementType, init), - mountClassInstance(workInProgress, elementType, init, renderLanes), + constructClassInstance(workInProgress, Component, init), + mountClassInstance(workInProgress, Component, init, renderLanes), finishClassComponent( null, workInProgress, - elementType, + Component, !0, !1, renderLanes @@ -7167,9 +7173,9 @@ function beginWork(current, workInProgress, renderLanes) { return updateSuspenseListComponent(current, workInProgress, renderLanes); case 21: return ( - (elementType = workInProgress.pendingProps.children), + (Component = workInProgress.pendingProps.children), markRef(current, workInProgress), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 22: @@ -7179,7 +7185,7 @@ function beginWork(current, workInProgress, renderLanes) { case 24: return ( prepareToReadContext(workInProgress, renderLanes), - (elementType = readContext(CacheContext)), + (Component = readContext(CacheContext)), null === current ? ((init = peekCacheFromPool()), null === init && @@ -7189,10 +7195,7 @@ function beginWork(current, workInProgress, renderLanes) { prevState.refCount++, null !== prevState && (init.pooledCacheLanes |= renderLanes), (init = prevState)), - (workInProgress.memoizedState = { - parent: elementType, - cache: init - }), + (workInProgress.memoizedState = { parent: Component, cache: init }), initializeUpdateQueue(workInProgress), pushProvider(workInProgress, CacheContext, init)) : (0 !== (current.lanes & renderLanes) && @@ -7201,17 +7204,17 @@ function beginWork(current, workInProgress, renderLanes) { suspendIfUpdateReadFromEntangledAsyncAction()), (init = current.memoizedState), (prevState = workInProgress.memoizedState), - init.parent !== elementType - ? ((init = { parent: elementType, cache: elementType }), + init.parent !== Component + ? ((init = { parent: Component, cache: Component }), (workInProgress.memoizedState = init), 0 === workInProgress.lanes && (workInProgress.memoizedState = workInProgress.updateQueue.baseState = init), - pushProvider(workInProgress, CacheContext, elementType)) - : ((elementType = prevState.cache), - pushProvider(workInProgress, CacheContext, elementType), - elementType !== init.cache && + pushProvider(workInProgress, CacheContext, Component)) + : ((Component = prevState.cache), + pushProvider(workInProgress, CacheContext, Component), + Component !== init.cache && propagateContextChange( workInProgress, CacheContext, @@ -7230,22 +7233,22 @@ function beginWork(current, workInProgress, renderLanes) { return ( enableTransitionTracing ? (null === current && - ((elementType = enableTransitionTracing + ((Component = enableTransitionTracing ? transitionStack.current : null), - null !== elementType && - ((elementType = { + null !== Component && + ((Component = { tag: 1, - transitions: new Set(elementType), + transitions: new Set(Component), pendingBoundaries: null, name: workInProgress.pendingProps.name, aborts: null }), - (workInProgress.stateNode = elementType), + (workInProgress.stateNode = Component), (workInProgress.flags |= 2048))), - (elementType = workInProgress.stateNode), - null !== elementType && - pushMarkerInstance(workInProgress, elementType), + (Component = workInProgress.stateNode), + null !== Component && + pushMarkerInstance(workInProgress, Component), reconcileChildren( current, workInProgress, @@ -7831,6 +7834,7 @@ function completeWork(current, workInProgress, renderLanes) { var newProps = workInProgress.pendingProps; popTreeContext(workInProgress); switch (workInProgress.tag) { + case 2: case 16: case 15: case 0: @@ -11947,6 +11951,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { isProfilingMode = 0 !== (unitOfWork.mode & 2); isProfilingMode && startProfilerTimer(unitOfWork); switch (unitOfWork.tag) { + case 2: + unitOfWork.tag = 0; case 15: case 0: var Component = unitOfWork.type, @@ -12507,6 +12513,16 @@ function shouldConstruct(Component) { Component = Component.prototype; return !(!Component || !Component.isReactComponent); } +function resolveLazyComponentTag(Component) { + if ("function" === typeof Component) + return shouldConstruct(Component) ? 1 : 0; + if (void 0 !== Component && null !== Component) { + Component = Component.$$typeof; + if (Component === REACT_FORWARD_REF_TYPE) return 11; + if (Component === REACT_MEMO_TYPE) return 14; + } + return 2; +} function createWorkInProgress(current, pendingProps) { var workInProgress = current.alternate; null === workInProgress @@ -12592,7 +12608,7 @@ function createFiberFromTypeAndProps( mode, lanes ) { - var fiberTag = 0; + var fiberTag = 2; owner = type; if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); else if ("string" === typeof type) @@ -14159,19 +14175,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$362; + var JSCompiler_inline_result$jscomp$363; if (canUseDOM) { - var isSupported$jscomp$inline_1566 = "oninput" in document; - if (!isSupported$jscomp$inline_1566) { - var element$jscomp$inline_1567 = document.createElement("div"); - element$jscomp$inline_1567.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1566 = - "function" === typeof element$jscomp$inline_1567.oninput; + var isSupported$jscomp$inline_1580 = "oninput" in document; + if (!isSupported$jscomp$inline_1580) { + var element$jscomp$inline_1581 = document.createElement("div"); + element$jscomp$inline_1581.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1580 = + "function" === typeof element$jscomp$inline_1581.oninput; } - JSCompiler_inline_result$jscomp$362 = isSupported$jscomp$inline_1566; - } else JSCompiler_inline_result$jscomp$362 = !1; + JSCompiler_inline_result$jscomp$363 = isSupported$jscomp$inline_1580; + } else JSCompiler_inline_result$jscomp$363 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$362 && + JSCompiler_inline_result$jscomp$363 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -14480,20 +14496,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1607 = 0; - i$jscomp$inline_1607 < simpleEventPluginEvents.length; - i$jscomp$inline_1607++ + var i$jscomp$inline_1621 = 0; + i$jscomp$inline_1621 < simpleEventPluginEvents.length; + i$jscomp$inline_1621++ ) { - var eventName$jscomp$inline_1608 = - simpleEventPluginEvents[i$jscomp$inline_1607], - domEventName$jscomp$inline_1609 = - eventName$jscomp$inline_1608.toLowerCase(), - capitalizedEvent$jscomp$inline_1610 = - eventName$jscomp$inline_1608[0].toUpperCase() + - eventName$jscomp$inline_1608.slice(1); + var eventName$jscomp$inline_1622 = + simpleEventPluginEvents[i$jscomp$inline_1621], + domEventName$jscomp$inline_1623 = + eventName$jscomp$inline_1622.toLowerCase(), + capitalizedEvent$jscomp$inline_1624 = + eventName$jscomp$inline_1622[0].toUpperCase() + + eventName$jscomp$inline_1622.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1609, - "on" + capitalizedEvent$jscomp$inline_1610 + domEventName$jscomp$inline_1623, + "on" + capitalizedEvent$jscomp$inline_1624 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -17350,10 +17366,10 @@ Internals.Events = [ restoreStateIfNeeded, unstable_batchedUpdates ]; -var devToolsConfig$jscomp$inline_1765 = { +var devToolsConfig$jscomp$inline_1779 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-modern-e8c45a4b", + version: "19.0.0-www-modern-6ec98dbb", rendererPackageName: "react-dom" }; (function (internals) { @@ -17371,10 +17387,10 @@ var devToolsConfig$jscomp$inline_1765 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1765.bundleType, - version: devToolsConfig$jscomp$inline_1765.version, - rendererPackageName: devToolsConfig$jscomp$inline_1765.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1765.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1779.bundleType, + version: devToolsConfig$jscomp$inline_1779.version, + rendererPackageName: devToolsConfig$jscomp$inline_1779.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1779.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17390,14 +17406,14 @@ var devToolsConfig$jscomp$inline_1765 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1765.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1779.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-e8c45a4b" + reconcilerVersion: "19.0.0-www-modern-6ec98dbb" }); var ReactFiberErrorDialogWWW = require("ReactFiberErrorDialog"); if ("function" !== typeof ReactFiberErrorDialogWWW.showErrorDialog) @@ -17687,7 +17703,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactCurrentDispatcher$2.current.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-modern-e8c45a4b"; +exports.version = "19.0.0-www-modern-6ec98dbb"; "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 21af7204df301..ddb8199f1b0ac 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-a80d8e81"; + var ReactVersion = "19.0.0-www-classic-537a19a0"; // This refers to a WWW module. var warningWWW = require("warning"); @@ -11986,14 +11986,22 @@ if (__DEV__) { } var didWarnAboutBadClass = {}; + var didWarnAboutModulePatternComponent = {}; var didWarnAboutContextTypeOnFunctionComponent = {}; var didWarnAboutGetDerivedStateOnFunctionComponent = {}; var didWarnAboutReassigningProps = false; var didWarnAboutDefaultPropsOnFunctionComponent = {}; var didWarnAboutGenerators = false; - var didWarnAboutMaps = false; + var didWarnAboutMaps = false; // This would typically be a function component but we still support module pattern + // components for some reason. - function renderFunctionComponent(request, task, keyPath, Component, props) { + function renderIndeterminateComponent( + request, + task, + keyPath, + Component, + props + ) { var legacyContext; { @@ -12036,18 +12044,49 @@ if (__DEV__) { var actionStateMatchingIndex = getActionStateMatchingIndex(); { - validateFunctionComponentInDev(Component); + // Support for module components is deprecated and is removed behind a flag. + // Whether or not it would crash later, we want to show a good message in DEV first. + if ( + typeof value === "object" && + value !== null && + typeof value.render === "function" && + value.$$typeof === undefined + ) { + var _componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutModulePatternComponent[_componentName]) { + error( + "The <%s /> component appears to be a function component that returns a class instance. " + + "Change %s to a class that extends React.Component instead. " + + "If you can't use a class try assigning the prototype on the function as a workaround. " + + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + + "cannot be called with `new` by React.", + _componentName, + _componentName, + _componentName + ); + + didWarnAboutModulePatternComponent[_componentName] = true; + } + } + } + + { + { + validateFunctionComponentInDev(Component); + } + + finishFunctionComponent( + request, + task, + keyPath, + value, + hasId, + actionStateCount, + actionStateMatchingIndex + ); } - finishFunctionComponent( - request, - task, - keyPath, - value, - hasId, - actionStateCount, - actionStateMatchingIndex - ); task.componentStack = previousComponentStack; } @@ -12145,15 +12184,18 @@ if (__DEV__) { } if (typeof Component.getDerivedStateFromProps === "function") { - var _componentName = getComponentNameFromType(Component) || "Unknown"; + var _componentName3 = + getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName]) { + if ( + !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] + ) { error( "%s: Function components do not support getDerivedStateFromProps.", - _componentName + _componentName3 ); - didWarnAboutGetDerivedStateOnFunctionComponent[_componentName] = + didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] = true; } } @@ -12162,16 +12204,16 @@ if (__DEV__) { typeof Component.contextType === "object" && Component.contextType !== null ) { - var _componentName2 = + var _componentName4 = getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutContextTypeOnFunctionComponent[_componentName2]) { + if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) { error( "%s: Function components do not support contextType.", - _componentName2 + _componentName4 ); - didWarnAboutContextTypeOnFunctionComponent[_componentName2] = true; + didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true; } } } @@ -12332,7 +12374,7 @@ if (__DEV__) { renderClassComponent(request, task, keyPath, type, props); return; } else { - renderFunctionComponent(request, task, keyPath, type, props); + renderIndeterminateComponent(request, task, keyPath, type, props); return; } } diff --git a/compiled/facebook-www/ReactDOMServer-dev.modern.js b/compiled/facebook-www/ReactDOMServer-dev.modern.js index e7b67c800ad45..4c5f64d8c9571 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-0c510bed"; + var ReactVersion = "19.0.0-www-modern-94ca9b1f"; // This refers to a WWW module. var warningWWW = require("warning"); @@ -11889,14 +11889,22 @@ if (__DEV__) { } var didWarnAboutBadClass = {}; + var didWarnAboutModulePatternComponent = {}; var didWarnAboutContextTypeOnFunctionComponent = {}; var didWarnAboutGetDerivedStateOnFunctionComponent = {}; var didWarnAboutReassigningProps = false; var didWarnAboutDefaultPropsOnFunctionComponent = {}; var didWarnAboutGenerators = false; - var didWarnAboutMaps = false; + var didWarnAboutMaps = false; // This would typically be a function component but we still support module pattern + // components for some reason. - function renderFunctionComponent(request, task, keyPath, Component, props) { + function renderIndeterminateComponent( + request, + task, + keyPath, + Component, + props + ) { var legacyContext; var previousComponentStack = task.componentStack; @@ -11935,28 +11943,60 @@ if (__DEV__) { var actionStateMatchingIndex = getActionStateMatchingIndex(); { - if (Component.contextTypes) { - error( - "%s uses the legacy contextTypes API which was removed in React 19. " + - "Use React.createContext() with React.useContext() instead.", - getComponentNameFromType(Component) || "Unknown" - ); + // Support for module components is deprecated and is removed behind a flag. + // Whether or not it would crash later, we want to show a good message in DEV first. + if ( + typeof value === "object" && + value !== null && + typeof value.render === "function" && + value.$$typeof === undefined + ) { + var _componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutModulePatternComponent[_componentName]) { + error( + "The <%s /> component appears to be a function component that returns a class instance. " + + "Change %s to a class that extends React.Component instead. " + + "If you can't use a class try assigning the prototype on the function as a workaround. " + + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + + "cannot be called with `new` by React.", + _componentName, + _componentName, + _componentName + ); + + didWarnAboutModulePatternComponent[_componentName] = true; + } } } { - validateFunctionComponentInDev(Component); + // Proceed under the assumption that this is a function component + { + if (Component.contextTypes) { + error( + "%s uses the legacy contextTypes API which was removed in React 19. " + + "Use React.createContext() with React.useContext() instead.", + getComponentNameFromType(Component) || "Unknown" + ); + } + } + + { + validateFunctionComponentInDev(Component); + } + + finishFunctionComponent( + request, + task, + keyPath, + value, + hasId, + actionStateCount, + actionStateMatchingIndex + ); } - finishFunctionComponent( - request, - task, - keyPath, - value, - hasId, - actionStateCount, - actionStateMatchingIndex - ); task.componentStack = previousComponentStack; } @@ -12054,15 +12094,18 @@ if (__DEV__) { } if (typeof Component.getDerivedStateFromProps === "function") { - var _componentName = getComponentNameFromType(Component) || "Unknown"; + var _componentName3 = + getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName]) { + if ( + !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] + ) { error( "%s: Function components do not support getDerivedStateFromProps.", - _componentName + _componentName3 ); - didWarnAboutGetDerivedStateOnFunctionComponent[_componentName] = + didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] = true; } } @@ -12071,16 +12114,16 @@ if (__DEV__) { typeof Component.contextType === "object" && Component.contextType !== null ) { - var _componentName2 = + var _componentName4 = getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutContextTypeOnFunctionComponent[_componentName2]) { + if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) { error( "%s: Function components do not support contextType.", - _componentName2 + _componentName4 ); - didWarnAboutContextTypeOnFunctionComponent[_componentName2] = true; + didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true; } } } @@ -12241,7 +12284,7 @@ if (__DEV__) { renderClassComponent(request, task, keyPath, type, props); return; } else { - renderFunctionComponent(request, task, keyPath, type, props); + renderIndeterminateComponent(request, task, keyPath, type, props); return; } } diff --git a/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js b/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js index 54d0f21920e07..894054d84f4be 100644 --- a/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js +++ b/compiled/facebook-www/ReactDOMServerStreaming-dev.modern.js @@ -11770,14 +11770,22 @@ if (__DEV__) { } var didWarnAboutBadClass = {}; + var didWarnAboutModulePatternComponent = {}; var didWarnAboutContextTypeOnFunctionComponent = {}; var didWarnAboutGetDerivedStateOnFunctionComponent = {}; var didWarnAboutReassigningProps = false; var didWarnAboutDefaultPropsOnFunctionComponent = {}; var didWarnAboutGenerators = false; - var didWarnAboutMaps = false; + var didWarnAboutMaps = false; // This would typically be a function component but we still support module pattern + // components for some reason. - function renderFunctionComponent(request, task, keyPath, Component, props) { + function renderIndeterminateComponent( + request, + task, + keyPath, + Component, + props + ) { var legacyContext; var previousComponentStack = task.componentStack; @@ -11816,28 +11824,60 @@ if (__DEV__) { var actionStateMatchingIndex = getActionStateMatchingIndex(); { - if (Component.contextTypes) { - error( - "%s uses the legacy contextTypes API which was removed in React 19. " + - "Use React.createContext() with React.useContext() instead.", - getComponentNameFromType(Component) || "Unknown" - ); + // Support for module components is deprecated and is removed behind a flag. + // Whether or not it would crash later, we want to show a good message in DEV first. + if ( + typeof value === "object" && + value !== null && + typeof value.render === "function" && + value.$$typeof === undefined + ) { + var _componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutModulePatternComponent[_componentName]) { + error( + "The <%s /> component appears to be a function component that returns a class instance. " + + "Change %s to a class that extends React.Component instead. " + + "If you can't use a class try assigning the prototype on the function as a workaround. " + + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + + "cannot be called with `new` by React.", + _componentName, + _componentName, + _componentName + ); + + didWarnAboutModulePatternComponent[_componentName] = true; + } } } { - validateFunctionComponentInDev(Component); + // Proceed under the assumption that this is a function component + { + if (Component.contextTypes) { + error( + "%s uses the legacy contextTypes API which was removed in React 19. " + + "Use React.createContext() with React.useContext() instead.", + getComponentNameFromType(Component) || "Unknown" + ); + } + } + + { + validateFunctionComponentInDev(Component); + } + + finishFunctionComponent( + request, + task, + keyPath, + value, + hasId, + actionStateCount, + actionStateMatchingIndex + ); } - finishFunctionComponent( - request, - task, - keyPath, - value, - hasId, - actionStateCount, - actionStateMatchingIndex - ); task.componentStack = previousComponentStack; } @@ -11935,15 +11975,18 @@ if (__DEV__) { } if (typeof Component.getDerivedStateFromProps === "function") { - var _componentName = getComponentNameFromType(Component) || "Unknown"; + var _componentName3 = + getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName]) { + if ( + !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] + ) { error( "%s: Function components do not support getDerivedStateFromProps.", - _componentName + _componentName3 ); - didWarnAboutGetDerivedStateOnFunctionComponent[_componentName] = + didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] = true; } } @@ -11952,16 +11995,16 @@ if (__DEV__) { typeof Component.contextType === "object" && Component.contextType !== null ) { - var _componentName2 = + var _componentName4 = getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutContextTypeOnFunctionComponent[_componentName2]) { + if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) { error( "%s: Function components do not support contextType.", - _componentName2 + _componentName4 ); - didWarnAboutContextTypeOnFunctionComponent[_componentName2] = true; + didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true; } } } @@ -12122,7 +12165,7 @@ if (__DEV__) { renderClassComponent(request, task, keyPath, type, props); return; } else { - renderFunctionComponent(request, task, keyPath, type, props); + renderIndeterminateComponent(request, task, keyPath, type, props); return; } } diff --git a/compiled/facebook-www/ReactDOMTesting-dev.classic.js b/compiled/facebook-www/ReactDOMTesting-dev.classic.js index c5c96fadb60cf..3e6ad62225884 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.classic.js @@ -159,6 +159,8 @@ if (__DEV__) { var FunctionComponent = 0; var ClassComponent = 1; + var IndeterminateComponent = 2; // Before we know whether it is function or class + var HostRoot = 3; // Root of a host tree. Could be nested inside another node. var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. @@ -461,6 +463,7 @@ if (__DEV__) { case ClassComponent: case FunctionComponent: case IncompleteClassComponent: + case IndeterminateComponent: case MemoComponent: case SimpleMemoComponent: if (typeof type === "function") { @@ -3853,6 +3856,7 @@ if (__DEV__) { return describeBuiltInComponentFrame("SuspenseList"); case FunctionComponent: + case IndeterminateComponent: case SimpleMemoComponent: return describeFunctionComponentFrame(fiber.type); @@ -8326,6 +8330,7 @@ if (__DEV__) { return "SuspenseList"; case FunctionComponent: + case IndeterminateComponent: case SimpleMemoComponent: var fn = fiber.type; return fn.displayName || fn.name || null; @@ -18691,6 +18696,17 @@ if (__DEV__) { } } + function adoptClassInstance(workInProgress, instance) { + instance.updater = classComponentUpdater; + workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates + + set(instance, workInProgress); + + { + instance._reactInternalInstance = fakeInternalInstance; + } + } + function constructClassInstance(workInProgress, ctor, props) { var isLegacyContextConsumer = false; var unmaskedContext = emptyContextObject; @@ -18766,14 +18782,7 @@ if (__DEV__) { instance.state !== null && instance.state !== undefined ? instance.state : null); - instance.updater = classComponentUpdater; - workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates - - set(instance, workInProgress); - - { - instance._reactInternalInstance = fakeInternalInstance; - } + adoptClassInstance(workInProgress, instance); { if ( @@ -20320,6 +20329,7 @@ if (__DEV__) { ); var didReceiveUpdate = false; var didWarnAboutBadClass; + var didWarnAboutModulePatternComponent; var didWarnAboutContextTypeOnFunctionComponent; var didWarnAboutGetDerivedStateOnFunctionComponent; var didWarnAboutFunctionRefs; @@ -20330,6 +20340,7 @@ if (__DEV__) { { didWarnAboutBadClass = {}; + didWarnAboutModulePatternComponent = {}; didWarnAboutContextTypeOnFunctionComponent = {}; didWarnAboutGetDerivedStateOnFunctionComponent = {}; didWarnAboutFunctionRefs = {}; @@ -21054,39 +21065,6 @@ if (__DEV__) { nextProps, renderLanes ) { - { - if ( - Component.prototype && - typeof Component.prototype.render === "function" - ) { - var componentName = getComponentNameFromType(Component) || "Unknown"; - - if (!didWarnAboutBadClass[componentName]) { - error( - "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + - "This is likely to cause errors. Change %s to extend React.Component instead.", - componentName, - componentName - ); - - didWarnAboutBadClass[componentName] = true; - } - } - - if (workInProgress.mode & StrictLegacyMode) { - ReactStrictModeWarnings.recordLegacyContextWarning( - workInProgress, - null - ); - } - - if (current === null) { - // Some validations were previously done in mountIndeterminateComponent however and are now run - // in updateFuntionComponent but only on mount - validateFunctionComponentInDev(workInProgress, workInProgress.type); - } - } - var context; { @@ -21731,68 +21709,70 @@ if (__DEV__) { var Component = init(payload); // Store the unwrapped component in the type. workInProgress.type = Component; + var resolvedTag = (workInProgress.tag = + resolveLazyComponentTag(Component)); var resolvedProps = resolveDefaultProps(Component, props); + var child; - if (typeof Component === "function") { - if (isFunctionClassComponent(Component)) { - workInProgress.tag = ClassComponent; - + switch (resolvedTag) { + case FunctionComponent: { { + validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = - resolveClassForHotReloading(Component); + resolveFunctionForHotReloading(Component); } - return updateClassComponent( + child = updateFunctionComponent( null, workInProgress, Component, resolvedProps, renderLanes ); - } else { - workInProgress.tag = FunctionComponent; + return child; + } + case ClassComponent: { { - validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = - resolveFunctionForHotReloading(Component); + resolveClassForHotReloading(Component); } - return updateFunctionComponent( + child = updateClassComponent( null, workInProgress, Component, resolvedProps, renderLanes ); + return child; } - } else if (Component !== undefined && Component !== null) { - var $$typeof = Component.$$typeof; - - if ($$typeof === REACT_FORWARD_REF_TYPE) { - workInProgress.tag = ForwardRef; + case ForwardRef: { { workInProgress.type = Component = resolveForwardRefForHotReloading(Component); } - return updateForwardRef( + child = updateForwardRef( null, workInProgress, Component, resolvedProps, renderLanes ); - } else if ($$typeof === REACT_MEMO_TYPE) { - workInProgress.tag = MemoComponent; - return updateMemoComponent( + return child; + } + + case MemoComponent: { + child = updateMemoComponent( null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too renderLanes ); + return child; } } @@ -21854,6 +21834,125 @@ if (__DEV__) { ); } + function mountIndeterminateComponent( + _current, + workInProgress, + Component, + renderLanes + ) { + resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress); + var props = workInProgress.pendingProps; + var context; + + { + var unmaskedContext = getUnmaskedContext( + workInProgress, + Component, + false + ); + context = getMaskedContext(workInProgress, unmaskedContext); + } + + prepareToReadContext(workInProgress, renderLanes); + var value; + var hasId; + + if (enableSchedulingProfiler) { + markComponentRenderStarted(workInProgress); + } + + { + if ( + Component.prototype && + typeof Component.prototype.render === "function" + ) { + var componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutBadClass[componentName]) { + error( + "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + + "This is likely to cause errors. Change %s to extend React.Component instead.", + componentName, + componentName + ); + + didWarnAboutBadClass[componentName] = true; + } + } + + if (workInProgress.mode & StrictLegacyMode) { + ReactStrictModeWarnings.recordLegacyContextWarning( + workInProgress, + null + ); + } + + setIsRendering(true); + ReactCurrentOwner$2.current = workInProgress; + value = renderWithHooks( + null, + workInProgress, + Component, + props, + context, + renderLanes + ); + hasId = checkDidRenderIdHook(); + setIsRendering(false); + } + + if (enableSchedulingProfiler) { + markComponentRenderStopped(); + } // React DevTools reads this flag. + + workInProgress.flags |= PerformedWork; + + { + // Support for module components is deprecated and is removed behind a flag. + // Whether or not it would crash later, we want to show a good message in DEV first. + if ( + typeof value === "object" && + value !== null && + typeof value.render === "function" && + value.$$typeof === undefined + ) { + var _componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutModulePatternComponent[_componentName]) { + error( + "The <%s /> component appears to be a function component that returns a class instance. " + + "Change %s to a class that extends React.Component instead. " + + "If you can't use a class try assigning the prototype on the function as a workaround. " + + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + + "cannot be called with `new` by React.", + _componentName, + _componentName, + _componentName + ); + + didWarnAboutModulePatternComponent[_componentName] = true; + } + } + } + + { + // Proceed under the assumption that this is a function component + workInProgress.tag = FunctionComponent; + + if (getIsHydrating() && hasId) { + pushMaterializedTreeId(workInProgress); + } + + reconcileChildren(null, workInProgress, value, renderLanes); + + { + validateFunctionComponentInDev(workInProgress, Component); + } + + return workInProgress.child; + } + } + function validateFunctionComponentInDev(workInProgress, Component) { { if (Component) { @@ -21890,32 +21989,33 @@ if (__DEV__) { } if (Component.defaultProps !== undefined) { - var _componentName = getComponentNameFromType(Component) || "Unknown"; + var _componentName3 = + getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName]) { + if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName3]) { error( "%s: Support for defaultProps will be removed from function components " + "in a future major release. Use JavaScript default parameters instead.", - _componentName + _componentName3 ); - didWarnAboutDefaultPropsOnFunctionComponent[_componentName] = true; + didWarnAboutDefaultPropsOnFunctionComponent[_componentName3] = true; } } if (typeof Component.getDerivedStateFromProps === "function") { - var _componentName2 = + var _componentName4 = getComponentNameFromType(Component) || "Unknown"; if ( - !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] + !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] ) { error( "%s: Function components do not support getDerivedStateFromProps.", - _componentName2 + _componentName4 ); - didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = + didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] = true; } } @@ -21924,16 +22024,16 @@ if (__DEV__) { typeof Component.contextType === "object" && Component.contextType !== null ) { - var _componentName3 = + var _componentName5 = getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) { + if (!didWarnAboutContextTypeOnFunctionComponent[_componentName5]) { error( "%s: Function components do not support contextType.", - _componentName3 + _componentName5 ); - didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true; + didWarnAboutContextTypeOnFunctionComponent[_componentName5] = true; } } } @@ -23891,6 +23991,15 @@ if (__DEV__) { workInProgress.lanes = NoLanes; switch (workInProgress.tag) { + case IndeterminateComponent: { + return mountIndeterminateComponent( + current, + workInProgress, + workInProgress.type, + renderLanes + ); + } + case LazyComponent: { var elementType = workInProgress.elementType; return mountLazyComponent( @@ -25678,6 +25787,7 @@ if (__DEV__) { popTreeContext(workInProgress); switch (workInProgress.tag) { + case IndeterminateComponent: case LazyComponent: case SimpleMemoComponent: case FunctionComponent: @@ -33899,6 +34009,12 @@ if (__DEV__) { } switch (unitOfWork.tag) { + case IndeterminateComponent: { + // Because it suspended with `use`, we can assume it's a + // function component. + unitOfWork.tag = FunctionComponent; // Fallthrough to the next branch. + } + case SimpleMemoComponent: case FunctionComponent: { // Resolve `defaultProps`. This logic is copied from `beginWork`. @@ -35319,6 +35435,7 @@ if (__DEV__) { var tag = fiber.tag; if ( + tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && @@ -36117,8 +36234,22 @@ if (__DEV__) { type.defaultProps === undefined ); } - function isFunctionClassComponent(type) { - return shouldConstruct(type); + function resolveLazyComponentTag(Component) { + if (typeof Component === "function") { + return shouldConstruct(Component) ? ClassComponent : FunctionComponent; + } else if (Component !== undefined && Component !== null) { + var $$typeof = Component.$$typeof; + + if ($$typeof === REACT_FORWARD_REF_TYPE) { + return ForwardRef; + } + + if ($$typeof === REACT_MEMO_TYPE) { + return MemoComponent; + } + } + + return IndeterminateComponent; } // This is used to create an alternate fiber to do work on. function createWorkInProgress(current, pendingProps) { @@ -36203,6 +36334,7 @@ if (__DEV__) { workInProgress._debugNeedsRemount = current._debugNeedsRemount; switch (workInProgress.tag) { + case IndeterminateComponent: case FunctionComponent: case SimpleMemoComponent: workInProgress.type = resolveFunctionForHotReloading(current.type); @@ -36328,7 +36460,7 @@ if (__DEV__) { mode, lanes ) { - var fiberTag = FunctionComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. + var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. var resolvedType = type; @@ -36843,7 +36975,7 @@ if (__DEV__) { return root; } - var ReactVersion = "19.0.0-www-classic-800b32fb"; + var ReactVersion = "19.0.0-www-classic-f2c3cec0"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOMTesting-dev.modern.js b/compiled/facebook-www/ReactDOMTesting-dev.modern.js index ee36d016ec5b0..319634c38856e 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.modern.js @@ -2372,6 +2372,8 @@ if (__DEV__) { var FunctionComponent = 0; var ClassComponent = 1; + var IndeterminateComponent = 2; // Before we know whether it is function or class + var HostRoot = 3; // Root of a host tree. Could be nested inside another node. var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. @@ -3456,6 +3458,7 @@ if (__DEV__) { return describeBuiltInComponentFrame("SuspenseList"); case FunctionComponent: + case IndeterminateComponent: case SimpleMemoComponent: return describeFunctionComponentFrame(fiber.type); @@ -3734,6 +3737,7 @@ if (__DEV__) { case ClassComponent: case FunctionComponent: case IncompleteClassComponent: + case IndeterminateComponent: case MemoComponent: case SimpleMemoComponent: if (typeof type === "function") { @@ -8289,6 +8293,7 @@ if (__DEV__) { return "SuspenseList"; case FunctionComponent: + case IndeterminateComponent: case SimpleMemoComponent: var fn = fiber.type; return fn.displayName || fn.name || null; @@ -18646,6 +18651,17 @@ if (__DEV__) { } } + function adoptClassInstance(workInProgress, instance) { + instance.updater = classComponentUpdater; + workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates + + set(instance, workInProgress); + + { + instance._reactInternalInstance = fakeInternalInstance; + } + } + function constructClassInstance(workInProgress, ctor, props) { var context = emptyContextObject; var contextType = ctor.contextType; @@ -18711,14 +18727,7 @@ if (__DEV__) { instance.state !== null && instance.state !== undefined ? instance.state : null); - instance.updater = classComponentUpdater; - workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates - - set(instance, workInProgress); - - { - instance._reactInternalInstance = fakeInternalInstance; - } + adoptClassInstance(workInProgress, instance); { if ( @@ -20242,6 +20251,7 @@ if (__DEV__) { ); var didReceiveUpdate = false; var didWarnAboutBadClass; + var didWarnAboutModulePatternComponent; var didWarnAboutContextTypeOnFunctionComponent; var didWarnAboutGetDerivedStateOnFunctionComponent; var didWarnAboutFunctionRefs; @@ -20252,6 +20262,7 @@ if (__DEV__) { { didWarnAboutBadClass = {}; + didWarnAboutModulePatternComponent = {}; didWarnAboutContextTypeOnFunctionComponent = {}; didWarnAboutGetDerivedStateOnFunctionComponent = {}; didWarnAboutFunctionRefs = {}; @@ -20976,47 +20987,6 @@ if (__DEV__) { nextProps, renderLanes ) { - { - if ( - Component.prototype && - typeof Component.prototype.render === "function" - ) { - var componentName = getComponentNameFromType(Component) || "Unknown"; - - if (!didWarnAboutBadClass[componentName]) { - error( - "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + - "This is likely to cause errors. Change %s to extend React.Component instead.", - componentName, - componentName - ); - - didWarnAboutBadClass[componentName] = true; - } - } - - if (workInProgress.mode & StrictLegacyMode) { - ReactStrictModeWarnings.recordLegacyContextWarning( - workInProgress, - null - ); - } - - if (current === null) { - // Some validations were previously done in mountIndeterminateComponent however and are now run - // in updateFuntionComponent but only on mount - validateFunctionComponentInDev(workInProgress, workInProgress.type); - - if (Component.contextTypes) { - error( - "%s uses the legacy contextTypes API which was removed in React 19. " + - "Use React.createContext() with React.useContext() instead.", - getComponentNameFromType(Component) || "Unknown" - ); - } - } - } - var context; var nextChildren; @@ -21631,68 +21601,70 @@ if (__DEV__) { var Component = init(payload); // Store the unwrapped component in the type. workInProgress.type = Component; + var resolvedTag = (workInProgress.tag = + resolveLazyComponentTag(Component)); var resolvedProps = resolveDefaultProps(Component, props); + var child; - if (typeof Component === "function") { - if (isFunctionClassComponent(Component)) { - workInProgress.tag = ClassComponent; - + switch (resolvedTag) { + case FunctionComponent: { { + validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = - resolveClassForHotReloading(Component); + resolveFunctionForHotReloading(Component); } - return updateClassComponent( + child = updateFunctionComponent( null, workInProgress, Component, resolvedProps, renderLanes ); - } else { - workInProgress.tag = FunctionComponent; + return child; + } + case ClassComponent: { { - validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = - resolveFunctionForHotReloading(Component); + resolveClassForHotReloading(Component); } - return updateFunctionComponent( + child = updateClassComponent( null, workInProgress, Component, resolvedProps, renderLanes ); + return child; } - } else if (Component !== undefined && Component !== null) { - var $$typeof = Component.$$typeof; - - if ($$typeof === REACT_FORWARD_REF_TYPE) { - workInProgress.tag = ForwardRef; + case ForwardRef: { { workInProgress.type = Component = resolveForwardRefForHotReloading(Component); } - return updateForwardRef( + child = updateForwardRef( null, workInProgress, Component, resolvedProps, renderLanes ); - } else if ($$typeof === REACT_MEMO_TYPE) { - workInProgress.tag = MemoComponent; - return updateMemoComponent( + return child; + } + + case MemoComponent: { + child = updateMemoComponent( null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too renderLanes ); + return child; } } @@ -21753,6 +21725,126 @@ if (__DEV__) { ); } + function mountIndeterminateComponent( + _current, + workInProgress, + Component, + renderLanes + ) { + resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress); + var props = workInProgress.pendingProps; + var context; + + prepareToReadContext(workInProgress, renderLanes); + var value; + var hasId; + + if (enableSchedulingProfiler) { + markComponentRenderStarted(workInProgress); + } + + { + if ( + Component.prototype && + typeof Component.prototype.render === "function" + ) { + var componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutBadClass[componentName]) { + error( + "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + + "This is likely to cause errors. Change %s to extend React.Component instead.", + componentName, + componentName + ); + + didWarnAboutBadClass[componentName] = true; + } + } + + if (workInProgress.mode & StrictLegacyMode) { + ReactStrictModeWarnings.recordLegacyContextWarning( + workInProgress, + null + ); + } + + setIsRendering(true); + ReactCurrentOwner$2.current = workInProgress; + value = renderWithHooks( + null, + workInProgress, + Component, + props, + context, + renderLanes + ); + hasId = checkDidRenderIdHook(); + setIsRendering(false); + } + + if (enableSchedulingProfiler) { + markComponentRenderStopped(); + } // React DevTools reads this flag. + + workInProgress.flags |= PerformedWork; + + { + // Support for module components is deprecated and is removed behind a flag. + // Whether or not it would crash later, we want to show a good message in DEV first. + if ( + typeof value === "object" && + value !== null && + typeof value.render === "function" && + value.$$typeof === undefined + ) { + var _componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutModulePatternComponent[_componentName]) { + error( + "The <%s /> component appears to be a function component that returns a class instance. " + + "Change %s to a class that extends React.Component instead. " + + "If you can't use a class try assigning the prototype on the function as a workaround. " + + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + + "cannot be called with `new` by React.", + _componentName, + _componentName, + _componentName + ); + + didWarnAboutModulePatternComponent[_componentName] = true; + } + } + } + + { + // Proceed under the assumption that this is a function component + workInProgress.tag = FunctionComponent; + + { + if (Component.contextTypes) { + error( + "%s uses the legacy contextTypes API which was removed in React 19. " + + "Use React.createContext() with React.useContext() instead.", + getComponentNameFromType(Component) || "Unknown" + ); + } + } + + if (getIsHydrating() && hasId) { + pushMaterializedTreeId(workInProgress); + } + + reconcileChildren(null, workInProgress, value, renderLanes); + + { + validateFunctionComponentInDev(workInProgress, Component); + } + + return workInProgress.child; + } + } + function validateFunctionComponentInDev(workInProgress, Component) { { if (Component) { @@ -21789,32 +21881,33 @@ if (__DEV__) { } if (Component.defaultProps !== undefined) { - var _componentName = getComponentNameFromType(Component) || "Unknown"; + var _componentName3 = + getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName]) { + if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName3]) { error( "%s: Support for defaultProps will be removed from function components " + "in a future major release. Use JavaScript default parameters instead.", - _componentName + _componentName3 ); - didWarnAboutDefaultPropsOnFunctionComponent[_componentName] = true; + didWarnAboutDefaultPropsOnFunctionComponent[_componentName3] = true; } } if (typeof Component.getDerivedStateFromProps === "function") { - var _componentName2 = + var _componentName4 = getComponentNameFromType(Component) || "Unknown"; if ( - !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] + !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] ) { error( "%s: Function components do not support getDerivedStateFromProps.", - _componentName2 + _componentName4 ); - didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = + didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] = true; } } @@ -21823,16 +21916,16 @@ if (__DEV__) { typeof Component.contextType === "object" && Component.contextType !== null ) { - var _componentName3 = + var _componentName5 = getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) { + if (!didWarnAboutContextTypeOnFunctionComponent[_componentName5]) { error( "%s: Function components do not support contextType.", - _componentName3 + _componentName5 ); - didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true; + didWarnAboutContextTypeOnFunctionComponent[_componentName5] = true; } } } @@ -23784,6 +23877,15 @@ if (__DEV__) { workInProgress.lanes = NoLanes; switch (workInProgress.tag) { + case IndeterminateComponent: { + return mountIndeterminateComponent( + current, + workInProgress, + workInProgress.type, + renderLanes + ); + } + case LazyComponent: { var elementType = workInProgress.elementType; return mountLazyComponent( @@ -25571,6 +25673,7 @@ if (__DEV__) { popTreeContext(workInProgress); switch (workInProgress.tag) { + case IndeterminateComponent: case LazyComponent: case SimpleMemoComponent: case FunctionComponent: @@ -33763,6 +33866,12 @@ if (__DEV__) { } switch (unitOfWork.tag) { + case IndeterminateComponent: { + // Because it suspended with `use`, we can assume it's a + // function component. + unitOfWork.tag = FunctionComponent; // Fallthrough to the next branch. + } + case SimpleMemoComponent: case FunctionComponent: { // Resolve `defaultProps`. This logic is copied from `beginWork`. @@ -35174,6 +35283,7 @@ if (__DEV__) { var tag = fiber.tag; if ( + tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && @@ -35972,8 +36082,22 @@ if (__DEV__) { type.defaultProps === undefined ); } - function isFunctionClassComponent(type) { - return shouldConstruct(type); + function resolveLazyComponentTag(Component) { + if (typeof Component === "function") { + return shouldConstruct(Component) ? ClassComponent : FunctionComponent; + } else if (Component !== undefined && Component !== null) { + var $$typeof = Component.$$typeof; + + if ($$typeof === REACT_FORWARD_REF_TYPE) { + return ForwardRef; + } + + if ($$typeof === REACT_MEMO_TYPE) { + return MemoComponent; + } + } + + return IndeterminateComponent; } // This is used to create an alternate fiber to do work on. function createWorkInProgress(current, pendingProps) { @@ -36058,6 +36182,7 @@ if (__DEV__) { workInProgress._debugNeedsRemount = current._debugNeedsRemount; switch (workInProgress.tag) { + case IndeterminateComponent: case FunctionComponent: case SimpleMemoComponent: workInProgress.type = resolveFunctionForHotReloading(current.type); @@ -36183,7 +36308,7 @@ if (__DEV__) { mode, lanes ) { - var fiberTag = FunctionComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. + var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. var resolvedType = type; @@ -36698,7 +36823,7 @@ if (__DEV__) { return root; } - var ReactVersion = "19.0.0-www-modern-81c6e617"; + var ReactVersion = "19.0.0-www-modern-eccc0e12"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOMTesting-prod.classic.js b/compiled/facebook-www/ReactDOMTesting-prod.classic.js index e704b48d64391..ab958d21a02cd 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.classic.js @@ -211,6 +211,7 @@ function getComponentNameFromFiber(fiber) { case 1: case 0: case 17: + case 2: case 14: case 15: if ("function" === typeof type) @@ -1076,6 +1077,7 @@ function describeFiber(fiber) { case 19: return describeBuiltInComponentFrame("SuspenseList"); case 0: + case 2: case 15: return (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; case 11: @@ -6709,91 +6711,110 @@ function beginWork(current, workInProgress, renderLanes) { pushTreeId(workInProgress, treeForkCount, workInProgress.index); workInProgress.lanes = 0; switch (workInProgress.tag) { + case 2: + var Component = workInProgress.type; + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + var context = getMaskedContext( + workInProgress, + contextStackCursor.current + ); + prepareToReadContext(workInProgress, renderLanes); + current = renderWithHooks( + null, + workInProgress, + Component, + current, + context, + renderLanes + ); + Component = checkDidRenderIdHook(); + workInProgress.flags |= 1; + workInProgress.tag = 0; + isHydrating && Component && pushMaterializedTreeId(workInProgress); + reconcileChildren(null, workInProgress, current, renderLanes); + workInProgress = workInProgress.child; + return workInProgress; case 16: - var elementType = workInProgress.elementType; + Component = workInProgress.elementType; a: { resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); current = workInProgress.pendingProps; - var init = elementType._init; - elementType = init(elementType._payload); - workInProgress.type = elementType; - current = resolveDefaultProps(elementType, current); - if ("function" === typeof elementType) - shouldConstruct(elementType) - ? ((workInProgress.tag = 1), - (workInProgress = updateClassComponent( - null, - workInProgress, - elementType, - current, - renderLanes - ))) - : ((workInProgress.tag = 0), - (workInProgress = updateFunctionComponent( - null, - workInProgress, - elementType, - current, - renderLanes - ))); - else { - if (void 0 !== elementType && null !== elementType) - if ( - ((init = elementType.$$typeof), init === REACT_FORWARD_REF_TYPE) - ) { - workInProgress.tag = 11; - workInProgress = updateForwardRef( - null, - workInProgress, - elementType, - current, - renderLanes - ); - break a; - } else if (init === REACT_MEMO_TYPE) { - workInProgress.tag = 14; - workInProgress = updateMemoComponent( - null, - workInProgress, - elementType, - resolveDefaultProps(elementType.type, current), - renderLanes - ); - break a; - } - throw Error(formatProdErrorMessage(306, elementType, "")); + context = Component._init; + Component = context(Component._payload); + workInProgress.type = Component; + context = workInProgress.tag = resolveLazyComponentTag(Component); + current = resolveDefaultProps(Component, current); + switch (context) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + Component, + resolveDefaultProps(Component.type, current), + renderLanes + ); + break a; } + throw Error(formatProdErrorMessage(306, Component, "")); } return workInProgress; case 0: return ( - (elementType = workInProgress.type), - (init = workInProgress.pendingProps), - (init = - workInProgress.elementType === elementType - ? init - : resolveDefaultProps(elementType, init)), + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), updateFunctionComponent( current, workInProgress, - elementType, - init, + Component, + context, renderLanes ) ); case 1: return ( - (elementType = workInProgress.type), - (init = workInProgress.pendingProps), - (init = - workInProgress.elementType === elementType - ? init - : resolveDefaultProps(elementType, init)), + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), updateClassComponent( current, workInProgress, - elementType, - init, + Component, + context, renderLanes ) ); @@ -6801,25 +6822,25 @@ function beginWork(current, workInProgress, renderLanes) { a: { pushHostRootContext(workInProgress); if (null === current) throw Error(formatProdErrorMessage(387)); - init = workInProgress.pendingProps; + context = workInProgress.pendingProps; var prevState = workInProgress.memoizedState; - elementType = prevState.element; + Component = prevState.element; cloneUpdateQueue(current, workInProgress); - processUpdateQueue(workInProgress, init, null, renderLanes); + processUpdateQueue(workInProgress, context, null, renderLanes); var nextState = workInProgress.memoizedState; enableTransitionTracing && push(transitionStack, workInProgressTransitions); enableTransitionTracing && pushRootMarkerInstance(workInProgress); - init = nextState.cache; - pushProvider(workInProgress, CacheContext, init); - init !== prevState.cache && + context = nextState.cache; + pushProvider(workInProgress, CacheContext, context); + context !== prevState.cache && propagateContextChange(workInProgress, CacheContext, renderLanes); suspendIfUpdateReadFromEntangledAsyncAction(); - init = nextState.element; + context = nextState.element; if (prevState.isDehydrated) if ( ((prevState = { - element: init, + element: context, isDehydrated: !1, cache: nextState.cache }), @@ -6827,29 +6848,29 @@ function beginWork(current, workInProgress, renderLanes) { (workInProgress.memoizedState = prevState), workInProgress.flags & 256) ) { - elementType = createCapturedValueAtFiber( + Component = createCapturedValueAtFiber( Error(formatProdErrorMessage(423)), workInProgress ); workInProgress = mountHostRootWithoutHydrating( current, workInProgress, - init, + context, renderLanes, - elementType + Component ); break a; - } else if (init !== elementType) { - elementType = createCapturedValueAtFiber( + } else if (context !== Component) { + Component = createCapturedValueAtFiber( Error(formatProdErrorMessage(424)), workInProgress ); workInProgress = mountHostRootWithoutHydrating( current, workInProgress, - init, + context, renderLanes, - elementType + Component ); break a; } else @@ -6864,7 +6885,7 @@ function beginWork(current, workInProgress, renderLanes) { renderLanes = mountChildFibers( workInProgress, null, - init, + context, renderLanes ), workInProgress.child = renderLanes; @@ -6875,7 +6896,7 @@ function beginWork(current, workInProgress, renderLanes) { (renderLanes = renderLanes.sibling); else { resetHydrationState(); - if (init === elementType) { + if (context === Component) { workInProgress = bailoutOnAlreadyFinishedWork( current, workInProgress, @@ -6883,7 +6904,7 @@ function beginWork(current, workInProgress, renderLanes) { ); break a; } - reconcileChildren(current, workInProgress, init, renderLanes); + reconcileChildren(current, workInProgress, context, renderLanes); } workInProgress = workInProgress.child; } @@ -6902,14 +6923,14 @@ function beginWork(current, workInProgress, renderLanes) { null !== renderLanes || ((renderLanes = workInProgress.type), (current = workInProgress.pendingProps), - (elementType = getOwnerDocumentFromRootContainer( + (Component = getOwnerDocumentFromRootContainer( rootInstanceStackCursor.current ).createElement(renderLanes)), - (elementType[internalInstanceKey] = workInProgress), - (elementType[internalPropsKey] = current), - setInitialProperties(elementType, renderLanes, current), - markNodeAsHoistable(elementType), - (workInProgress.stateNode = elementType)), + (Component[internalInstanceKey] = workInProgress), + (Component[internalPropsKey] = current), + setInitialProperties(Component, renderLanes, current), + markNodeAsHoistable(Component), + (workInProgress.stateNode = Component)), null ); case 27: @@ -6917,7 +6938,7 @@ function beginWork(current, workInProgress, renderLanes) { pushHostContext(workInProgress), null === current && isHydrating && - ((elementType = workInProgress.stateNode = + ((Component = workInProgress.stateNode = resolveSingletonInstance( workInProgress.type, workInProgress.pendingProps, @@ -6925,14 +6946,14 @@ function beginWork(current, workInProgress, renderLanes) { )), (hydrationParentFiber = workInProgress), (rootOrSingletonContext = !0), - (nextHydratableInstance = getNextHydratable(elementType.firstChild))), - (elementType = workInProgress.pendingProps.children), + (nextHydratableInstance = getNextHydratable(Component.firstChild))), + (Component = workInProgress.pendingProps.children), null !== current || isHydrating - ? reconcileChildren(current, workInProgress, elementType, renderLanes) + ? reconcileChildren(current, workInProgress, Component, renderLanes) : (workInProgress.child = reconcileChildFibers( workInProgress, null, - elementType, + Component, renderLanes )), markRef(current, workInProgress), @@ -6940,36 +6961,36 @@ function beginWork(current, workInProgress, renderLanes) { ); case 5: if (null === current && isHydrating) { - if ((init = elementType = nextHydratableInstance)) - (elementType = canHydrateInstance( - elementType, + if ((context = Component = nextHydratableInstance)) + (Component = canHydrateInstance( + Component, workInProgress.type, workInProgress.pendingProps, rootOrSingletonContext )), - null !== elementType - ? ((workInProgress.stateNode = elementType), + null !== Component + ? ((workInProgress.stateNode = Component), (hydrationParentFiber = workInProgress), (nextHydratableInstance = getNextHydratable( - elementType.firstChild + Component.firstChild )), (rootOrSingletonContext = !1), - (init = !0)) - : (init = !1); - init || throwOnHydrationMismatch(); + (context = !0)) + : (context = !1); + context || throwOnHydrationMismatch(); } pushHostContext(workInProgress); - init = workInProgress.type; + context = workInProgress.type; prevState = workInProgress.pendingProps; nextState = null !== current ? current.memoizedProps : null; - elementType = prevState.children; - shouldSetTextContent(init, prevState) - ? (elementType = null) + Component = prevState.children; + shouldSetTextContent(context, prevState) + ? (Component = null) : null !== nextState && - shouldSetTextContent(init, nextState) && + shouldSetTextContent(context, nextState) && (workInProgress.flags |= 32); null !== workInProgress.memoizedState && - ((init = renderWithHooks( + ((context = renderWithHooks( current, workInProgress, TransitionAwareHostComponent, @@ -6977,18 +6998,18 @@ function beginWork(current, workInProgress, renderLanes) { null, renderLanes )), - (HostTransitionContext._currentValue = init), + (HostTransitionContext._currentValue = context), enableLazyContextPropagation || (didReceiveUpdate && null !== current && - current.memoizedState.memoizedState !== init && + current.memoizedState.memoizedState !== context && propagateContextChange( workInProgress, HostTransitionContext, renderLanes ))); markRef(current, workInProgress); - reconcileChildren(current, workInProgress, elementType, renderLanes); + reconcileChildren(current, workInProgress, Component, renderLanes); return workInProgress.child; case 6: if (null === current && isHydrating) { @@ -7015,35 +7036,30 @@ function beginWork(current, workInProgress, renderLanes) { workInProgress, workInProgress.stateNode.containerInfo ), - (elementType = workInProgress.pendingProps), + (Component = workInProgress.pendingProps), null === current ? (workInProgress.child = reconcileChildFibers( workInProgress, null, - elementType, + Component, renderLanes )) - : reconcileChildren( - current, - workInProgress, - elementType, - renderLanes - ), + : reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 11: return ( - (elementType = workInProgress.type), - (init = workInProgress.pendingProps), - (init = - workInProgress.elementType === elementType - ? init - : resolveDefaultProps(elementType, init)), + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), updateForwardRef( current, workInProgress, - elementType, - init, + Component, + context, renderLanes ) ); @@ -7079,17 +7095,17 @@ function beginWork(current, workInProgress, renderLanes) { ); case 10: a: { - elementType = enableRenderableContext + Component = enableRenderableContext ? workInProgress.type : workInProgress.type._context; - init = workInProgress.pendingProps; + context = workInProgress.pendingProps; prevState = workInProgress.memoizedProps; - nextState = init.value; - pushProvider(workInProgress, elementType, nextState); + nextState = context.value; + pushProvider(workInProgress, Component, nextState); if (!enableLazyContextPropagation && null !== prevState) if (objectIs(prevState.value, nextState)) { if ( - prevState.children === init.children && + prevState.children === context.children && !didPerformWorkStackCursor.current ) { workInProgress = bailoutOnAlreadyFinishedWork( @@ -7099,35 +7115,39 @@ function beginWork(current, workInProgress, renderLanes) { ); break a; } - } else - propagateContextChange(workInProgress, elementType, renderLanes); - reconcileChildren(current, workInProgress, init.children, renderLanes); + } else propagateContextChange(workInProgress, Component, renderLanes); + reconcileChildren( + current, + workInProgress, + context.children, + renderLanes + ); workInProgress = workInProgress.child; } return workInProgress; case 9: return ( - (init = enableRenderableContext + (context = enableRenderableContext ? workInProgress.type._context : workInProgress.type), - (elementType = workInProgress.pendingProps.children), + (Component = workInProgress.pendingProps.children), prepareToReadContext(workInProgress, renderLanes), - (init = readContext(init)), - (elementType = elementType(init)), + (context = readContext(context)), + (Component = Component(context)), (workInProgress.flags |= 1), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 14: return ( - (elementType = workInProgress.type), - (init = resolveDefaultProps(elementType, workInProgress.pendingProps)), - (init = resolveDefaultProps(elementType.type, init)), + (Component = workInProgress.type), + (context = resolveDefaultProps(Component, workInProgress.pendingProps)), + (context = resolveDefaultProps(Component.type, context)), updateMemoComponent( current, workInProgress, - elementType, - init, + Component, + context, renderLanes ) ); @@ -7141,24 +7161,24 @@ function beginWork(current, workInProgress, renderLanes) { ); case 17: return ( - (elementType = workInProgress.type), - (init = workInProgress.pendingProps), - (init = - workInProgress.elementType === elementType - ? init - : resolveDefaultProps(elementType, init)), + (Component = workInProgress.type), + (context = workInProgress.pendingProps), + (context = + workInProgress.elementType === Component + ? context + : resolveDefaultProps(Component, context)), resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), (workInProgress.tag = 1), - isContextProvider(elementType) + isContextProvider(Component) ? ((current = !0), pushContextProvider(workInProgress)) : (current = !1), prepareToReadContext(workInProgress, renderLanes), - constructClassInstance(workInProgress, elementType, init), - mountClassInstance(workInProgress, elementType, init, renderLanes), + constructClassInstance(workInProgress, Component, context), + mountClassInstance(workInProgress, Component, context, renderLanes), finishClassComponent( null, workInProgress, - elementType, + Component, !0, current, renderLanes @@ -7168,9 +7188,9 @@ function beginWork(current, workInProgress, renderLanes) { return updateSuspenseListComponent(current, workInProgress, renderLanes); case 21: return ( - (elementType = workInProgress.pendingProps.children), + (Component = workInProgress.pendingProps.children), markRef(current, workInProgress), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 22: @@ -7180,39 +7200,39 @@ function beginWork(current, workInProgress, renderLanes) { case 24: return ( prepareToReadContext(workInProgress, renderLanes), - (elementType = readContext(CacheContext)), + (Component = readContext(CacheContext)), null === current - ? ((init = peekCacheFromPool()), - null === init && - ((init = workInProgressRoot), + ? ((context = peekCacheFromPool()), + null === context && + ((context = workInProgressRoot), (prevState = createCache()), - (init.pooledCache = prevState), + (context.pooledCache = prevState), prevState.refCount++, - null !== prevState && (init.pooledCacheLanes |= renderLanes), - (init = prevState)), + null !== prevState && (context.pooledCacheLanes |= renderLanes), + (context = prevState)), (workInProgress.memoizedState = { - parent: elementType, - cache: init + parent: Component, + cache: context }), initializeUpdateQueue(workInProgress), - pushProvider(workInProgress, CacheContext, init)) + pushProvider(workInProgress, CacheContext, context)) : (0 !== (current.lanes & renderLanes) && (cloneUpdateQueue(current, workInProgress), processUpdateQueue(workInProgress, null, null, renderLanes), suspendIfUpdateReadFromEntangledAsyncAction()), - (init = current.memoizedState), + (context = current.memoizedState), (prevState = workInProgress.memoizedState), - init.parent !== elementType - ? ((init = { parent: elementType, cache: elementType }), - (workInProgress.memoizedState = init), + context.parent !== Component + ? ((context = { parent: Component, cache: Component }), + (workInProgress.memoizedState = context), 0 === workInProgress.lanes && (workInProgress.memoizedState = workInProgress.updateQueue.baseState = - init), - pushProvider(workInProgress, CacheContext, elementType)) - : ((elementType = prevState.cache), - pushProvider(workInProgress, CacheContext, elementType), - elementType !== init.cache && + context), + pushProvider(workInProgress, CacheContext, Component)) + : ((Component = prevState.cache), + pushProvider(workInProgress, CacheContext, Component), + Component !== context.cache && propagateContextChange( workInProgress, CacheContext, @@ -7231,22 +7251,22 @@ function beginWork(current, workInProgress, renderLanes) { return ( enableTransitionTracing ? (null === current && - ((elementType = enableTransitionTracing + ((Component = enableTransitionTracing ? transitionStack.current : null), - null !== elementType && - ((elementType = { + null !== Component && + ((Component = { tag: 1, - transitions: new Set(elementType), + transitions: new Set(Component), pendingBoundaries: null, name: workInProgress.pendingProps.name, aborts: null }), - (workInProgress.stateNode = elementType), + (workInProgress.stateNode = Component), (workInProgress.flags |= 2048))), - (elementType = workInProgress.stateNode), - null !== elementType && - pushMarkerInstance(workInProgress, elementType), + (Component = workInProgress.stateNode), + null !== Component && + pushMarkerInstance(workInProgress, Component), reconcileChildren( current, workInProgress, @@ -7796,6 +7816,7 @@ function completeWork(current, workInProgress, renderLanes) { var newProps = workInProgress.pendingProps; popTreeContext(workInProgress); switch (workInProgress.tag) { + case 2: case 16: case 15: case 0: @@ -11737,6 +11758,8 @@ function performUnitOfWork(unitOfWork) { function replaySuspendedUnitOfWork(unitOfWork) { var current = unitOfWork.alternate; switch (unitOfWork.tag) { + case 2: + unitOfWork.tag = 0; case 15: case 0: var Component = unitOfWork.type, @@ -12235,6 +12258,16 @@ function shouldConstruct(Component) { Component = Component.prototype; return !(!Component || !Component.isReactComponent); } +function resolveLazyComponentTag(Component) { + if ("function" === typeof Component) + return shouldConstruct(Component) ? 1 : 0; + if (void 0 !== Component && null !== Component) { + Component = Component.$$typeof; + if (Component === REACT_FORWARD_REF_TYPE) return 11; + if (Component === REACT_MEMO_TYPE) return 14; + } + return 2; +} function createWorkInProgress(current, pendingProps) { var workInProgress = current.alternate; null === workInProgress @@ -12312,7 +12345,7 @@ function createFiberFromTypeAndProps( mode, lanes ) { - var fiberTag = 0; + var fiberTag = 2; owner = type; if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); else if ("string" === typeof type) @@ -13300,19 +13333,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$348; + var JSCompiler_inline_result$jscomp$349; if (canUseDOM) { - var isSupported$jscomp$inline_1509 = "oninput" in document; - if (!isSupported$jscomp$inline_1509) { - var element$jscomp$inline_1510 = document.createElement("div"); - element$jscomp$inline_1510.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1509 = - "function" === typeof element$jscomp$inline_1510.oninput; + var isSupported$jscomp$inline_1524 = "oninput" in document; + if (!isSupported$jscomp$inline_1524) { + var element$jscomp$inline_1525 = document.createElement("div"); + element$jscomp$inline_1525.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1524 = + "function" === typeof element$jscomp$inline_1525.oninput; } - JSCompiler_inline_result$jscomp$348 = isSupported$jscomp$inline_1509; - } else JSCompiler_inline_result$jscomp$348 = !1; + JSCompiler_inline_result$jscomp$349 = isSupported$jscomp$inline_1524; + } else JSCompiler_inline_result$jscomp$349 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$348 && + JSCompiler_inline_result$jscomp$349 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -13684,20 +13717,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1550 = 0; - i$jscomp$inline_1550 < simpleEventPluginEvents.length; - i$jscomp$inline_1550++ + var i$jscomp$inline_1565 = 0; + i$jscomp$inline_1565 < simpleEventPluginEvents.length; + i$jscomp$inline_1565++ ) { - var eventName$jscomp$inline_1551 = - simpleEventPluginEvents[i$jscomp$inline_1550], - domEventName$jscomp$inline_1552 = - eventName$jscomp$inline_1551.toLowerCase(), - capitalizedEvent$jscomp$inline_1553 = - eventName$jscomp$inline_1551[0].toUpperCase() + - eventName$jscomp$inline_1551.slice(1); + var eventName$jscomp$inline_1566 = + simpleEventPluginEvents[i$jscomp$inline_1565], + domEventName$jscomp$inline_1567 = + eventName$jscomp$inline_1566.toLowerCase(), + capitalizedEvent$jscomp$inline_1568 = + eventName$jscomp$inline_1566[0].toUpperCase() + + eventName$jscomp$inline_1566.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1552, - "on" + capitalizedEvent$jscomp$inline_1553 + domEventName$jscomp$inline_1567, + "on" + capitalizedEvent$jscomp$inline_1568 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -17404,17 +17437,17 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1744 = { +var devToolsConfig$jscomp$inline_1759 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-classic-34b7c846", + version: "19.0.0-www-classic-d76ce55c", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2150 = { - bundleType: devToolsConfig$jscomp$inline_1744.bundleType, - version: devToolsConfig$jscomp$inline_1744.version, - rendererPackageName: devToolsConfig$jscomp$inline_1744.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1744.rendererConfig, +var internals$jscomp$inline_2168 = { + bundleType: devToolsConfig$jscomp$inline_1759.bundleType, + version: devToolsConfig$jscomp$inline_1759.version, + rendererPackageName: devToolsConfig$jscomp$inline_1759.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1759.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17430,26 +17463,26 @@ var internals$jscomp$inline_2150 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1744.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1759.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-34b7c846" + reconcilerVersion: "19.0.0-www-classic-d76ce55c" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2151 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2169 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2151.isDisabled && - hook$jscomp$inline_2151.supportsFiber + !hook$jscomp$inline_2169.isDisabled && + hook$jscomp$inline_2169.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2151.inject( - internals$jscomp$inline_2150 + (rendererID = hook$jscomp$inline_2169.inject( + internals$jscomp$inline_2168 )), - (injectedHook = hook$jscomp$inline_2151); + (injectedHook = hook$jscomp$inline_2169); } catch (err) {} } var ReactFiberErrorDialogWWW = require("ReactFiberErrorDialog"); @@ -18030,4 +18063,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactCurrentDispatcher$2.current.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-classic-34b7c846"; +exports.version = "19.0.0-www-classic-d76ce55c"; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.modern.js b/compiled/facebook-www/ReactDOMTesting-prod.modern.js index f02ed06f8565a..d41308b96a56a 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.modern.js @@ -932,6 +932,7 @@ function describeFiber(fiber) { case 19: return describeBuiltInComponentFrame("SuspenseList"); case 0: + case 2: case 15: return (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; case 11: @@ -6616,90 +6617,105 @@ function beginWork(current, workInProgress, renderLanes) { pushTreeId(workInProgress, treeForkCount, workInProgress.index); workInProgress.lanes = 0; switch (workInProgress.tag) { + case 2: + var Component = workInProgress.type; + resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); + current = workInProgress.pendingProps; + prepareToReadContext(workInProgress, renderLanes); + current = renderWithHooks( + null, + workInProgress, + Component, + current, + void 0, + renderLanes + ); + Component = checkDidRenderIdHook(); + workInProgress.flags |= 1; + workInProgress.tag = 0; + isHydrating && Component && pushMaterializedTreeId(workInProgress); + reconcileChildren(null, workInProgress, current, renderLanes); + workInProgress = workInProgress.child; + return workInProgress; case 16: - var elementType = workInProgress.elementType; + Component = workInProgress.elementType; a: { resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); current = workInProgress.pendingProps; - var init = elementType._init; - elementType = init(elementType._payload); - workInProgress.type = elementType; - current = resolveDefaultProps(elementType, current); - if ("function" === typeof elementType) - shouldConstruct(elementType) - ? ((workInProgress.tag = 1), - (workInProgress = updateClassComponent( - null, - workInProgress, - elementType, - current, - renderLanes - ))) - : ((workInProgress.tag = 0), - (workInProgress = updateFunctionComponent( - null, - workInProgress, - elementType, - current, - renderLanes - ))); - else { - if (void 0 !== elementType && null !== elementType) - if ( - ((init = elementType.$$typeof), init === REACT_FORWARD_REF_TYPE) - ) { - workInProgress.tag = 11; - workInProgress = updateForwardRef( - null, - workInProgress, - elementType, - current, - renderLanes - ); - break a; - } else if (init === REACT_MEMO_TYPE) { - workInProgress.tag = 14; - workInProgress = updateMemoComponent( - null, - workInProgress, - elementType, - resolveDefaultProps(elementType.type, current), - renderLanes - ); - break a; - } - throw Error(formatProdErrorMessage(306, elementType, "")); + var init = Component._init; + Component = init(Component._payload); + workInProgress.type = Component; + init = workInProgress.tag = resolveLazyComponentTag(Component); + current = resolveDefaultProps(Component, current); + switch (init) { + case 0: + workInProgress = updateFunctionComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 1: + workInProgress = updateClassComponent( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 11: + workInProgress = updateForwardRef( + null, + workInProgress, + Component, + current, + renderLanes + ); + break a; + case 14: + workInProgress = updateMemoComponent( + null, + workInProgress, + Component, + resolveDefaultProps(Component.type, current), + renderLanes + ); + break a; } + throw Error(formatProdErrorMessage(306, Component, "")); } return workInProgress; case 0: return ( - (elementType = workInProgress.type), + (Component = workInProgress.type), (init = workInProgress.pendingProps), (init = - workInProgress.elementType === elementType + workInProgress.elementType === Component ? init - : resolveDefaultProps(elementType, init)), + : resolveDefaultProps(Component, init)), updateFunctionComponent( current, workInProgress, - elementType, + Component, init, renderLanes ) ); case 1: return ( - (elementType = workInProgress.type), + (Component = workInProgress.type), (init = workInProgress.pendingProps), (init = - workInProgress.elementType === elementType + workInProgress.elementType === Component ? init - : resolveDefaultProps(elementType, init)), + : resolveDefaultProps(Component, init)), updateClassComponent( current, workInProgress, - elementType, + Component, init, renderLanes ) @@ -6713,7 +6729,7 @@ function beginWork(current, workInProgress, renderLanes) { if (null === current) throw Error(formatProdErrorMessage(387)); init = workInProgress.pendingProps; var prevState = workInProgress.memoizedState; - elementType = prevState.element; + Component = prevState.element; cloneUpdateQueue(current, workInProgress); processUpdateQueue(workInProgress, init, null, renderLanes); var nextState = workInProgress.memoizedState; @@ -6737,7 +6753,7 @@ function beginWork(current, workInProgress, renderLanes) { (workInProgress.memoizedState = prevState), workInProgress.flags & 256) ) { - elementType = createCapturedValueAtFiber( + Component = createCapturedValueAtFiber( Error(formatProdErrorMessage(423)), workInProgress ); @@ -6746,11 +6762,11 @@ function beginWork(current, workInProgress, renderLanes) { workInProgress, init, renderLanes, - elementType + Component ); break a; - } else if (init !== elementType) { - elementType = createCapturedValueAtFiber( + } else if (init !== Component) { + Component = createCapturedValueAtFiber( Error(formatProdErrorMessage(424)), workInProgress ); @@ -6759,7 +6775,7 @@ function beginWork(current, workInProgress, renderLanes) { workInProgress, init, renderLanes, - elementType + Component ); break a; } else @@ -6785,7 +6801,7 @@ function beginWork(current, workInProgress, renderLanes) { (renderLanes = renderLanes.sibling); else { resetHydrationState(); - if (init === elementType) { + if (init === Component) { workInProgress = bailoutOnAlreadyFinishedWork( current, workInProgress, @@ -6812,14 +6828,14 @@ function beginWork(current, workInProgress, renderLanes) { null !== renderLanes || ((renderLanes = workInProgress.type), (current = workInProgress.pendingProps), - (elementType = getOwnerDocumentFromRootContainer( + (Component = getOwnerDocumentFromRootContainer( rootInstanceStackCursor.current ).createElement(renderLanes)), - (elementType[internalInstanceKey] = workInProgress), - (elementType[internalPropsKey] = current), - setInitialProperties(elementType, renderLanes, current), - markNodeAsHoistable(elementType), - (workInProgress.stateNode = elementType)), + (Component[internalInstanceKey] = workInProgress), + (Component[internalPropsKey] = current), + setInitialProperties(Component, renderLanes, current), + markNodeAsHoistable(Component), + (workInProgress.stateNode = Component)), null ); case 27: @@ -6827,7 +6843,7 @@ function beginWork(current, workInProgress, renderLanes) { pushHostContext(workInProgress), null === current && isHydrating && - ((elementType = workInProgress.stateNode = + ((Component = workInProgress.stateNode = resolveSingletonInstance( workInProgress.type, workInProgress.pendingProps, @@ -6835,14 +6851,14 @@ function beginWork(current, workInProgress, renderLanes) { )), (hydrationParentFiber = workInProgress), (rootOrSingletonContext = !0), - (nextHydratableInstance = getNextHydratable(elementType.firstChild))), - (elementType = workInProgress.pendingProps.children), + (nextHydratableInstance = getNextHydratable(Component.firstChild))), + (Component = workInProgress.pendingProps.children), null !== current || isHydrating - ? reconcileChildren(current, workInProgress, elementType, renderLanes) + ? reconcileChildren(current, workInProgress, Component, renderLanes) : (workInProgress.child = reconcileChildFibers( workInProgress, null, - elementType, + Component, renderLanes )), markRef(current, workInProgress), @@ -6850,18 +6866,18 @@ function beginWork(current, workInProgress, renderLanes) { ); case 5: if (null === current && isHydrating) { - if ((init = elementType = nextHydratableInstance)) - (elementType = canHydrateInstance( - elementType, + if ((init = Component = nextHydratableInstance)) + (Component = canHydrateInstance( + Component, workInProgress.type, workInProgress.pendingProps, rootOrSingletonContext )), - null !== elementType - ? ((workInProgress.stateNode = elementType), + null !== Component + ? ((workInProgress.stateNode = Component), (hydrationParentFiber = workInProgress), (nextHydratableInstance = getNextHydratable( - elementType.firstChild + Component.firstChild )), (rootOrSingletonContext = !1), (init = !0)) @@ -6872,9 +6888,9 @@ function beginWork(current, workInProgress, renderLanes) { init = workInProgress.type; prevState = workInProgress.pendingProps; nextState = null !== current ? current.memoizedProps : null; - elementType = prevState.children; + Component = prevState.children; shouldSetTextContent(init, prevState) - ? (elementType = null) + ? (Component = null) : null !== nextState && shouldSetTextContent(init, nextState) && (workInProgress.flags |= 32); @@ -6898,7 +6914,7 @@ function beginWork(current, workInProgress, renderLanes) { renderLanes ))); markRef(current, workInProgress); - reconcileChildren(current, workInProgress, elementType, renderLanes); + reconcileChildren(current, workInProgress, Component, renderLanes); return workInProgress.child; case 6: if (null === current && isHydrating) { @@ -6925,37 +6941,26 @@ function beginWork(current, workInProgress, renderLanes) { workInProgress, workInProgress.stateNode.containerInfo ), - (elementType = workInProgress.pendingProps), + (Component = workInProgress.pendingProps), null === current ? (workInProgress.child = reconcileChildFibers( workInProgress, null, - elementType, + Component, renderLanes )) - : reconcileChildren( - current, - workInProgress, - elementType, - renderLanes - ), + : reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 11: return ( - (elementType = workInProgress.type), + (Component = workInProgress.type), (init = workInProgress.pendingProps), (init = - workInProgress.elementType === elementType + workInProgress.elementType === Component ? init - : resolveDefaultProps(elementType, init)), - updateForwardRef( - current, - workInProgress, - elementType, - init, - renderLanes - ) + : resolveDefaultProps(Component, init)), + updateForwardRef(current, workInProgress, Component, init, renderLanes) ); case 7: return ( @@ -6989,13 +6994,13 @@ function beginWork(current, workInProgress, renderLanes) { ); case 10: a: { - elementType = enableRenderableContext + Component = enableRenderableContext ? workInProgress.type : workInProgress.type._context; init = workInProgress.pendingProps; prevState = workInProgress.memoizedProps; nextState = init.value; - pushProvider(workInProgress, elementType, nextState); + pushProvider(workInProgress, Component, nextState); if (!enableLazyContextPropagation && null !== prevState) if (objectIs(prevState.value, nextState)) { if (prevState.children === init.children) { @@ -7006,8 +7011,7 @@ function beginWork(current, workInProgress, renderLanes) { ); break a; } - } else - propagateContextChange(workInProgress, elementType, renderLanes); + } else propagateContextChange(workInProgress, Component, renderLanes); reconcileChildren(current, workInProgress, init.children, renderLanes); workInProgress = workInProgress.child; } @@ -7017,23 +7021,23 @@ function beginWork(current, workInProgress, renderLanes) { (init = enableRenderableContext ? workInProgress.type._context : workInProgress.type), - (elementType = workInProgress.pendingProps.children), + (Component = workInProgress.pendingProps.children), prepareToReadContext(workInProgress, renderLanes), (init = readContext(init)), - (elementType = elementType(init)), + (Component = Component(init)), (workInProgress.flags |= 1), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 14: return ( - (elementType = workInProgress.type), - (init = resolveDefaultProps(elementType, workInProgress.pendingProps)), - (init = resolveDefaultProps(elementType.type, init)), + (Component = workInProgress.type), + (init = resolveDefaultProps(Component, workInProgress.pendingProps)), + (init = resolveDefaultProps(Component.type, init)), updateMemoComponent( current, workInProgress, - elementType, + Component, init, renderLanes ) @@ -7048,21 +7052,21 @@ function beginWork(current, workInProgress, renderLanes) { ); case 17: return ( - (elementType = workInProgress.type), + (Component = workInProgress.type), (init = workInProgress.pendingProps), (init = - workInProgress.elementType === elementType + workInProgress.elementType === Component ? init - : resolveDefaultProps(elementType, init)), + : resolveDefaultProps(Component, init)), resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress), (workInProgress.tag = 1), prepareToReadContext(workInProgress, renderLanes), - constructClassInstance(workInProgress, elementType, init), - mountClassInstance(workInProgress, elementType, init, renderLanes), + constructClassInstance(workInProgress, Component, init), + mountClassInstance(workInProgress, Component, init, renderLanes), finishClassComponent( null, workInProgress, - elementType, + Component, !0, !1, renderLanes @@ -7072,9 +7076,9 @@ function beginWork(current, workInProgress, renderLanes) { return updateSuspenseListComponent(current, workInProgress, renderLanes); case 21: return ( - (elementType = workInProgress.pendingProps.children), + (Component = workInProgress.pendingProps.children), markRef(current, workInProgress), - reconcileChildren(current, workInProgress, elementType, renderLanes), + reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child ); case 22: @@ -7084,7 +7088,7 @@ function beginWork(current, workInProgress, renderLanes) { case 24: return ( prepareToReadContext(workInProgress, renderLanes), - (elementType = readContext(CacheContext)), + (Component = readContext(CacheContext)), null === current ? ((init = peekCacheFromPool()), null === init && @@ -7094,10 +7098,7 @@ function beginWork(current, workInProgress, renderLanes) { prevState.refCount++, null !== prevState && (init.pooledCacheLanes |= renderLanes), (init = prevState)), - (workInProgress.memoizedState = { - parent: elementType, - cache: init - }), + (workInProgress.memoizedState = { parent: Component, cache: init }), initializeUpdateQueue(workInProgress), pushProvider(workInProgress, CacheContext, init)) : (0 !== (current.lanes & renderLanes) && @@ -7106,17 +7107,17 @@ function beginWork(current, workInProgress, renderLanes) { suspendIfUpdateReadFromEntangledAsyncAction()), (init = current.memoizedState), (prevState = workInProgress.memoizedState), - init.parent !== elementType - ? ((init = { parent: elementType, cache: elementType }), + init.parent !== Component + ? ((init = { parent: Component, cache: Component }), (workInProgress.memoizedState = init), 0 === workInProgress.lanes && (workInProgress.memoizedState = workInProgress.updateQueue.baseState = init), - pushProvider(workInProgress, CacheContext, elementType)) - : ((elementType = prevState.cache), - pushProvider(workInProgress, CacheContext, elementType), - elementType !== init.cache && + pushProvider(workInProgress, CacheContext, Component)) + : ((Component = prevState.cache), + pushProvider(workInProgress, CacheContext, Component), + Component !== init.cache && propagateContextChange( workInProgress, CacheContext, @@ -7135,22 +7136,22 @@ function beginWork(current, workInProgress, renderLanes) { return ( enableTransitionTracing ? (null === current && - ((elementType = enableTransitionTracing + ((Component = enableTransitionTracing ? transitionStack.current : null), - null !== elementType && - ((elementType = { + null !== Component && + ((Component = { tag: 1, - transitions: new Set(elementType), + transitions: new Set(Component), pendingBoundaries: null, name: workInProgress.pendingProps.name, aborts: null }), - (workInProgress.stateNode = elementType), + (workInProgress.stateNode = Component), (workInProgress.flags |= 2048))), - (elementType = workInProgress.stateNode), - null !== elementType && - pushMarkerInstance(workInProgress, elementType), + (Component = workInProgress.stateNode), + null !== Component && + pushMarkerInstance(workInProgress, Component), reconcileChildren( current, workInProgress, @@ -7700,6 +7701,7 @@ function completeWork(current, workInProgress, renderLanes) { var newProps = workInProgress.pendingProps; popTreeContext(workInProgress); switch (workInProgress.tag) { + case 2: case 16: case 15: case 0: @@ -11623,6 +11625,8 @@ function performUnitOfWork(unitOfWork) { function replaySuspendedUnitOfWork(unitOfWork) { var current = unitOfWork.alternate; switch (unitOfWork.tag) { + case 2: + unitOfWork.tag = 0; case 15: case 0: var Component = unitOfWork.type, @@ -12117,6 +12121,16 @@ function shouldConstruct(Component) { Component = Component.prototype; return !(!Component || !Component.isReactComponent); } +function resolveLazyComponentTag(Component) { + if ("function" === typeof Component) + return shouldConstruct(Component) ? 1 : 0; + if (void 0 !== Component && null !== Component) { + Component = Component.$$typeof; + if (Component === REACT_FORWARD_REF_TYPE) return 11; + if (Component === REACT_MEMO_TYPE) return 14; + } + return 2; +} function createWorkInProgress(current, pendingProps) { var workInProgress = current.alternate; null === workInProgress @@ -12194,7 +12208,7 @@ function createFiberFromTypeAndProps( mode, lanes ) { - var fiberTag = 0; + var fiberTag = 2; owner = type; if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1); else if ("string" === typeof type) @@ -13750,19 +13764,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$343; + var JSCompiler_inline_result$jscomp$344; if (canUseDOM) { - var isSupported$jscomp$inline_1507 = "oninput" in document; - if (!isSupported$jscomp$inline_1507) { - var element$jscomp$inline_1508 = document.createElement("div"); - element$jscomp$inline_1508.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1507 = - "function" === typeof element$jscomp$inline_1508.oninput; + var isSupported$jscomp$inline_1521 = "oninput" in document; + if (!isSupported$jscomp$inline_1521) { + var element$jscomp$inline_1522 = document.createElement("div"); + element$jscomp$inline_1522.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1521 = + "function" === typeof element$jscomp$inline_1522.oninput; } - JSCompiler_inline_result$jscomp$343 = isSupported$jscomp$inline_1507; - } else JSCompiler_inline_result$jscomp$343 = !1; + JSCompiler_inline_result$jscomp$344 = isSupported$jscomp$inline_1521; + } else JSCompiler_inline_result$jscomp$344 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$343 && + JSCompiler_inline_result$jscomp$344 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -14071,20 +14085,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1548 = 0; - i$jscomp$inline_1548 < simpleEventPluginEvents.length; - i$jscomp$inline_1548++ + var i$jscomp$inline_1562 = 0; + i$jscomp$inline_1562 < simpleEventPluginEvents.length; + i$jscomp$inline_1562++ ) { - var eventName$jscomp$inline_1549 = - simpleEventPluginEvents[i$jscomp$inline_1548], - domEventName$jscomp$inline_1550 = - eventName$jscomp$inline_1549.toLowerCase(), - capitalizedEvent$jscomp$inline_1551 = - eventName$jscomp$inline_1549[0].toUpperCase() + - eventName$jscomp$inline_1549.slice(1); + var eventName$jscomp$inline_1563 = + simpleEventPluginEvents[i$jscomp$inline_1562], + domEventName$jscomp$inline_1564 = + eventName$jscomp$inline_1563.toLowerCase(), + capitalizedEvent$jscomp$inline_1565 = + eventName$jscomp$inline_1563[0].toUpperCase() + + eventName$jscomp$inline_1563.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1550, - "on" + capitalizedEvent$jscomp$inline_1551 + domEventName$jscomp$inline_1564, + "on" + capitalizedEvent$jscomp$inline_1565 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16998,17 +17012,17 @@ Internals.Events = [ restoreStateIfNeeded, unstable_batchedUpdates ]; -var devToolsConfig$jscomp$inline_1706 = { +var devToolsConfig$jscomp$inline_1720 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-modern-915aecd9", + version: "19.0.0-www-modern-3f526f79", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2109 = { - bundleType: devToolsConfig$jscomp$inline_1706.bundleType, - version: devToolsConfig$jscomp$inline_1706.version, - rendererPackageName: devToolsConfig$jscomp$inline_1706.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1706.rendererConfig, +var internals$jscomp$inline_2126 = { + bundleType: devToolsConfig$jscomp$inline_1720.bundleType, + version: devToolsConfig$jscomp$inline_1720.version, + rendererPackageName: devToolsConfig$jscomp$inline_1720.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1720.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17024,26 +17038,26 @@ var internals$jscomp$inline_2109 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1706.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1720.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-915aecd9" + reconcilerVersion: "19.0.0-www-modern-3f526f79" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2110 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2127 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2110.isDisabled && - hook$jscomp$inline_2110.supportsFiber + !hook$jscomp$inline_2127.isDisabled && + hook$jscomp$inline_2127.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2110.inject( - internals$jscomp$inline_2109 + (rendererID = hook$jscomp$inline_2127.inject( + internals$jscomp$inline_2126 )), - (injectedHook = hook$jscomp$inline_2110); + (injectedHook = hook$jscomp$inline_2127); } catch (err) {} } if ("function" !== typeof require("ReactFiberErrorDialog").showErrorDialog) @@ -17457,4 +17471,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactCurrentDispatcher$2.current.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-modern-915aecd9"; +exports.version = "19.0.0-www-modern-3f526f79"; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.classic.js b/compiled/facebook-www/ReactTestRenderer-dev.classic.js index f1f9ec123af3c..860904b81218a 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.classic.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.classic.js @@ -148,6 +148,8 @@ if (__DEV__) { var FunctionComponent = 0; var ClassComponent = 1; + var IndeterminateComponent = 2; // Before we know whether it is function or class + var HostRoot = 3; // Root of a host tree. Could be nested inside another node. var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. @@ -426,6 +428,7 @@ if (__DEV__) { case ClassComponent: case FunctionComponent: case IncompleteClassComponent: + case IndeterminateComponent: case MemoComponent: case SimpleMemoComponent: if (typeof type === "function") { @@ -2733,6 +2736,7 @@ if (__DEV__) { return "SuspenseList"; case FunctionComponent: + case IndeterminateComponent: case SimpleMemoComponent: var fn = fiber.type; return fn.displayName || fn.name || null; @@ -5063,6 +5067,7 @@ if (__DEV__) { return describeBuiltInComponentFrame("SuspenseList"); case FunctionComponent: + case IndeterminateComponent: case SimpleMemoComponent: return describeFunctionComponentFrame(fiber.type); @@ -12401,6 +12406,17 @@ if (__DEV__) { } } + function adoptClassInstance(workInProgress, instance) { + instance.updater = classComponentUpdater; + workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates + + set(instance, workInProgress); + + { + instance._reactInternalInstance = fakeInternalInstance; + } + } + function constructClassInstance(workInProgress, ctor, props) { var isLegacyContextConsumer = false; var unmaskedContext = emptyContextObject; @@ -12464,14 +12480,7 @@ if (__DEV__) { instance.state !== null && instance.state !== undefined ? instance.state : null); - instance.updater = classComponentUpdater; - workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates - - set(instance, workInProgress); - - { - instance._reactInternalInstance = fakeInternalInstance; - } + adoptClassInstance(workInProgress, instance); { if ( @@ -13735,6 +13744,7 @@ if (__DEV__) { ); var didReceiveUpdate = false; var didWarnAboutBadClass; + var didWarnAboutModulePatternComponent; var didWarnAboutContextTypeOnFunctionComponent; var didWarnAboutGetDerivedStateOnFunctionComponent; var didWarnAboutFunctionRefs; @@ -13745,6 +13755,7 @@ if (__DEV__) { { didWarnAboutBadClass = {}; + didWarnAboutModulePatternComponent = {}; didWarnAboutContextTypeOnFunctionComponent = {}; didWarnAboutGetDerivedStateOnFunctionComponent = {}; didWarnAboutFunctionRefs = {}; @@ -14357,39 +14368,6 @@ if (__DEV__) { nextProps, renderLanes ) { - { - if ( - Component.prototype && - typeof Component.prototype.render === "function" - ) { - var componentName = getComponentNameFromType(Component) || "Unknown"; - - if (!didWarnAboutBadClass[componentName]) { - error( - "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + - "This is likely to cause errors. Change %s to extend React.Component instead.", - componentName, - componentName - ); - - didWarnAboutBadClass[componentName] = true; - } - } - - if (workInProgress.mode & StrictLegacyMode) { - ReactStrictModeWarnings.recordLegacyContextWarning( - workInProgress, - null - ); - } - - if (current === null) { - // Some validations were previously done in mountIndeterminateComponent however and are now run - // in updateFuntionComponent but only on mount - validateFunctionComponentInDev(workInProgress, workInProgress.type); - } - } - var context; { @@ -14820,68 +14798,70 @@ if (__DEV__) { var Component = init(payload); // Store the unwrapped component in the type. workInProgress.type = Component; + var resolvedTag = (workInProgress.tag = + resolveLazyComponentTag(Component)); var resolvedProps = resolveDefaultProps(Component, props); + var child; - if (typeof Component === "function") { - if (isFunctionClassComponent(Component)) { - workInProgress.tag = ClassComponent; - + switch (resolvedTag) { + case FunctionComponent: { { + validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = - resolveClassForHotReloading(Component); + resolveFunctionForHotReloading(Component); } - return updateClassComponent( + child = updateFunctionComponent( null, workInProgress, Component, resolvedProps, renderLanes ); - } else { - workInProgress.tag = FunctionComponent; + return child; + } + case ClassComponent: { { - validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = - resolveFunctionForHotReloading(Component); + resolveClassForHotReloading(Component); } - return updateFunctionComponent( + child = updateClassComponent( null, workInProgress, Component, resolvedProps, renderLanes ); + return child; } - } else if (Component !== undefined && Component !== null) { - var $$typeof = Component.$$typeof; - - if ($$typeof === REACT_FORWARD_REF_TYPE) { - workInProgress.tag = ForwardRef; + case ForwardRef: { { workInProgress.type = Component = resolveForwardRefForHotReloading(Component); } - return updateForwardRef( + child = updateForwardRef( null, workInProgress, Component, resolvedProps, renderLanes ); - } else if ($$typeof === REACT_MEMO_TYPE) { - workInProgress.tag = MemoComponent; - return updateMemoComponent( + return child; + } + + case MemoComponent: { + child = updateMemoComponent( null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too renderLanes ); + return child; } } @@ -14943,6 +14923,111 @@ if (__DEV__) { ); } + function mountIndeterminateComponent( + _current, + workInProgress, + Component, + renderLanes + ) { + resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress); + var props = workInProgress.pendingProps; + var context; + + { + var unmaskedContext = getUnmaskedContext( + workInProgress, + Component, + false + ); + context = getMaskedContext(workInProgress, unmaskedContext); + } + + prepareToReadContext(workInProgress, renderLanes); + var value; + + { + if ( + Component.prototype && + typeof Component.prototype.render === "function" + ) { + var componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutBadClass[componentName]) { + error( + "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + + "This is likely to cause errors. Change %s to extend React.Component instead.", + componentName, + componentName + ); + + didWarnAboutBadClass[componentName] = true; + } + } + + if (workInProgress.mode & StrictLegacyMode) { + ReactStrictModeWarnings.recordLegacyContextWarning( + workInProgress, + null + ); + } + + setIsRendering(true); + ReactCurrentOwner$1.current = workInProgress; + value = renderWithHooks( + null, + workInProgress, + Component, + props, + context, + renderLanes + ); + setIsRendering(false); + } + + workInProgress.flags |= PerformedWork; + + { + // Support for module components is deprecated and is removed behind a flag. + // Whether or not it would crash later, we want to show a good message in DEV first. + if ( + typeof value === "object" && + value !== null && + typeof value.render === "function" && + value.$$typeof === undefined + ) { + var _componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutModulePatternComponent[_componentName]) { + error( + "The <%s /> component appears to be a function component that returns a class instance. " + + "Change %s to a class that extends React.Component instead. " + + "If you can't use a class try assigning the prototype on the function as a workaround. " + + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + + "cannot be called with `new` by React.", + _componentName, + _componentName, + _componentName + ); + + didWarnAboutModulePatternComponent[_componentName] = true; + } + } + } + + { + // Proceed under the assumption that this is a function component + workInProgress.tag = FunctionComponent; + + reconcileChildren(null, workInProgress, value, renderLanes); + + { + validateFunctionComponentInDev(workInProgress, Component); + } + + return workInProgress.child; + } + } + function validateFunctionComponentInDev(workInProgress, Component) { { if (Component) { @@ -14979,32 +15064,33 @@ if (__DEV__) { } if (Component.defaultProps !== undefined) { - var _componentName = getComponentNameFromType(Component) || "Unknown"; + var _componentName3 = + getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName]) { + if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName3]) { error( "%s: Support for defaultProps will be removed from function components " + "in a future major release. Use JavaScript default parameters instead.", - _componentName + _componentName3 ); - didWarnAboutDefaultPropsOnFunctionComponent[_componentName] = true; + didWarnAboutDefaultPropsOnFunctionComponent[_componentName3] = true; } } if (typeof Component.getDerivedStateFromProps === "function") { - var _componentName2 = + var _componentName4 = getComponentNameFromType(Component) || "Unknown"; if ( - !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] + !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] ) { error( "%s: Function components do not support getDerivedStateFromProps.", - _componentName2 + _componentName4 ); - didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = + didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] = true; } } @@ -15013,16 +15099,16 @@ if (__DEV__) { typeof Component.contextType === "object" && Component.contextType !== null ) { - var _componentName3 = + var _componentName5 = getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) { + if (!didWarnAboutContextTypeOnFunctionComponent[_componentName5]) { error( "%s: Function components do not support contextType.", - _componentName3 + _componentName5 ); - didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true; + didWarnAboutContextTypeOnFunctionComponent[_componentName5] = true; } } } @@ -16714,6 +16800,15 @@ if (__DEV__) { workInProgress.lanes = NoLanes; switch (workInProgress.tag) { + case IndeterminateComponent: { + return mountIndeterminateComponent( + current, + workInProgress, + workInProgress.type, + renderLanes + ); + } + case LazyComponent: { var elementType = workInProgress.elementType; return mountLazyComponent( @@ -18053,6 +18148,7 @@ if (__DEV__) { var newProps = workInProgress.pendingProps; // Note: This intentionally doesn't check if we're hydrating because comparing switch (workInProgress.tag) { + case IndeterminateComponent: case LazyComponent: case SimpleMemoComponent: case FunctionComponent: @@ -24171,6 +24267,12 @@ if (__DEV__) { } switch (unitOfWork.tag) { + case IndeterminateComponent: { + // Because it suspended with `use`, we can assume it's a + // function component. + unitOfWork.tag = FunctionComponent; // Fallthrough to the next branch. + } + case SimpleMemoComponent: case FunctionComponent: { // Resolve `defaultProps`. This logic is copied from `beginWork`. @@ -25310,6 +25412,7 @@ if (__DEV__) { var tag = fiber.tag; if ( + tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && @@ -26095,8 +26198,22 @@ if (__DEV__) { type.defaultProps === undefined ); } - function isFunctionClassComponent(type) { - return shouldConstruct(type); + function resolveLazyComponentTag(Component) { + if (typeof Component === "function") { + return shouldConstruct(Component) ? ClassComponent : FunctionComponent; + } else if (Component !== undefined && Component !== null) { + var $$typeof = Component.$$typeof; + + if ($$typeof === REACT_FORWARD_REF_TYPE) { + return ForwardRef; + } + + if ($$typeof === REACT_MEMO_TYPE) { + return MemoComponent; + } + } + + return IndeterminateComponent; } // This is used to create an alternate fiber to do work on. function createWorkInProgress(current, pendingProps) { @@ -26181,6 +26298,7 @@ if (__DEV__) { workInProgress._debugNeedsRemount = current._debugNeedsRemount; switch (workInProgress.tag) { + case IndeterminateComponent: case FunctionComponent: case SimpleMemoComponent: workInProgress.type = resolveFunctionForHotReloading(current.type); @@ -26306,7 +26424,7 @@ if (__DEV__) { mode, lanes ) { - var fiberTag = FunctionComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. + var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. var resolvedType = type; @@ -26721,7 +26839,7 @@ if (__DEV__) { return root; } - var ReactVersion = "19.0.0-www-classic-7ce8154f"; + var ReactVersion = "19.0.0-www-classic-22c1f956"; // Might add PROFILE later. diff --git a/compiled/facebook-www/ReactTestRenderer-dev.modern.js b/compiled/facebook-www/ReactTestRenderer-dev.modern.js index ff0500b975d52..7d722dba924c9 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.modern.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.modern.js @@ -148,6 +148,8 @@ if (__DEV__) { var FunctionComponent = 0; var ClassComponent = 1; + var IndeterminateComponent = 2; // Before we know whether it is function or class + var HostRoot = 3; // Root of a host tree. Could be nested inside another node. var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. @@ -426,6 +428,7 @@ if (__DEV__) { case ClassComponent: case FunctionComponent: case IncompleteClassComponent: + case IndeterminateComponent: case MemoComponent: case SimpleMemoComponent: if (typeof type === "function") { @@ -2733,6 +2736,7 @@ if (__DEV__) { return "SuspenseList"; case FunctionComponent: + case IndeterminateComponent: case SimpleMemoComponent: var fn = fiber.type; return fn.displayName || fn.name || null; @@ -5063,6 +5067,7 @@ if (__DEV__) { return describeBuiltInComponentFrame("SuspenseList"); case FunctionComponent: + case IndeterminateComponent: case SimpleMemoComponent: return describeFunctionComponentFrame(fiber.type); @@ -12401,6 +12406,17 @@ if (__DEV__) { } } + function adoptClassInstance(workInProgress, instance) { + instance.updater = classComponentUpdater; + workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates + + set(instance, workInProgress); + + { + instance._reactInternalInstance = fakeInternalInstance; + } + } + function constructClassInstance(workInProgress, ctor, props) { var isLegacyContextConsumer = false; var unmaskedContext = emptyContextObject; @@ -12464,14 +12480,7 @@ if (__DEV__) { instance.state !== null && instance.state !== undefined ? instance.state : null); - instance.updater = classComponentUpdater; - workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates - - set(instance, workInProgress); - - { - instance._reactInternalInstance = fakeInternalInstance; - } + adoptClassInstance(workInProgress, instance); { if ( @@ -13735,6 +13744,7 @@ if (__DEV__) { ); var didReceiveUpdate = false; var didWarnAboutBadClass; + var didWarnAboutModulePatternComponent; var didWarnAboutContextTypeOnFunctionComponent; var didWarnAboutGetDerivedStateOnFunctionComponent; var didWarnAboutFunctionRefs; @@ -13745,6 +13755,7 @@ if (__DEV__) { { didWarnAboutBadClass = {}; + didWarnAboutModulePatternComponent = {}; didWarnAboutContextTypeOnFunctionComponent = {}; didWarnAboutGetDerivedStateOnFunctionComponent = {}; didWarnAboutFunctionRefs = {}; @@ -14357,39 +14368,6 @@ if (__DEV__) { nextProps, renderLanes ) { - { - if ( - Component.prototype && - typeof Component.prototype.render === "function" - ) { - var componentName = getComponentNameFromType(Component) || "Unknown"; - - if (!didWarnAboutBadClass[componentName]) { - error( - "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + - "This is likely to cause errors. Change %s to extend React.Component instead.", - componentName, - componentName - ); - - didWarnAboutBadClass[componentName] = true; - } - } - - if (workInProgress.mode & StrictLegacyMode) { - ReactStrictModeWarnings.recordLegacyContextWarning( - workInProgress, - null - ); - } - - if (current === null) { - // Some validations were previously done in mountIndeterminateComponent however and are now run - // in updateFuntionComponent but only on mount - validateFunctionComponentInDev(workInProgress, workInProgress.type); - } - } - var context; { @@ -14820,68 +14798,70 @@ if (__DEV__) { var Component = init(payload); // Store the unwrapped component in the type. workInProgress.type = Component; + var resolvedTag = (workInProgress.tag = + resolveLazyComponentTag(Component)); var resolvedProps = resolveDefaultProps(Component, props); + var child; - if (typeof Component === "function") { - if (isFunctionClassComponent(Component)) { - workInProgress.tag = ClassComponent; - + switch (resolvedTag) { + case FunctionComponent: { { + validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = - resolveClassForHotReloading(Component); + resolveFunctionForHotReloading(Component); } - return updateClassComponent( + child = updateFunctionComponent( null, workInProgress, Component, resolvedProps, renderLanes ); - } else { - workInProgress.tag = FunctionComponent; + return child; + } + case ClassComponent: { { - validateFunctionComponentInDev(workInProgress, Component); workInProgress.type = Component = - resolveFunctionForHotReloading(Component); + resolveClassForHotReloading(Component); } - return updateFunctionComponent( + child = updateClassComponent( null, workInProgress, Component, resolvedProps, renderLanes ); + return child; } - } else if (Component !== undefined && Component !== null) { - var $$typeof = Component.$$typeof; - - if ($$typeof === REACT_FORWARD_REF_TYPE) { - workInProgress.tag = ForwardRef; + case ForwardRef: { { workInProgress.type = Component = resolveForwardRefForHotReloading(Component); } - return updateForwardRef( + child = updateForwardRef( null, workInProgress, Component, resolvedProps, renderLanes ); - } else if ($$typeof === REACT_MEMO_TYPE) { - workInProgress.tag = MemoComponent; - return updateMemoComponent( + return child; + } + + case MemoComponent: { + child = updateMemoComponent( null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too renderLanes ); + return child; } } @@ -14943,6 +14923,111 @@ if (__DEV__) { ); } + function mountIndeterminateComponent( + _current, + workInProgress, + Component, + renderLanes + ) { + resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress); + var props = workInProgress.pendingProps; + var context; + + { + var unmaskedContext = getUnmaskedContext( + workInProgress, + Component, + false + ); + context = getMaskedContext(workInProgress, unmaskedContext); + } + + prepareToReadContext(workInProgress, renderLanes); + var value; + + { + if ( + Component.prototype && + typeof Component.prototype.render === "function" + ) { + var componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutBadClass[componentName]) { + error( + "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + + "This is likely to cause errors. Change %s to extend React.Component instead.", + componentName, + componentName + ); + + didWarnAboutBadClass[componentName] = true; + } + } + + if (workInProgress.mode & StrictLegacyMode) { + ReactStrictModeWarnings.recordLegacyContextWarning( + workInProgress, + null + ); + } + + setIsRendering(true); + ReactCurrentOwner$1.current = workInProgress; + value = renderWithHooks( + null, + workInProgress, + Component, + props, + context, + renderLanes + ); + setIsRendering(false); + } + + workInProgress.flags |= PerformedWork; + + { + // Support for module components is deprecated and is removed behind a flag. + // Whether or not it would crash later, we want to show a good message in DEV first. + if ( + typeof value === "object" && + value !== null && + typeof value.render === "function" && + value.$$typeof === undefined + ) { + var _componentName = getComponentNameFromType(Component) || "Unknown"; + + if (!didWarnAboutModulePatternComponent[_componentName]) { + error( + "The <%s /> component appears to be a function component that returns a class instance. " + + "Change %s to a class that extends React.Component instead. " + + "If you can't use a class try assigning the prototype on the function as a workaround. " + + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + + "cannot be called with `new` by React.", + _componentName, + _componentName, + _componentName + ); + + didWarnAboutModulePatternComponent[_componentName] = true; + } + } + } + + { + // Proceed under the assumption that this is a function component + workInProgress.tag = FunctionComponent; + + reconcileChildren(null, workInProgress, value, renderLanes); + + { + validateFunctionComponentInDev(workInProgress, Component); + } + + return workInProgress.child; + } + } + function validateFunctionComponentInDev(workInProgress, Component) { { if (Component) { @@ -14979,32 +15064,33 @@ if (__DEV__) { } if (Component.defaultProps !== undefined) { - var _componentName = getComponentNameFromType(Component) || "Unknown"; + var _componentName3 = + getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName]) { + if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName3]) { error( "%s: Support for defaultProps will be removed from function components " + "in a future major release. Use JavaScript default parameters instead.", - _componentName + _componentName3 ); - didWarnAboutDefaultPropsOnFunctionComponent[_componentName] = true; + didWarnAboutDefaultPropsOnFunctionComponent[_componentName3] = true; } } if (typeof Component.getDerivedStateFromProps === "function") { - var _componentName2 = + var _componentName4 = getComponentNameFromType(Component) || "Unknown"; if ( - !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] + !didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] ) { error( "%s: Function components do not support getDerivedStateFromProps.", - _componentName2 + _componentName4 ); - didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = + didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] = true; } } @@ -15013,16 +15099,16 @@ if (__DEV__) { typeof Component.contextType === "object" && Component.contextType !== null ) { - var _componentName3 = + var _componentName5 = getComponentNameFromType(Component) || "Unknown"; - if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) { + if (!didWarnAboutContextTypeOnFunctionComponent[_componentName5]) { error( "%s: Function components do not support contextType.", - _componentName3 + _componentName5 ); - didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true; + didWarnAboutContextTypeOnFunctionComponent[_componentName5] = true; } } } @@ -16714,6 +16800,15 @@ if (__DEV__) { workInProgress.lanes = NoLanes; switch (workInProgress.tag) { + case IndeterminateComponent: { + return mountIndeterminateComponent( + current, + workInProgress, + workInProgress.type, + renderLanes + ); + } + case LazyComponent: { var elementType = workInProgress.elementType; return mountLazyComponent( @@ -18053,6 +18148,7 @@ if (__DEV__) { var newProps = workInProgress.pendingProps; // Note: This intentionally doesn't check if we're hydrating because comparing switch (workInProgress.tag) { + case IndeterminateComponent: case LazyComponent: case SimpleMemoComponent: case FunctionComponent: @@ -24171,6 +24267,12 @@ if (__DEV__) { } switch (unitOfWork.tag) { + case IndeterminateComponent: { + // Because it suspended with `use`, we can assume it's a + // function component. + unitOfWork.tag = FunctionComponent; // Fallthrough to the next branch. + } + case SimpleMemoComponent: case FunctionComponent: { // Resolve `defaultProps`. This logic is copied from `beginWork`. @@ -25310,6 +25412,7 @@ if (__DEV__) { var tag = fiber.tag; if ( + tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && @@ -26095,8 +26198,22 @@ if (__DEV__) { type.defaultProps === undefined ); } - function isFunctionClassComponent(type) { - return shouldConstruct(type); + function resolveLazyComponentTag(Component) { + if (typeof Component === "function") { + return shouldConstruct(Component) ? ClassComponent : FunctionComponent; + } else if (Component !== undefined && Component !== null) { + var $$typeof = Component.$$typeof; + + if ($$typeof === REACT_FORWARD_REF_TYPE) { + return ForwardRef; + } + + if ($$typeof === REACT_MEMO_TYPE) { + return MemoComponent; + } + } + + return IndeterminateComponent; } // This is used to create an alternate fiber to do work on. function createWorkInProgress(current, pendingProps) { @@ -26181,6 +26298,7 @@ if (__DEV__) { workInProgress._debugNeedsRemount = current._debugNeedsRemount; switch (workInProgress.tag) { + case IndeterminateComponent: case FunctionComponent: case SimpleMemoComponent: workInProgress.type = resolveFunctionForHotReloading(current.type); @@ -26306,7 +26424,7 @@ if (__DEV__) { mode, lanes ) { - var fiberTag = FunctionComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. + var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. var resolvedType = type; @@ -26721,7 +26839,7 @@ if (__DEV__) { return root; } - var ReactVersion = "19.0.0-www-modern-7ce8154f"; + var ReactVersion = "19.0.0-www-modern-22c1f956"; // Might add PROFILE later. diff --git a/compiled/facebook-www/ReactTestUtils-dev.classic.js b/compiled/facebook-www/ReactTestUtils-dev.classic.js index 5c58d54d96f16..fdd99a61000ae 100644 --- a/compiled/facebook-www/ReactTestUtils-dev.classic.js +++ b/compiled/facebook-www/ReactTestUtils-dev.classic.js @@ -98,6 +98,7 @@ if (__DEV__) { var FunctionComponent = 0; var ClassComponent = 1; + var HostRoot = 3; // Root of a host tree. Could be nested inside another node. var HostComponent = 5; diff --git a/compiled/facebook-www/ReactTestUtils-dev.modern.js b/compiled/facebook-www/ReactTestUtils-dev.modern.js index 5c58d54d96f16..fdd99a61000ae 100644 --- a/compiled/facebook-www/ReactTestUtils-dev.modern.js +++ b/compiled/facebook-www/ReactTestUtils-dev.modern.js @@ -98,6 +98,7 @@ if (__DEV__) { var FunctionComponent = 0; var ClassComponent = 1; + var HostRoot = 3; // Root of a host tree. Could be nested inside another node. var HostComponent = 5; diff --git a/compiled/facebook-www/__test_utils__/ReactAllWarnings.js b/compiled/facebook-www/__test_utils__/ReactAllWarnings.js index 38554388044da..998735c67dea2 100644 --- a/compiled/facebook-www/__test_utils__/ReactAllWarnings.js +++ b/compiled/facebook-www/__test_utils__/ReactAllWarnings.js @@ -274,6 +274,7 @@ export default [ "Symbols are not valid as a React child.\n root.render(%s)", "Text strings must be rendered within a component.", "Textarea elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled textarea and remove one of these props. More info: https://react.dev/link/controlled-components", + "The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.", "The <%s /> component appears to have a render method, but doesn't extend React.Component. This is likely to cause errors. Change %s to extend React.Component instead.", "The `%s` prop supplied to must be a scalar value if `multiple` is false.%s",