From 3945ca9ce7c4356e585558383c790c3067e0d759 Mon Sep 17 00:00:00 2001 From: gnoff Date: Wed, 8 Feb 2023 19:40:52 +0000 Subject: [PATCH] support ReactDOM.render(..., document) without crashing (#26129) as reported in #26128 `ReactDOM.render(..., document)` crashed when `enableHostSingletons` was on. This is because it had a different way of clearing the container than `createRoot(document)`. I updated the legacy implementation to share the clearing behavior of `creatRoot` which will preserve the singleton instances. I also removed the warning saying not to use `document.body` as a container DiffTrain build for [a3152eda5f89e20f056521855f7fa101ce50e4c3](https://github.com/facebook/react/commit/a3152eda5f89e20f056521855f7fa101ce50e4c3) [View git log for this commit](https://github.com/facebook/react/commits/a3152eda5f89e20f056521855f7fa101ce50e4c3) --- compiled/facebook-www/REVISION | 2 +- compiled/facebook-www/REVISION_TRANSFORMS | 2 +- compiled/facebook-www/React-dev.classic.js | 2 +- compiled/facebook-www/React-dev.modern.js | 2 +- compiled/facebook-www/React-prod.classic.js | 2 +- compiled/facebook-www/React-prod.modern.js | 2 +- .../facebook-www/React-profiling.classic.js | 2 +- .../facebook-www/React-profiling.modern.js | 2 +- compiled/facebook-www/ReactART-dev.classic.js | 2 +- compiled/facebook-www/ReactART-dev.modern.js | 2 +- .../facebook-www/ReactART-prod.classic.js | 4 +- compiled/facebook-www/ReactART-prod.modern.js | 4 +- compiled/facebook-www/ReactDOM-dev.classic.js | 22 +- compiled/facebook-www/ReactDOM-dev.modern.js | 494 ++++++++--------- .../facebook-www/ReactDOM-prod.classic.js | 45 +- compiled/facebook-www/ReactDOM-prod.modern.js | 226 ++++---- .../ReactDOM-profiling.classic.js | 45 +- .../facebook-www/ReactDOM-profiling.modern.js | 226 ++++---- .../ReactDOMServer-dev.classic.js | 2 +- .../facebook-www/ReactDOMServer-dev.modern.js | 2 +- .../ReactDOMServer-prod.classic.js | 2 +- .../ReactDOMServer-prod.modern.js | 2 +- .../ReactDOMTesting-dev.classic.js | 22 +- .../ReactDOMTesting-dev.modern.js | 516 +++++++++--------- .../ReactDOMTesting-prod.classic.js | 45 +- .../ReactDOMTesting-prod.modern.js | 222 ++++---- .../ReactTestRenderer-dev.classic.js | 2 +- .../ReactTestRenderer-dev.modern.js | 2 +- 28 files changed, 932 insertions(+), 971 deletions(-) diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index c8dcc8a1ba503..e153ea15f825a 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -758fc7fde10f49912b18496299506cba30d6029b +a3152eda5f89e20f056521855f7fa101ce50e4c3 diff --git a/compiled/facebook-www/REVISION_TRANSFORMS b/compiled/facebook-www/REVISION_TRANSFORMS index c8dcc8a1ba503..e153ea15f825a 100644 --- a/compiled/facebook-www/REVISION_TRANSFORMS +++ b/compiled/facebook-www/REVISION_TRANSFORMS @@ -1 +1 @@ -758fc7fde10f49912b18496299506cba30d6029b +a3152eda5f89e20f056521855f7fa101ce50e4c3 diff --git a/compiled/facebook-www/React-dev.classic.js b/compiled/facebook-www/React-dev.classic.js index 245d7ca7b55be..b863a5e60ab85 100644 --- a/compiled/facebook-www/React-dev.classic.js +++ b/compiled/facebook-www/React-dev.classic.js @@ -27,7 +27,7 @@ if ( } "use strict"; -var ReactVersion = "18.3.0-www-classic-758fc7fde-20230207"; +var ReactVersion = "18.3.0-www-classic-a3152eda5-20230208"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled/facebook-www/React-dev.modern.js b/compiled/facebook-www/React-dev.modern.js index 8ec3d3085fd6d..7eb649540ad68 100644 --- a/compiled/facebook-www/React-dev.modern.js +++ b/compiled/facebook-www/React-dev.modern.js @@ -27,7 +27,7 @@ if ( } "use strict"; -var ReactVersion = "18.3.0-www-modern-758fc7fde-20230207"; +var ReactVersion = "18.3.0-www-modern-a3152eda5-20230208"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled/facebook-www/React-prod.classic.js b/compiled/facebook-www/React-prod.classic.js index 116b8bcc16213..80b434429e4c0 100644 --- a/compiled/facebook-www/React-prod.classic.js +++ b/compiled/facebook-www/React-prod.classic.js @@ -646,4 +646,4 @@ exports.useSyncExternalStore = function ( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-classic-758fc7fde-20230207"; +exports.version = "18.3.0-www-classic-a3152eda5-20230208"; diff --git a/compiled/facebook-www/React-prod.modern.js b/compiled/facebook-www/React-prod.modern.js index ff6833fcf3108..62adca59fc6df 100644 --- a/compiled/facebook-www/React-prod.modern.js +++ b/compiled/facebook-www/React-prod.modern.js @@ -638,4 +638,4 @@ exports.useSyncExternalStore = function ( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-modern-758fc7fde-20230207"; +exports.version = "18.3.0-www-modern-a3152eda5-20230208"; diff --git a/compiled/facebook-www/React-profiling.classic.js b/compiled/facebook-www/React-profiling.classic.js index d679323bdba5b..38c21eaf2a3f0 100644 --- a/compiled/facebook-www/React-profiling.classic.js +++ b/compiled/facebook-www/React-profiling.classic.js @@ -657,7 +657,7 @@ exports.useSyncExternalStore = function ( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-classic-758fc7fde-20230207"; +exports.version = "18.3.0-www-classic-a3152eda5-20230208"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/React-profiling.modern.js b/compiled/facebook-www/React-profiling.modern.js index 5183ace7c7cc8..8b4d0e56947a9 100644 --- a/compiled/facebook-www/React-profiling.modern.js +++ b/compiled/facebook-www/React-profiling.modern.js @@ -649,7 +649,7 @@ exports.useSyncExternalStore = function ( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-www-modern-758fc7fde-20230207"; +exports.version = "18.3.0-www-modern-a3152eda5-20230208"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactART-dev.classic.js b/compiled/facebook-www/ReactART-dev.classic.js index b41320be4c34f..317db9661d88a 100644 --- a/compiled/facebook-www/ReactART-dev.classic.js +++ b/compiled/facebook-www/ReactART-dev.classic.js @@ -69,7 +69,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = "18.3.0-www-classic-758fc7fde-20230207"; +var ReactVersion = "18.3.0-www-classic-a3152eda5-20230208"; var LegacyRoot = 0; var ConcurrentRoot = 1; diff --git a/compiled/facebook-www/ReactART-dev.modern.js b/compiled/facebook-www/ReactART-dev.modern.js index 33da0da63d6c9..3546a5ba5d7b2 100644 --- a/compiled/facebook-www/ReactART-dev.modern.js +++ b/compiled/facebook-www/ReactART-dev.modern.js @@ -69,7 +69,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = "18.3.0-www-modern-758fc7fde-20230207"; +var ReactVersion = "18.3.0-www-modern-a3152eda5-20230208"; var LegacyRoot = 0; var ConcurrentRoot = 1; diff --git a/compiled/facebook-www/ReactART-prod.classic.js b/compiled/facebook-www/ReactART-prod.classic.js index c969815831a64..0f9bf12ab3e7b 100644 --- a/compiled/facebook-www/ReactART-prod.classic.js +++ b/compiled/facebook-www/ReactART-prod.classic.js @@ -9845,7 +9845,7 @@ var slice = Array.prototype.slice, return null; }, bundleType: 0, - version: "18.3.0-www-classic-758fc7fde-20230207", + version: "18.3.0-www-classic-a3152eda5-20230208", rendererPackageName: "react-art" }; var internals$jscomp$inline_1318 = { @@ -9876,7 +9876,7 @@ var internals$jscomp$inline_1318 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-758fc7fde-20230207" + reconcilerVersion: "18.3.0-next-a3152eda5-20230208" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1319 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled/facebook-www/ReactART-prod.modern.js b/compiled/facebook-www/ReactART-prod.modern.js index c7cfb040c356e..3c730ea648858 100644 --- a/compiled/facebook-www/ReactART-prod.modern.js +++ b/compiled/facebook-www/ReactART-prod.modern.js @@ -9510,7 +9510,7 @@ var slice = Array.prototype.slice, return null; }, bundleType: 0, - version: "18.3.0-www-modern-758fc7fde-20230207", + version: "18.3.0-www-modern-a3152eda5-20230208", rendererPackageName: "react-art" }; var internals$jscomp$inline_1309 = { @@ -9541,7 +9541,7 @@ var internals$jscomp$inline_1309 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-758fc7fde-20230207" + reconcilerVersion: "18.3.0-next-a3152eda5-20230208" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1310 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled/facebook-www/ReactDOM-dev.classic.js b/compiled/facebook-www/ReactDOM-dev.classic.js index 52b6e332ceeb0..79a0e74d6ea51 100644 --- a/compiled/facebook-www/ReactDOM-dev.classic.js +++ b/compiled/facebook-www/ReactDOM-dev.classic.js @@ -42695,7 +42695,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-758fc7fde-20230207"; +var ReactVersion = "18.3.0-www-classic-a3152eda5-20230208"; function createPortal( children, @@ -43727,20 +43727,6 @@ var topLevelUpdateWarnings; "and render the new components instead of calling ReactDOM.render." ); } - - if ( - container.nodeType === ELEMENT_NODE && - container.tagName && - container.tagName.toUpperCase() === "BODY" - ) { - error( - "render(): Rendering components directly into document.body is " + - "discouraged, since its children are often manipulated by third-party " + - "scripts and browser extensions. This may lead to subtle " + - "reconciliation issues. Try rendering into a container element created " + - "for your app." - ); - } }; } @@ -43800,11 +43786,7 @@ function legacyCreateRootFromDOMContainer( return root; } else { // First clear any existing content. - var rootSibling; - - while ((rootSibling = container.lastChild)) { - container.removeChild(rootSibling); - } + clearContainer(container); if (typeof callback === "function") { var _originalCallback = callback; diff --git a/compiled/facebook-www/ReactDOM-dev.modern.js b/compiled/facebook-www/ReactDOM-dev.modern.js index 2f2927fb542ac..5353c0d18ca1a 100644 --- a/compiled/facebook-www/ReactDOM-dev.modern.js +++ b/compiled/facebook-www/ReactDOM-dev.modern.js @@ -178,6 +178,242 @@ var enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler; // var enableSuspenseCallback = true; var enableCustomElementPropertySupport = true; +var randomKey = Math.random().toString(36).slice(2); +var internalInstanceKey = "__reactFiber$" + randomKey; +var internalPropsKey = "__reactProps$" + randomKey; +var internalContainerInstanceKey = "__reactContainer$" + randomKey; +var internalEventHandlersKey = "__reactEvents$" + randomKey; +var internalEventHandlerListenersKey = "__reactListeners$" + randomKey; +var internalEventHandlesSetKey = "__reactHandles$" + randomKey; +var internalRootNodeResourcesKey = "__reactResources$" + randomKey; +var internalResourceMarker = "__reactMarker$" + randomKey; +function detachDeletedInstance(node) { + // TODO: This function is only called on host components. I don't think all of + // these fields are relevant. + delete node[internalInstanceKey]; + delete node[internalPropsKey]; + delete node[internalEventHandlersKey]; + delete node[internalEventHandlerListenersKey]; + delete node[internalEventHandlesSetKey]; +} +function precacheFiberNode(hostInst, node) { + node[internalInstanceKey] = hostInst; +} +function markContainerAsRoot(hostRoot, node) { + // $FlowFixMe[prop-missing] + node[internalContainerInstanceKey] = hostRoot; +} +function unmarkContainerAsRoot(node) { + // $FlowFixMe[prop-missing] + node[internalContainerInstanceKey] = null; +} +function isContainerMarkedAsRoot(node) { + // $FlowFixMe[prop-missing] + return !!node[internalContainerInstanceKey]; +} // Given a DOM node, return the closest HostComponent or HostText fiber ancestor. +// If the target node is part of a hydrated or not yet rendered subtree, then +// this may also return a SuspenseComponent or HostRoot to indicate that. +// Conceptually the HostRoot fiber is a child of the Container node. So if you +// pass the Container node as the targetNode, you will not actually get the +// HostRoot back. To get to the HostRoot, you need to pass a child of it. +// The same thing applies to Suspense boundaries. + +function getClosestInstanceFromNode(targetNode) { + var targetInst = targetNode[internalInstanceKey]; + + if (targetInst) { + // Don't return HostRoot or SuspenseComponent here. + return targetInst; + } // If the direct event target isn't a React owned DOM node, we need to look + // to see if one of its parents is a React owned DOM node. + + var parentNode = targetNode.parentNode; + + while (parentNode) { + // We'll check if this is a container root that could include + // React nodes in the future. We need to check this first because + // if we're a child of a dehydrated container, we need to first + // find that inner container before moving on to finding the parent + // instance. Note that we don't check this field on the targetNode + // itself because the fibers are conceptually between the container + // node and the first child. It isn't surrounding the container node. + // If it's not a container, we check if it's an instance. + targetInst = + parentNode[internalContainerInstanceKey] || + parentNode[internalInstanceKey]; + + if (targetInst) { + // Since this wasn't the direct target of the event, we might have + // stepped past dehydrated DOM nodes to get here. However they could + // also have been non-React nodes. We need to answer which one. + // If we the instance doesn't have any children, then there can't be + // a nested suspense boundary within it. So we can use this as a fast + // bailout. Most of the time, when people add non-React children to + // the tree, it is using a ref to a child-less DOM node. + // Normally we'd only need to check one of the fibers because if it + // has ever gone from having children to deleting them or vice versa + // it would have deleted the dehydrated boundary nested inside already. + // However, since the HostRoot starts out with an alternate it might + // have one on the alternate so we need to check in case this was a + // root. + var alternate = targetInst.alternate; + + if ( + targetInst.child !== null || + (alternate !== null && alternate.child !== null) + ) { + // Next we need to figure out if the node that skipped past is + // nested within a dehydrated boundary and if so, which one. + var suspenseInstance = getParentSuspenseInstance(targetNode); + + while (suspenseInstance !== null) { + // We found a suspense instance. That means that we haven't + // hydrated it yet. Even though we leave the comments in the + // DOM after hydrating, and there are boundaries in the DOM + // that could already be hydrated, we wouldn't have found them + // through this pass since if the target is hydrated it would + // have had an internalInstanceKey on it. + // Let's get the fiber associated with the SuspenseComponent + // as the deepest instance. + // $FlowFixMe[prop-missing] + var targetSuspenseInst = suspenseInstance[internalInstanceKey]; + + if (targetSuspenseInst) { + return targetSuspenseInst; + } // If we don't find a Fiber on the comment, it might be because + // we haven't gotten to hydrate it yet. There might still be a + // parent boundary that hasn't above this one so we need to find + // the outer most that is known. + + suspenseInstance = getParentSuspenseInstance(suspenseInstance); // If we don't find one, then that should mean that the parent + // host component also hasn't hydrated yet. We can return it + // below since it will bail out on the isMounted check later. + } + } + + return targetInst; + } + + targetNode = parentNode; + parentNode = targetNode.parentNode; + } + + return null; +} +/** + * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent + * instance, or null if the node was not rendered by this React. + */ + +function getInstanceFromNode(node) { + var inst = node[internalInstanceKey] || node[internalContainerInstanceKey]; + + if (inst) { + var tag = inst.tag; + + if ( + tag === HostComponent || + tag === HostText || + tag === SuspenseComponent || + tag === HostResource || + tag === HostSingleton || + tag === HostRoot + ) { + return inst; + } else { + return null; + } + } + + return null; +} +/** + * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding + * DOM node. + */ + +function getNodeFromInstance(inst) { + var tag = inst.tag; + + if ( + tag === HostComponent || + tag === HostResource || + tag === HostSingleton || + tag === HostText + ) { + // In Fiber this, is just the state node right now. We assume it will be + // a host component or host text. + return inst.stateNode; + } // Without this first invariant, passing a non-DOM-component triggers the next + // invariant for a missing parent, which is super confusing. + + throw new Error("getNodeFromInstance: Invalid argument."); +} +function getFiberCurrentPropsFromNode(node) { + return node[internalPropsKey] || null; +} +function updateFiberProps(node, props) { + node[internalPropsKey] = props; +} +function getEventListenerSet(node) { + var elementListenerSet = node[internalEventHandlersKey]; + + if (elementListenerSet === undefined) { + elementListenerSet = node[internalEventHandlersKey] = new Set(); + } + + return elementListenerSet; +} +function getFiberFromScopeInstance(scope) { + { + return scope[internalInstanceKey] || null; + } +} +function setEventHandlerListeners(scope, listeners) { + scope[internalEventHandlerListenersKey] = listeners; +} +function getEventHandlerListeners(scope) { + return scope[internalEventHandlerListenersKey] || null; +} +function addEventHandleToTarget(target, eventHandle) { + var eventHandles = target[internalEventHandlesSetKey]; + + if (eventHandles === undefined) { + eventHandles = target[internalEventHandlesSetKey] = new Set(); + } + + eventHandles.add(eventHandle); +} +function doesTargetHaveEventHandle(target, eventHandle) { + var eventHandles = target[internalEventHandlesSetKey]; + + if (eventHandles === undefined) { + return false; + } + + return eventHandles.has(eventHandle); +} +function getResourcesFromRoot(root) { + var resources = root[internalRootNodeResourcesKey]; + + if (!resources) { + resources = root[internalRootNodeResourcesKey] = { + styles: new Map(), + scripts: new Map(), + head: new Map(), + lastStructuredMeta: new Map() + }; + } + + return resources; +} +function isMarkedResource(node) { + return !!node[internalResourceMarker]; +} +function markNodeAsResource(node) { + node[internalResourceMarker] = true; +} + var allNativeEvents = new Set(); { @@ -4863,7 +5099,7 @@ var restoreQueue = null; function restoreStateOfTarget(target) { // We perform this translation at the end of the event loop so that we // always receive the correct fiber here - var internalInstance = getInstanceFromNode$1(target); + var internalInstance = getInstanceFromNode(target); if (!internalInstance) { // Unmounted @@ -7257,7 +7493,7 @@ function queueDiscreteEvent( // If this was the first discrete event, we might be able to // synchronously unblock it so that preventDefault still works. while (queuedEvent.blockedOn !== null) { - var fiber = getInstanceFromNode$1(queuedEvent.blockedOn); + var fiber = getInstanceFromNode(queuedEvent.blockedOn); if (fiber === null) { break; @@ -7334,7 +7570,7 @@ function accumulateOrCreateContinuousQueuedReplayableEvent( ); if (blockedOn !== null) { - var fiber = getInstanceFromNode$1(blockedOn); + var fiber = getInstanceFromNode(blockedOn); if (fiber !== null) { // Attempt to increase the priority of this target. @@ -7559,7 +7795,7 @@ function attemptReplayContinuousQueuedEvent(queuedEvent) { } } else { // We're still blocked. Try again later. - var fiber = getInstanceFromNode$1(nextBlockedOn); + var fiber = getInstanceFromNode(nextBlockedOn); if (fiber !== null) { attemptContinuousHydration(fiber); @@ -7593,7 +7829,7 @@ function replayUnblockedEvents() { // We're still blocked. // Increase the priority of this boundary to unblock // the next discrete event. - var fiber = getInstanceFromNode$1(nextDiscreteEvent.blockedOn); + var fiber = getInstanceFromNode(nextDiscreteEvent.blockedOn); if (fiber !== null) { attemptDiscreteHydration(fiber); @@ -7981,7 +8217,7 @@ function dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEve isDiscreteEventThatRequiresHydration(domEventName) ) { while (blockedOn !== null) { - var fiber = getInstanceFromNode$1(blockedOn); + var fiber = getInstanceFromNode(blockedOn); if (fiber !== null) { attemptSynchronousHydration(fiber); @@ -15821,7 +16057,7 @@ var localRequestAnimationFrame = typeof requestAnimationFrame === "function" ? requestAnimationFrame : scheduleTimeout; -function getInstanceFromNode(node) { +function getInstanceFromNode$1(node) { return getClosestInstanceFromNode(node) || null; } function preparePortalMount(portalInstance) { @@ -16825,7 +17061,7 @@ function acquireSingletonInstance( internalInstanceHandle ) { { - var currentInstanceHandle = getInstanceFromNode$1(instance); + var currentInstanceHandle = getInstanceFromNode(instance); if (currentInstanceHandle) { var tagName = instance.tagName.toLowerCase(); @@ -16900,242 +17136,6 @@ function clearSingleton(instance) { return; } -var randomKey = Math.random().toString(36).slice(2); -var internalInstanceKey = "__reactFiber$" + randomKey; -var internalPropsKey = "__reactProps$" + randomKey; -var internalContainerInstanceKey = "__reactContainer$" + randomKey; -var internalEventHandlersKey = "__reactEvents$" + randomKey; -var internalEventHandlerListenersKey = "__reactListeners$" + randomKey; -var internalEventHandlesSetKey = "__reactHandles$" + randomKey; -var internalRootNodeResourcesKey = "__reactResources$" + randomKey; -var internalResourceMarker = "__reactMarker$" + randomKey; -function detachDeletedInstance(node) { - // TODO: This function is only called on host components. I don't think all of - // these fields are relevant. - delete node[internalInstanceKey]; - delete node[internalPropsKey]; - delete node[internalEventHandlersKey]; - delete node[internalEventHandlerListenersKey]; - delete node[internalEventHandlesSetKey]; -} -function precacheFiberNode(hostInst, node) { - node[internalInstanceKey] = hostInst; -} -function markContainerAsRoot(hostRoot, node) { - // $FlowFixMe[prop-missing] - node[internalContainerInstanceKey] = hostRoot; -} -function unmarkContainerAsRoot(node) { - // $FlowFixMe[prop-missing] - node[internalContainerInstanceKey] = null; -} -function isContainerMarkedAsRoot(node) { - // $FlowFixMe[prop-missing] - return !!node[internalContainerInstanceKey]; -} // Given a DOM node, return the closest HostComponent or HostText fiber ancestor. -// If the target node is part of a hydrated or not yet rendered subtree, then -// this may also return a SuspenseComponent or HostRoot to indicate that. -// Conceptually the HostRoot fiber is a child of the Container node. So if you -// pass the Container node as the targetNode, you will not actually get the -// HostRoot back. To get to the HostRoot, you need to pass a child of it. -// The same thing applies to Suspense boundaries. - -function getClosestInstanceFromNode(targetNode) { - var targetInst = targetNode[internalInstanceKey]; - - if (targetInst) { - // Don't return HostRoot or SuspenseComponent here. - return targetInst; - } // If the direct event target isn't a React owned DOM node, we need to look - // to see if one of its parents is a React owned DOM node. - - var parentNode = targetNode.parentNode; - - while (parentNode) { - // We'll check if this is a container root that could include - // React nodes in the future. We need to check this first because - // if we're a child of a dehydrated container, we need to first - // find that inner container before moving on to finding the parent - // instance. Note that we don't check this field on the targetNode - // itself because the fibers are conceptually between the container - // node and the first child. It isn't surrounding the container node. - // If it's not a container, we check if it's an instance. - targetInst = - parentNode[internalContainerInstanceKey] || - parentNode[internalInstanceKey]; - - if (targetInst) { - // Since this wasn't the direct target of the event, we might have - // stepped past dehydrated DOM nodes to get here. However they could - // also have been non-React nodes. We need to answer which one. - // If we the instance doesn't have any children, then there can't be - // a nested suspense boundary within it. So we can use this as a fast - // bailout. Most of the time, when people add non-React children to - // the tree, it is using a ref to a child-less DOM node. - // Normally we'd only need to check one of the fibers because if it - // has ever gone from having children to deleting them or vice versa - // it would have deleted the dehydrated boundary nested inside already. - // However, since the HostRoot starts out with an alternate it might - // have one on the alternate so we need to check in case this was a - // root. - var alternate = targetInst.alternate; - - if ( - targetInst.child !== null || - (alternate !== null && alternate.child !== null) - ) { - // Next we need to figure out if the node that skipped past is - // nested within a dehydrated boundary and if so, which one. - var suspenseInstance = getParentSuspenseInstance(targetNode); - - while (suspenseInstance !== null) { - // We found a suspense instance. That means that we haven't - // hydrated it yet. Even though we leave the comments in the - // DOM after hydrating, and there are boundaries in the DOM - // that could already be hydrated, we wouldn't have found them - // through this pass since if the target is hydrated it would - // have had an internalInstanceKey on it. - // Let's get the fiber associated with the SuspenseComponent - // as the deepest instance. - // $FlowFixMe[prop-missing] - var targetSuspenseInst = suspenseInstance[internalInstanceKey]; - - if (targetSuspenseInst) { - return targetSuspenseInst; - } // If we don't find a Fiber on the comment, it might be because - // we haven't gotten to hydrate it yet. There might still be a - // parent boundary that hasn't above this one so we need to find - // the outer most that is known. - - suspenseInstance = getParentSuspenseInstance(suspenseInstance); // If we don't find one, then that should mean that the parent - // host component also hasn't hydrated yet. We can return it - // below since it will bail out on the isMounted check later. - } - } - - return targetInst; - } - - targetNode = parentNode; - parentNode = targetNode.parentNode; - } - - return null; -} -/** - * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent - * instance, or null if the node was not rendered by this React. - */ - -function getInstanceFromNode$1(node) { - var inst = node[internalInstanceKey] || node[internalContainerInstanceKey]; - - if (inst) { - var tag = inst.tag; - - if ( - tag === HostComponent || - tag === HostText || - tag === SuspenseComponent || - tag === HostResource || - tag === HostSingleton || - tag === HostRoot - ) { - return inst; - } else { - return null; - } - } - - return null; -} -/** - * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding - * DOM node. - */ - -function getNodeFromInstance(inst) { - var tag = inst.tag; - - if ( - tag === HostComponent || - tag === HostResource || - tag === HostSingleton || - tag === HostText - ) { - // In Fiber this, is just the state node right now. We assume it will be - // a host component or host text. - return inst.stateNode; - } // Without this first invariant, passing a non-DOM-component triggers the next - // invariant for a missing parent, which is super confusing. - - throw new Error("getNodeFromInstance: Invalid argument."); -} -function getFiberCurrentPropsFromNode(node) { - return node[internalPropsKey] || null; -} -function updateFiberProps(node, props) { - node[internalPropsKey] = props; -} -function getEventListenerSet(node) { - var elementListenerSet = node[internalEventHandlersKey]; - - if (elementListenerSet === undefined) { - elementListenerSet = node[internalEventHandlersKey] = new Set(); - } - - return elementListenerSet; -} -function getFiberFromScopeInstance(scope) { - { - return scope[internalInstanceKey] || null; - } -} -function setEventHandlerListeners(scope, listeners) { - scope[internalEventHandlerListenersKey] = listeners; -} -function getEventHandlerListeners(scope) { - return scope[internalEventHandlerListenersKey] || null; -} -function addEventHandleToTarget(target, eventHandle) { - var eventHandles = target[internalEventHandlesSetKey]; - - if (eventHandles === undefined) { - eventHandles = target[internalEventHandlesSetKey] = new Set(); - } - - eventHandles.add(eventHandle); -} -function doesTargetHaveEventHandle(target, eventHandle) { - var eventHandles = target[internalEventHandlesSetKey]; - - if (eventHandles === undefined) { - return false; - } - - return eventHandles.has(eventHandle); -} -function getResourcesFromRoot(root) { - var resources = root[internalRootNodeResourcesKey]; - - if (!resources) { - resources = root[internalRootNodeResourcesKey] = { - styles: new Map(), - scripts: new Map(), - head: new Map(), - lastStructuredMeta: new Map() - }; - } - - return resources; -} -function isMarkedResource(node) { - return !!node[internalResourceMarker]; -} -function markNodeAsResource(node) { - node[internalResourceMarker] = true; -} - var loggedTypeFailures = {}; var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; @@ -31755,7 +31755,7 @@ function DO_NOT_USE_queryFirstNode(fn) { } function containsNode$1(node) { - var fiber = getInstanceFromNode(node); + var fiber = getInstanceFromNode$1(node); while (fiber !== null) { if (fiber.tag === ScopeComponent && fiber.stateNode === this) { @@ -42419,7 +42419,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-758fc7fde-20230207"; +var ReactVersion = "18.3.0-www-modern-a3152eda5-20230208"; function createPortal( children, @@ -43514,7 +43514,7 @@ function flushSync$1(fn) { // This is an array for better minification. Internals.Events = [ - getInstanceFromNode$1, + getInstanceFromNode, getNodeFromInstance, getFiberCurrentPropsFromNode, enqueueStateRestore, diff --git a/compiled/facebook-www/ReactDOM-prod.classic.js b/compiled/facebook-www/ReactDOM-prod.classic.js index e53cb3460d18c..a9422e38ed9eb 100644 --- a/compiled/facebook-www/ReactDOM-prod.classic.js +++ b/compiled/facebook-www/ReactDOM-prod.classic.js @@ -2716,6 +2716,22 @@ function clearSuspenseBoundary(parentInstance, suspenseInstance) { } while (node); retryIfBlockedOn(suspenseInstance); } +function clearContainer(container) { + var nodeType = container.nodeType; + if (9 === nodeType) + clearRootResources(container), clearContainerSparingly(container); + else if (1 === nodeType) + switch (container.nodeName) { + case "HEAD": + clearRootResources(container); + case "HTML": + case "BODY": + clearContainerSparingly(container); + break; + default: + container.textContent = ""; + } +} function clearContainerSparingly(container) { var nextNode = container.firstChild; nextNode && 10 === nextNode.nodeType && (nextNode = nextNode.nextSibling); @@ -10909,24 +10925,8 @@ function commitBeforeMutationEffects(root, firstChild) { } break; case 3: - if (0 !== (flags & 1024)) { - var container = firstChild.stateNode.containerInfo, - nodeType = container.nodeType; - if (9 === nodeType) - clearRootResources(container), - clearContainerSparingly(container); - else if (1 === nodeType) - switch (container.nodeName) { - case "HEAD": - clearRootResources(container); - case "HTML": - case "BODY": - clearContainerSparingly(container); - break; - default: - container.textContent = ""; - } - } + 0 !== (flags & 1024) && + clearContainer(firstChild.stateNode.containerInfo); break; case 5: case 26: @@ -15395,8 +15395,7 @@ function legacyCreateRootFromDOMContainer( flushSync(); return root$228; } - for (; (isHydrationContainer = container.lastChild); ) - container.removeChild(isHydrationContainer); + clearContainer(container); if ("function" === typeof callback) { var originalCallback$229 = callback; callback = function () { @@ -15576,7 +15575,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1750 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-758fc7fde-20230207", + version: "18.3.0-www-classic-a3152eda5-20230208", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2134 = { @@ -15606,7 +15605,7 @@ var internals$jscomp$inline_2134 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-758fc7fde-20230207" + reconcilerVersion: "18.3.0-next-a3152eda5-20230208" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2135 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15854,4 +15853,4 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-758fc7fde-20230207"; +exports.version = "18.3.0-next-a3152eda5-20230208"; diff --git a/compiled/facebook-www/ReactDOM-prod.modern.js b/compiled/facebook-www/ReactDOM-prod.modern.js index aaa7425f0351e..3d113255e4749 100644 --- a/compiled/facebook-www/ReactDOM-prod.modern.js +++ b/compiled/facebook-www/ReactDOM-prod.modern.js @@ -61,7 +61,105 @@ var dynamicFeatureFlags = require("ReactFeatureFlags"), enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = dynamicFeatureFlags.enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay, enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing, - allNativeEvents = new Set(); + randomKey = Math.random().toString(36).slice(2), + internalInstanceKey = "__reactFiber$" + randomKey, + internalPropsKey = "__reactProps$" + randomKey, + internalContainerInstanceKey = "__reactContainer$" + randomKey, + internalEventHandlersKey = "__reactEvents$" + randomKey, + internalEventHandlerListenersKey = "__reactListeners$" + randomKey, + internalEventHandlesSetKey = "__reactHandles$" + randomKey, + internalRootNodeResourcesKey = "__reactResources$" + randomKey, + internalResourceMarker = "__reactMarker$" + randomKey; +function detachDeletedInstance(node) { + delete node[internalInstanceKey]; + delete node[internalPropsKey]; + delete node[internalEventHandlersKey]; + delete node[internalEventHandlerListenersKey]; + delete node[internalEventHandlesSetKey]; +} +function getClosestInstanceFromNode(targetNode) { + var targetInst = targetNode[internalInstanceKey]; + if (targetInst) return targetInst; + for (var parentNode = targetNode.parentNode; parentNode; ) { + if ( + (targetInst = + parentNode[internalContainerInstanceKey] || + parentNode[internalInstanceKey]) + ) { + parentNode = targetInst.alternate; + if ( + null !== targetInst.child || + (null !== parentNode && null !== parentNode.child) + ) + for ( + targetNode = getParentSuspenseInstance(targetNode); + null !== targetNode; + + ) { + if ((parentNode = targetNode[internalInstanceKey])) return parentNode; + targetNode = getParentSuspenseInstance(targetNode); + } + return targetInst; + } + targetNode = parentNode; + parentNode = targetNode.parentNode; + } + return null; +} +function getInstanceFromNode(node) { + if ( + (node = node[internalInstanceKey] || node[internalContainerInstanceKey]) + ) { + var tag = node.tag; + if ( + 5 === tag || + 6 === tag || + 13 === tag || + 26 === tag || + 27 === tag || + 3 === tag + ) + return node; + } + return null; +} +function getNodeFromInstance(inst) { + var tag = inst.tag; + if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return inst.stateNode; + throw Error(formatProdErrorMessage(33)); +} +function getFiberCurrentPropsFromNode(node) { + return node[internalPropsKey] || null; +} +function getEventListenerSet(node) { + var elementListenerSet = node[internalEventHandlersKey]; + void 0 === elementListenerSet && + (elementListenerSet = node[internalEventHandlersKey] = new Set()); + return elementListenerSet; +} +function addEventHandleToTarget(target, eventHandle) { + var eventHandles = target[internalEventHandlesSetKey]; + void 0 === eventHandles && + (eventHandles = target[internalEventHandlesSetKey] = new Set()); + eventHandles.add(eventHandle); +} +function doesTargetHaveEventHandle(target, eventHandle) { + target = target[internalEventHandlesSetKey]; + return void 0 === target ? !1 : target.has(eventHandle); +} +function getResourcesFromRoot(root) { + var resources = root[internalRootNodeResourcesKey]; + resources || + (resources = root[internalRootNodeResourcesKey] = + { + styles: new Map(), + scripts: new Map(), + head: new Map(), + lastStructuredMeta: new Map() + }); + return resources; +} +var allNativeEvents = new Set(); allNativeEvents.add("beforeblur"); allNativeEvents.add("afterblur"); var registrationNameDependencies = {}; @@ -994,7 +1092,7 @@ var restoreImpl = null, restoreTarget = null, restoreQueue = null; function restoreStateOfTarget(target) { - if ((target = getInstanceFromNode$1(target))) { + if ((target = getInstanceFromNode(target))) { if ("function" !== typeof restoreImpl) throw Error(formatProdErrorMessage(280)); var stateNode = target.stateNode; @@ -1612,7 +1710,7 @@ function queueDiscreteEvent( 1 === queuedDiscreteEvents.length) ) for (; null !== blockedOn.blockedOn; ) { - domEventName = getInstanceFromNode$1(blockedOn.blockedOn); + domEventName = getInstanceFromNode(blockedOn.blockedOn); if (null === domEventName) break; _attemptSynchronousHydration(domEventName); if (null === blockedOn.blockedOn) replayUnblockedEvents(); @@ -1663,7 +1761,7 @@ function accumulateOrCreateContinuousQueuedReplayableEvent( nativeEvent )), null !== blockedOn && - ((blockedOn = getInstanceFromNode$1(blockedOn)), + ((blockedOn = getInstanceFromNode(blockedOn)), null !== blockedOn && attemptContinuousHydration(blockedOn)), existingQueuedEvent ); @@ -1811,7 +1909,7 @@ function attemptReplayContinuousQueuedEvent(queuedEvent) { (currentReplayingEvent = null); else return ( - (targetContainers = getInstanceFromNode$1(nextBlockedOn)), + (targetContainers = getInstanceFromNode(nextBlockedOn)), null !== targetContainers && attemptContinuousHydration(targetContainers), (queuedEvent.blockedOn = nextBlockedOn), @@ -1830,7 +1928,7 @@ function replayUnblockedEvents() { for (; 0 < queuedDiscreteEvents.length; ) { var nextDiscreteEvent = queuedDiscreteEvents[0]; if (null !== nextDiscreteEvent.blockedOn) { - nextDiscreteEvent = getInstanceFromNode$1(nextDiscreteEvent.blockedOn); + nextDiscreteEvent = getInstanceFromNode(nextDiscreteEvent.blockedOn); null !== nextDiscreteEvent && attemptDiscreteHydration(nextDiscreteEvent); break; @@ -2014,7 +2112,7 @@ function dispatchEvent( -1 < discreteReplayableEvents.indexOf(domEventName)) ) { for (; null !== blockedOn; ) { - var fiber = getInstanceFromNode$1(blockedOn); + var fiber = getInstanceFromNode(blockedOn); null !== fiber && _attemptSynchronousHydration(fiber); fiber = findInstanceBlockingEvent( domEventName, @@ -2722,7 +2820,7 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$246; + var JSCompiler_inline_result$jscomp$247; if (canUseDOM) { var isSupported$jscomp$inline_408 = "oninput" in document; if (!isSupported$jscomp$inline_408) { @@ -2731,10 +2829,10 @@ if (canUseDOM) { isSupported$jscomp$inline_408 = "function" === typeof element$jscomp$inline_409.oninput; } - JSCompiler_inline_result$jscomp$246 = isSupported$jscomp$inline_408; - } else JSCompiler_inline_result$jscomp$246 = !1; + JSCompiler_inline_result$jscomp$247 = isSupported$jscomp$inline_408; + } else JSCompiler_inline_result$jscomp$247 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$246 && + JSCompiler_inline_result$jscomp$247 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -5065,104 +5163,6 @@ function resolveSingletonInstance(type, props, rootContainerInstance) { throw Error(formatProdErrorMessage(451)); } } -var randomKey = Math.random().toString(36).slice(2), - internalInstanceKey = "__reactFiber$" + randomKey, - internalPropsKey = "__reactProps$" + randomKey, - internalContainerInstanceKey = "__reactContainer$" + randomKey, - internalEventHandlersKey = "__reactEvents$" + randomKey, - internalEventHandlerListenersKey = "__reactListeners$" + randomKey, - internalEventHandlesSetKey = "__reactHandles$" + randomKey, - internalRootNodeResourcesKey = "__reactResources$" + randomKey, - internalResourceMarker = "__reactMarker$" + randomKey; -function detachDeletedInstance(node) { - delete node[internalInstanceKey]; - delete node[internalPropsKey]; - delete node[internalEventHandlersKey]; - delete node[internalEventHandlerListenersKey]; - delete node[internalEventHandlesSetKey]; -} -function getClosestInstanceFromNode(targetNode) { - var targetInst = targetNode[internalInstanceKey]; - if (targetInst) return targetInst; - for (var parentNode = targetNode.parentNode; parentNode; ) { - if ( - (targetInst = - parentNode[internalContainerInstanceKey] || - parentNode[internalInstanceKey]) - ) { - parentNode = targetInst.alternate; - if ( - null !== targetInst.child || - (null !== parentNode && null !== parentNode.child) - ) - for ( - targetNode = getParentSuspenseInstance(targetNode); - null !== targetNode; - - ) { - if ((parentNode = targetNode[internalInstanceKey])) return parentNode; - targetNode = getParentSuspenseInstance(targetNode); - } - return targetInst; - } - targetNode = parentNode; - parentNode = targetNode.parentNode; - } - return null; -} -function getInstanceFromNode$1(node) { - if ( - (node = node[internalInstanceKey] || node[internalContainerInstanceKey]) - ) { - var tag = node.tag; - if ( - 5 === tag || - 6 === tag || - 13 === tag || - 26 === tag || - 27 === tag || - 3 === tag - ) - return node; - } - return null; -} -function getNodeFromInstance(inst) { - var tag = inst.tag; - if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return inst.stateNode; - throw Error(formatProdErrorMessage(33)); -} -function getFiberCurrentPropsFromNode(node) { - return node[internalPropsKey] || null; -} -function getEventListenerSet(node) { - var elementListenerSet = node[internalEventHandlersKey]; - void 0 === elementListenerSet && - (elementListenerSet = node[internalEventHandlersKey] = new Set()); - return elementListenerSet; -} -function addEventHandleToTarget(target, eventHandle) { - var eventHandles = target[internalEventHandlesSetKey]; - void 0 === eventHandles && - (eventHandles = target[internalEventHandlesSetKey] = new Set()); - eventHandles.add(eventHandle); -} -function doesTargetHaveEventHandle(target, eventHandle) { - target = target[internalEventHandlesSetKey]; - return void 0 === target ? !1 : target.has(eventHandle); -} -function getResourcesFromRoot(root) { - var resources = root[internalRootNodeResourcesKey]; - resources || - (resources = root[internalRootNodeResourcesKey] = - { - styles: new Map(), - scripts: new Map(), - head: new Map(), - lastStructuredMeta: new Map() - }); - return resources; -} var emptyContextObject = {}, syncQueue = null, includesLegacySyncCallbacks = !1, @@ -15126,7 +15126,7 @@ restoreImpl = function (domElement, tag, props) { batchedUpdatesImpl = batchedUpdates$1; flushSyncImpl = flushSync; Internals.Events = [ - getInstanceFromNode$1, + getInstanceFromNode, getNodeFromInstance, getFiberCurrentPropsFromNode, enqueueStateRestore, @@ -15136,7 +15136,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1718 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-758fc7fde-20230207", + version: "18.3.0-www-modern-a3152eda5-20230208", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2109 = { @@ -15167,7 +15167,7 @@ var internals$jscomp$inline_2109 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-758fc7fde-20230207" + reconcilerVersion: "18.3.0-next-a3152eda5-20230208" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2110 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -15355,4 +15355,4 @@ exports.unstable_flushControlled = function (fn) { } }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-758fc7fde-20230207"; +exports.version = "18.3.0-next-a3152eda5-20230208"; diff --git a/compiled/facebook-www/ReactDOM-profiling.classic.js b/compiled/facebook-www/ReactDOM-profiling.classic.js index f2b924add7321..07d82366b7982 100644 --- a/compiled/facebook-www/ReactDOM-profiling.classic.js +++ b/compiled/facebook-www/ReactDOM-profiling.classic.js @@ -2864,6 +2864,22 @@ function clearSuspenseBoundary(parentInstance, suspenseInstance) { } while (node); retryIfBlockedOn(suspenseInstance); } +function clearContainer(container) { + var nodeType = container.nodeType; + if (9 === nodeType) + clearRootResources(container), clearContainerSparingly(container); + else if (1 === nodeType) + switch (container.nodeName) { + case "HEAD": + clearRootResources(container); + case "HTML": + case "BODY": + clearContainerSparingly(container); + break; + default: + container.textContent = ""; + } +} function clearContainerSparingly(container) { var nextNode = container.firstChild; nextNode && 10 === nextNode.nodeType && (nextNode = nextNode.nextSibling); @@ -11259,24 +11275,8 @@ function commitBeforeMutationEffects(root, firstChild) { } break; case 3: - if (0 !== (flags & 1024)) { - var container = firstChild.stateNode.containerInfo, - nodeType = container.nodeType; - if (9 === nodeType) - clearRootResources(container), - clearContainerSparingly(container); - else if (1 === nodeType) - switch (container.nodeName) { - case "HEAD": - clearRootResources(container); - case "HTML": - case "BODY": - clearContainerSparingly(container); - break; - default: - container.textContent = ""; - } - } + 0 !== (flags & 1024) && + clearContainer(firstChild.stateNode.containerInfo); break; case 5: case 26: @@ -16165,8 +16165,7 @@ function legacyCreateRootFromDOMContainer( flushSync(); return root$249; } - for (; (isHydrationContainer = container.lastChild); ) - container.removeChild(isHydrationContainer); + clearContainer(container); if ("function" === typeof callback) { var originalCallback$250 = callback; callback = function () { @@ -16346,7 +16345,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1824 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-758fc7fde-20230207", + version: "18.3.0-www-classic-a3152eda5-20230208", rendererPackageName: "react-dom" }; (function (internals) { @@ -16390,7 +16389,7 @@ var devToolsConfig$jscomp$inline_1824 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-758fc7fde-20230207" + reconcilerVersion: "18.3.0-next-a3152eda5-20230208" }); assign(Internals, { ReactBrowserEventEmitter: { @@ -16625,7 +16624,7 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-758fc7fde-20230207"; +exports.version = "18.3.0-next-a3152eda5-20230208"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOM-profiling.modern.js b/compiled/facebook-www/ReactDOM-profiling.modern.js index f2b971cd413cc..bba05f23c5bc0 100644 --- a/compiled/facebook-www/ReactDOM-profiling.modern.js +++ b/compiled/facebook-www/ReactDOM-profiling.modern.js @@ -75,7 +75,105 @@ var dynamicFeatureFlags = require("ReactFeatureFlags"), enableProfilerNestedUpdateScheduledHook = dynamicFeatureFlags.enableProfilerNestedUpdateScheduledHook, enableSchedulingProfiler = dynamicFeatureFlags.enableSchedulingProfiler, - allNativeEvents = new Set(); + randomKey = Math.random().toString(36).slice(2), + internalInstanceKey = "__reactFiber$" + randomKey, + internalPropsKey = "__reactProps$" + randomKey, + internalContainerInstanceKey = "__reactContainer$" + randomKey, + internalEventHandlersKey = "__reactEvents$" + randomKey, + internalEventHandlerListenersKey = "__reactListeners$" + randomKey, + internalEventHandlesSetKey = "__reactHandles$" + randomKey, + internalRootNodeResourcesKey = "__reactResources$" + randomKey, + internalResourceMarker = "__reactMarker$" + randomKey; +function detachDeletedInstance(node) { + delete node[internalInstanceKey]; + delete node[internalPropsKey]; + delete node[internalEventHandlersKey]; + delete node[internalEventHandlerListenersKey]; + delete node[internalEventHandlesSetKey]; +} +function getClosestInstanceFromNode(targetNode) { + var targetInst = targetNode[internalInstanceKey]; + if (targetInst) return targetInst; + for (var parentNode = targetNode.parentNode; parentNode; ) { + if ( + (targetInst = + parentNode[internalContainerInstanceKey] || + parentNode[internalInstanceKey]) + ) { + parentNode = targetInst.alternate; + if ( + null !== targetInst.child || + (null !== parentNode && null !== parentNode.child) + ) + for ( + targetNode = getParentSuspenseInstance(targetNode); + null !== targetNode; + + ) { + if ((parentNode = targetNode[internalInstanceKey])) return parentNode; + targetNode = getParentSuspenseInstance(targetNode); + } + return targetInst; + } + targetNode = parentNode; + parentNode = targetNode.parentNode; + } + return null; +} +function getInstanceFromNode(node) { + if ( + (node = node[internalInstanceKey] || node[internalContainerInstanceKey]) + ) { + var tag = node.tag; + if ( + 5 === tag || + 6 === tag || + 13 === tag || + 26 === tag || + 27 === tag || + 3 === tag + ) + return node; + } + return null; +} +function getNodeFromInstance(inst) { + var tag = inst.tag; + if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return inst.stateNode; + throw Error(formatProdErrorMessage(33)); +} +function getFiberCurrentPropsFromNode(node) { + return node[internalPropsKey] || null; +} +function getEventListenerSet(node) { + var elementListenerSet = node[internalEventHandlersKey]; + void 0 === elementListenerSet && + (elementListenerSet = node[internalEventHandlersKey] = new Set()); + return elementListenerSet; +} +function addEventHandleToTarget(target, eventHandle) { + var eventHandles = target[internalEventHandlesSetKey]; + void 0 === eventHandles && + (eventHandles = target[internalEventHandlesSetKey] = new Set()); + eventHandles.add(eventHandle); +} +function doesTargetHaveEventHandle(target, eventHandle) { + target = target[internalEventHandlesSetKey]; + return void 0 === target ? !1 : target.has(eventHandle); +} +function getResourcesFromRoot(root) { + var resources = root[internalRootNodeResourcesKey]; + resources || + (resources = root[internalRootNodeResourcesKey] = + { + styles: new Map(), + scripts: new Map(), + head: new Map(), + lastStructuredMeta: new Map() + }); + return resources; +} +var allNativeEvents = new Set(); allNativeEvents.add("beforeblur"); allNativeEvents.add("afterblur"); var registrationNameDependencies = {}; @@ -1008,7 +1106,7 @@ var restoreImpl = null, restoreTarget = null, restoreQueue = null; function restoreStateOfTarget(target) { - if ((target = getInstanceFromNode$1(target))) { + if ((target = getInstanceFromNode(target))) { if ("function" !== typeof restoreImpl) throw Error(formatProdErrorMessage(280)); var stateNode = target.stateNode; @@ -1756,7 +1854,7 @@ function queueDiscreteEvent( 1 === queuedDiscreteEvents.length) ) for (; null !== blockedOn.blockedOn; ) { - domEventName = getInstanceFromNode$1(blockedOn.blockedOn); + domEventName = getInstanceFromNode(blockedOn.blockedOn); if (null === domEventName) break; _attemptSynchronousHydration(domEventName); if (null === blockedOn.blockedOn) replayUnblockedEvents(); @@ -1807,7 +1905,7 @@ function accumulateOrCreateContinuousQueuedReplayableEvent( nativeEvent )), null !== blockedOn && - ((blockedOn = getInstanceFromNode$1(blockedOn)), + ((blockedOn = getInstanceFromNode(blockedOn)), null !== blockedOn && attemptContinuousHydration(blockedOn)), existingQueuedEvent ); @@ -1955,7 +2053,7 @@ function attemptReplayContinuousQueuedEvent(queuedEvent) { (currentReplayingEvent = null); else return ( - (targetContainers = getInstanceFromNode$1(nextBlockedOn)), + (targetContainers = getInstanceFromNode(nextBlockedOn)), null !== targetContainers && attemptContinuousHydration(targetContainers), (queuedEvent.blockedOn = nextBlockedOn), @@ -1974,7 +2072,7 @@ function replayUnblockedEvents() { for (; 0 < queuedDiscreteEvents.length; ) { var nextDiscreteEvent = queuedDiscreteEvents[0]; if (null !== nextDiscreteEvent.blockedOn) { - nextDiscreteEvent = getInstanceFromNode$1(nextDiscreteEvent.blockedOn); + nextDiscreteEvent = getInstanceFromNode(nextDiscreteEvent.blockedOn); null !== nextDiscreteEvent && attemptDiscreteHydration(nextDiscreteEvent); break; @@ -2158,7 +2256,7 @@ function dispatchEvent( -1 < discreteReplayableEvents.indexOf(domEventName)) ) { for (; null !== blockedOn; ) { - var fiber = getInstanceFromNode$1(blockedOn); + var fiber = getInstanceFromNode(blockedOn); null !== fiber && _attemptSynchronousHydration(fiber); fiber = findInstanceBlockingEvent( domEventName, @@ -2866,7 +2964,7 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$267; + var JSCompiler_inline_result$jscomp$268; if (canUseDOM) { var isSupported$jscomp$inline_429 = "oninput" in document; if (!isSupported$jscomp$inline_429) { @@ -2875,10 +2973,10 @@ if (canUseDOM) { isSupported$jscomp$inline_429 = "function" === typeof element$jscomp$inline_430.oninput; } - JSCompiler_inline_result$jscomp$267 = isSupported$jscomp$inline_429; - } else JSCompiler_inline_result$jscomp$267 = !1; + JSCompiler_inline_result$jscomp$268 = isSupported$jscomp$inline_429; + } else JSCompiler_inline_result$jscomp$268 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$267 && + JSCompiler_inline_result$jscomp$268 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -5209,104 +5307,6 @@ function resolveSingletonInstance(type, props, rootContainerInstance) { throw Error(formatProdErrorMessage(451)); } } -var randomKey = Math.random().toString(36).slice(2), - internalInstanceKey = "__reactFiber$" + randomKey, - internalPropsKey = "__reactProps$" + randomKey, - internalContainerInstanceKey = "__reactContainer$" + randomKey, - internalEventHandlersKey = "__reactEvents$" + randomKey, - internalEventHandlerListenersKey = "__reactListeners$" + randomKey, - internalEventHandlesSetKey = "__reactHandles$" + randomKey, - internalRootNodeResourcesKey = "__reactResources$" + randomKey, - internalResourceMarker = "__reactMarker$" + randomKey; -function detachDeletedInstance(node) { - delete node[internalInstanceKey]; - delete node[internalPropsKey]; - delete node[internalEventHandlersKey]; - delete node[internalEventHandlerListenersKey]; - delete node[internalEventHandlesSetKey]; -} -function getClosestInstanceFromNode(targetNode) { - var targetInst = targetNode[internalInstanceKey]; - if (targetInst) return targetInst; - for (var parentNode = targetNode.parentNode; parentNode; ) { - if ( - (targetInst = - parentNode[internalContainerInstanceKey] || - parentNode[internalInstanceKey]) - ) { - parentNode = targetInst.alternate; - if ( - null !== targetInst.child || - (null !== parentNode && null !== parentNode.child) - ) - for ( - targetNode = getParentSuspenseInstance(targetNode); - null !== targetNode; - - ) { - if ((parentNode = targetNode[internalInstanceKey])) return parentNode; - targetNode = getParentSuspenseInstance(targetNode); - } - return targetInst; - } - targetNode = parentNode; - parentNode = targetNode.parentNode; - } - return null; -} -function getInstanceFromNode$1(node) { - if ( - (node = node[internalInstanceKey] || node[internalContainerInstanceKey]) - ) { - var tag = node.tag; - if ( - 5 === tag || - 6 === tag || - 13 === tag || - 26 === tag || - 27 === tag || - 3 === tag - ) - return node; - } - return null; -} -function getNodeFromInstance(inst) { - var tag = inst.tag; - if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return inst.stateNode; - throw Error(formatProdErrorMessage(33)); -} -function getFiberCurrentPropsFromNode(node) { - return node[internalPropsKey] || null; -} -function getEventListenerSet(node) { - var elementListenerSet = node[internalEventHandlersKey]; - void 0 === elementListenerSet && - (elementListenerSet = node[internalEventHandlersKey] = new Set()); - return elementListenerSet; -} -function addEventHandleToTarget(target, eventHandle) { - var eventHandles = target[internalEventHandlesSetKey]; - void 0 === eventHandles && - (eventHandles = target[internalEventHandlesSetKey] = new Set()); - eventHandles.add(eventHandle); -} -function doesTargetHaveEventHandle(target, eventHandle) { - target = target[internalEventHandlesSetKey]; - return void 0 === target ? !1 : target.has(eventHandle); -} -function getResourcesFromRoot(root) { - var resources = root[internalRootNodeResourcesKey]; - resources || - (resources = root[internalRootNodeResourcesKey] = - { - styles: new Map(), - scripts: new Map(), - head: new Map(), - lastStructuredMeta: new Map() - }); - return resources; -} var emptyContextObject = {}, syncQueue = null, includesLegacySyncCallbacks = !1, @@ -15886,7 +15886,7 @@ restoreImpl = function (domElement, tag, props) { batchedUpdatesImpl = batchedUpdates$1; flushSyncImpl = flushSync; Internals.Events = [ - getInstanceFromNode$1, + getInstanceFromNode, getNodeFromInstance, getFiberCurrentPropsFromNode, enqueueStateRestore, @@ -15896,7 +15896,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1792 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-758fc7fde-20230207", + version: "18.3.0-www-modern-a3152eda5-20230208", rendererPackageName: "react-dom" }; (function (internals) { @@ -15941,7 +15941,7 @@ var devToolsConfig$jscomp$inline_1792 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-758fc7fde-20230207" + reconcilerVersion: "18.3.0-next-a3152eda5-20230208" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.createPortal = function (children, container) { @@ -16116,7 +16116,7 @@ exports.unstable_flushControlled = function (fn) { } }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-758fc7fde-20230207"; +exports.version = "18.3.0-next-a3152eda5-20230208"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOMServer-dev.classic.js b/compiled/facebook-www/ReactDOMServer-dev.classic.js index 7e77d8cf0c420..b10cf6c814df8 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 = "18.3.0-www-classic-758fc7fde-20230207"; +var ReactVersion = "18.3.0-www-classic-a3152eda5-20230208"; // This refers to a WWW module. var warningWWW = require("warning"); diff --git a/compiled/facebook-www/ReactDOMServer-dev.modern.js b/compiled/facebook-www/ReactDOMServer-dev.modern.js index b7dcdcedd2b41..b7dcced873f41 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 = "18.3.0-www-modern-758fc7fde-20230207"; +var ReactVersion = "18.3.0-www-modern-a3152eda5-20230208"; // This refers to a WWW module. var warningWWW = require("warning"); diff --git a/compiled/facebook-www/ReactDOMServer-prod.classic.js b/compiled/facebook-www/ReactDOMServer-prod.classic.js index 7cebf0495b99b..c1a47c7fe6ea8 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.classic.js +++ b/compiled/facebook-www/ReactDOMServer-prod.classic.js @@ -3634,4 +3634,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "18.3.0-www-classic-758fc7fde-20230207"; +exports.version = "18.3.0-www-classic-a3152eda5-20230208"; diff --git a/compiled/facebook-www/ReactDOMServer-prod.modern.js b/compiled/facebook-www/ReactDOMServer-prod.modern.js index 34ae59819de72..53b5682490de8 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.modern.js +++ b/compiled/facebook-www/ReactDOMServer-prod.modern.js @@ -3548,4 +3548,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "18.3.0-www-modern-758fc7fde-20230207"; +exports.version = "18.3.0-www-modern-a3152eda5-20230208"; diff --git a/compiled/facebook-www/ReactDOMTesting-dev.classic.js b/compiled/facebook-www/ReactDOMTesting-dev.classic.js index cd467e04b598f..fb647a7889eeb 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.classic.js @@ -31212,7 +31212,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-758fc7fde-20230207"; +var ReactVersion = "18.3.0-www-classic-a3152eda5-20230208"; function createPortal( children, @@ -32215,20 +32215,6 @@ var topLevelUpdateWarnings; "and render the new components instead of calling ReactDOM.render." ); } - - if ( - container.nodeType === ELEMENT_NODE && - container.tagName && - container.tagName.toUpperCase() === "BODY" - ) { - error( - "render(): Rendering components directly into document.body is " + - "discouraged, since its children are often manipulated by third-party " + - "scripts and browser extensions. This may lead to subtle " + - "reconciliation issues. Try rendering into a container element created " + - "for your app." - ); - } }; } @@ -32287,11 +32273,7 @@ function legacyCreateRootFromDOMContainer( return root; } else { // First clear any existing content. - var rootSibling; - - while ((rootSibling = container.lastChild)) { - container.removeChild(rootSibling); - } + clearContainer(container); if (typeof callback === "function") { var _originalCallback = callback; diff --git a/compiled/facebook-www/ReactDOMTesting-dev.modern.js b/compiled/facebook-www/ReactDOMTesting-dev.modern.js index 04c7462a90e11..2c8f83ce452fd 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.modern.js @@ -118,6 +118,253 @@ var TracingMarkerComponent = 25; var HostResource = 26; var HostSingleton = 27; +var debugRenderPhaseSideEffectsForStrictMode = false; +var enableSchedulingProfiler = false; +var enableProfilerTimer = false; +var disableCommentsAsDOMContainers = true; +var enableSuspenseCallback = true; +var enableClientRenderFallbackOnTextMismatch = true; +var createRootStrictEffectsByDefault = false; +var enableLazyContextPropagation = false; +var enableLegacyHidden = false; +var enableCustomElementPropertySupport = false; + +var randomKey = Math.random().toString(36).slice(2); +var internalInstanceKey = "__reactFiber$" + randomKey; +var internalPropsKey = "__reactProps$" + randomKey; +var internalContainerInstanceKey = "__reactContainer$" + randomKey; +var internalEventHandlersKey = "__reactEvents$" + randomKey; +var internalEventHandlerListenersKey = "__reactListeners$" + randomKey; +var internalEventHandlesSetKey = "__reactHandles$" + randomKey; +var internalRootNodeResourcesKey = "__reactResources$" + randomKey; +var internalResourceMarker = "__reactMarker$" + randomKey; +function detachDeletedInstance(node) { + // TODO: This function is only called on host components. I don't think all of + // these fields are relevant. + delete node[internalInstanceKey]; + delete node[internalPropsKey]; + delete node[internalEventHandlersKey]; + delete node[internalEventHandlerListenersKey]; + delete node[internalEventHandlesSetKey]; +} +function precacheFiberNode(hostInst, node) { + node[internalInstanceKey] = hostInst; +} +function markContainerAsRoot(hostRoot, node) { + // $FlowFixMe[prop-missing] + node[internalContainerInstanceKey] = hostRoot; +} +function unmarkContainerAsRoot(node) { + // $FlowFixMe[prop-missing] + node[internalContainerInstanceKey] = null; +} +function isContainerMarkedAsRoot(node) { + // $FlowFixMe[prop-missing] + return !!node[internalContainerInstanceKey]; +} // Given a DOM node, return the closest HostComponent or HostText fiber ancestor. +// If the target node is part of a hydrated or not yet rendered subtree, then +// this may also return a SuspenseComponent or HostRoot to indicate that. +// Conceptually the HostRoot fiber is a child of the Container node. So if you +// pass the Container node as the targetNode, you will not actually get the +// HostRoot back. To get to the HostRoot, you need to pass a child of it. +// The same thing applies to Suspense boundaries. + +function getClosestInstanceFromNode(targetNode) { + var targetInst = targetNode[internalInstanceKey]; + + if (targetInst) { + // Don't return HostRoot or SuspenseComponent here. + return targetInst; + } // If the direct event target isn't a React owned DOM node, we need to look + // to see if one of its parents is a React owned DOM node. + + var parentNode = targetNode.parentNode; + + while (parentNode) { + // We'll check if this is a container root that could include + // React nodes in the future. We need to check this first because + // if we're a child of a dehydrated container, we need to first + // find that inner container before moving on to finding the parent + // instance. Note that we don't check this field on the targetNode + // itself because the fibers are conceptually between the container + // node and the first child. It isn't surrounding the container node. + // If it's not a container, we check if it's an instance. + targetInst = + parentNode[internalContainerInstanceKey] || + parentNode[internalInstanceKey]; + + if (targetInst) { + // Since this wasn't the direct target of the event, we might have + // stepped past dehydrated DOM nodes to get here. However they could + // also have been non-React nodes. We need to answer which one. + // If we the instance doesn't have any children, then there can't be + // a nested suspense boundary within it. So we can use this as a fast + // bailout. Most of the time, when people add non-React children to + // the tree, it is using a ref to a child-less DOM node. + // Normally we'd only need to check one of the fibers because if it + // has ever gone from having children to deleting them or vice versa + // it would have deleted the dehydrated boundary nested inside already. + // However, since the HostRoot starts out with an alternate it might + // have one on the alternate so we need to check in case this was a + // root. + var alternate = targetInst.alternate; + + if ( + targetInst.child !== null || + (alternate !== null && alternate.child !== null) + ) { + // Next we need to figure out if the node that skipped past is + // nested within a dehydrated boundary and if so, which one. + var suspenseInstance = getParentSuspenseInstance(targetNode); + + while (suspenseInstance !== null) { + // We found a suspense instance. That means that we haven't + // hydrated it yet. Even though we leave the comments in the + // DOM after hydrating, and there are boundaries in the DOM + // that could already be hydrated, we wouldn't have found them + // through this pass since if the target is hydrated it would + // have had an internalInstanceKey on it. + // Let's get the fiber associated with the SuspenseComponent + // as the deepest instance. + // $FlowFixMe[prop-missing] + var targetSuspenseInst = suspenseInstance[internalInstanceKey]; + + if (targetSuspenseInst) { + return targetSuspenseInst; + } // If we don't find a Fiber on the comment, it might be because + // we haven't gotten to hydrate it yet. There might still be a + // parent boundary that hasn't above this one so we need to find + // the outer most that is known. + + suspenseInstance = getParentSuspenseInstance(suspenseInstance); // If we don't find one, then that should mean that the parent + // host component also hasn't hydrated yet. We can return it + // below since it will bail out on the isMounted check later. + } + } + + return targetInst; + } + + targetNode = parentNode; + parentNode = targetNode.parentNode; + } + + return null; +} +/** + * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent + * instance, or null if the node was not rendered by this React. + */ + +function getInstanceFromNode(node) { + var inst = node[internalInstanceKey] || node[internalContainerInstanceKey]; + + if (inst) { + var tag = inst.tag; + + if ( + tag === HostComponent || + tag === HostText || + tag === SuspenseComponent || + tag === HostResource || + tag === HostSingleton || + tag === HostRoot + ) { + return inst; + } else { + return null; + } + } + + return null; +} +/** + * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding + * DOM node. + */ + +function getNodeFromInstance(inst) { + var tag = inst.tag; + + if ( + tag === HostComponent || + tag === HostResource || + tag === HostSingleton || + tag === HostText + ) { + // In Fiber this, is just the state node right now. We assume it will be + // a host component or host text. + return inst.stateNode; + } // Without this first invariant, passing a non-DOM-component triggers the next + // invariant for a missing parent, which is super confusing. + + throw new Error("getNodeFromInstance: Invalid argument."); +} +function getFiberCurrentPropsFromNode(node) { + return node[internalPropsKey] || null; +} +function updateFiberProps(node, props) { + node[internalPropsKey] = props; +} +function getEventListenerSet(node) { + var elementListenerSet = node[internalEventHandlersKey]; + + if (elementListenerSet === undefined) { + elementListenerSet = node[internalEventHandlersKey] = new Set(); + } + + return elementListenerSet; +} +function getFiberFromScopeInstance(scope) { + { + return scope[internalInstanceKey] || null; + } +} +function setEventHandlerListeners(scope, listeners) { + scope[internalEventHandlerListenersKey] = listeners; +} +function getEventHandlerListeners(scope) { + return scope[internalEventHandlerListenersKey] || null; +} +function addEventHandleToTarget(target, eventHandle) { + var eventHandles = target[internalEventHandlesSetKey]; + + if (eventHandles === undefined) { + eventHandles = target[internalEventHandlesSetKey] = new Set(); + } + + eventHandles.add(eventHandle); +} +function doesTargetHaveEventHandle(target, eventHandle) { + var eventHandles = target[internalEventHandlesSetKey]; + + if (eventHandles === undefined) { + return false; + } + + return eventHandles.has(eventHandle); +} +function getResourcesFromRoot(root) { + var resources = root[internalRootNodeResourcesKey]; + + if (!resources) { + resources = root[internalRootNodeResourcesKey] = { + styles: new Map(), + scripts: new Map(), + head: new Map(), + lastStructuredMeta: new Map() + }; + } + + return resources; +} +function isMarkedResource(node) { + return !!node[internalResourceMarker]; +} +function markNodeAsResource(node) { + node[internalResourceMarker] = true; +} + // Below code forked from dom-accessibility-api var tagToRoleMappings = { ARTICLE: "article", @@ -263,17 +510,6 @@ function hasRole(element, role) { return role === getImplicitRole(element); } -var debugRenderPhaseSideEffectsForStrictMode = false; -var enableSchedulingProfiler = false; -var enableProfilerTimer = false; -var disableCommentsAsDOMContainers = true; -var enableSuspenseCallback = true; -var enableClientRenderFallbackOnTextMismatch = true; -var createRootStrictEffectsByDefault = false; -var enableLazyContextPropagation = false; -var enableLegacyHidden = false; -var enableCustomElementPropertySupport = false; - var allNativeEvents = new Set(); { @@ -4785,7 +5021,7 @@ var restoreQueue = null; function restoreStateOfTarget(target) { // We perform this translation at the end of the event loop so that we // always receive the correct fiber here - var internalInstance = getInstanceFromNode$1(target); + var internalInstance = getInstanceFromNode(target); if (!internalInstance) { // Unmounted @@ -6745,7 +6981,7 @@ function accumulateOrCreateContinuousQueuedReplayableEvent( ); if (blockedOn !== null) { - var fiber = getInstanceFromNode$1(blockedOn); + var fiber = getInstanceFromNode(blockedOn); if (fiber !== null) { // Attempt to increase the priority of this target. @@ -6960,7 +7196,7 @@ function attemptReplayContinuousQueuedEvent(queuedEvent) { } } else { // We're still blocked. Try again later. - var fiber = getInstanceFromNode$1(nextBlockedOn); + var fiber = getInstanceFromNode(nextBlockedOn); if (fiber !== null) { attemptContinuousHydration(fiber); @@ -7225,7 +7461,7 @@ function dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEve isDiscreteEventThatRequiresHydration(domEventName) ) { while (blockedOn !== null) { - var fiber = getInstanceFromNode$1(blockedOn); + var fiber = getInstanceFromNode(blockedOn); if (fiber !== null) { attemptSynchronousHydration(fiber); @@ -14943,7 +15179,7 @@ var cancelTimeout = typeof clearTimeout === "function" ? clearTimeout : undefined; var noTimeout = -1; var localPromise = typeof Promise === "function" ? Promise : undefined; -function getInstanceFromNode(node) { +function getInstanceFromNode$1(node) { return getClosestInstanceFromNode(node) || null; } function preparePortalMount(portalInstance) { @@ -15720,7 +15956,7 @@ function findFiberRoot(node) { var current = stack[index++]; if (isContainerMarkedAsRoot(current)) { - return getInstanceFromNode$1(current); + return getInstanceFromNode(current); } stack.push.apply(stack, current.children); @@ -16072,7 +16308,7 @@ function acquireSingletonInstance( internalInstanceHandle ) { { - var currentInstanceHandle = getInstanceFromNode$1(instance); + var currentInstanceHandle = getInstanceFromNode(instance); if (currentInstanceHandle) { var tagName = instance.tagName.toLowerCase(); @@ -16147,242 +16383,6 @@ function clearSingleton(instance) { return; } -var randomKey = Math.random().toString(36).slice(2); -var internalInstanceKey = "__reactFiber$" + randomKey; -var internalPropsKey = "__reactProps$" + randomKey; -var internalContainerInstanceKey = "__reactContainer$" + randomKey; -var internalEventHandlersKey = "__reactEvents$" + randomKey; -var internalEventHandlerListenersKey = "__reactListeners$" + randomKey; -var internalEventHandlesSetKey = "__reactHandles$" + randomKey; -var internalRootNodeResourcesKey = "__reactResources$" + randomKey; -var internalResourceMarker = "__reactMarker$" + randomKey; -function detachDeletedInstance(node) { - // TODO: This function is only called on host components. I don't think all of - // these fields are relevant. - delete node[internalInstanceKey]; - delete node[internalPropsKey]; - delete node[internalEventHandlersKey]; - delete node[internalEventHandlerListenersKey]; - delete node[internalEventHandlesSetKey]; -} -function precacheFiberNode(hostInst, node) { - node[internalInstanceKey] = hostInst; -} -function markContainerAsRoot(hostRoot, node) { - // $FlowFixMe[prop-missing] - node[internalContainerInstanceKey] = hostRoot; -} -function unmarkContainerAsRoot(node) { - // $FlowFixMe[prop-missing] - node[internalContainerInstanceKey] = null; -} -function isContainerMarkedAsRoot(node) { - // $FlowFixMe[prop-missing] - return !!node[internalContainerInstanceKey]; -} // Given a DOM node, return the closest HostComponent or HostText fiber ancestor. -// If the target node is part of a hydrated or not yet rendered subtree, then -// this may also return a SuspenseComponent or HostRoot to indicate that. -// Conceptually the HostRoot fiber is a child of the Container node. So if you -// pass the Container node as the targetNode, you will not actually get the -// HostRoot back. To get to the HostRoot, you need to pass a child of it. -// The same thing applies to Suspense boundaries. - -function getClosestInstanceFromNode(targetNode) { - var targetInst = targetNode[internalInstanceKey]; - - if (targetInst) { - // Don't return HostRoot or SuspenseComponent here. - return targetInst; - } // If the direct event target isn't a React owned DOM node, we need to look - // to see if one of its parents is a React owned DOM node. - - var parentNode = targetNode.parentNode; - - while (parentNode) { - // We'll check if this is a container root that could include - // React nodes in the future. We need to check this first because - // if we're a child of a dehydrated container, we need to first - // find that inner container before moving on to finding the parent - // instance. Note that we don't check this field on the targetNode - // itself because the fibers are conceptually between the container - // node and the first child. It isn't surrounding the container node. - // If it's not a container, we check if it's an instance. - targetInst = - parentNode[internalContainerInstanceKey] || - parentNode[internalInstanceKey]; - - if (targetInst) { - // Since this wasn't the direct target of the event, we might have - // stepped past dehydrated DOM nodes to get here. However they could - // also have been non-React nodes. We need to answer which one. - // If we the instance doesn't have any children, then there can't be - // a nested suspense boundary within it. So we can use this as a fast - // bailout. Most of the time, when people add non-React children to - // the tree, it is using a ref to a child-less DOM node. - // Normally we'd only need to check one of the fibers because if it - // has ever gone from having children to deleting them or vice versa - // it would have deleted the dehydrated boundary nested inside already. - // However, since the HostRoot starts out with an alternate it might - // have one on the alternate so we need to check in case this was a - // root. - var alternate = targetInst.alternate; - - if ( - targetInst.child !== null || - (alternate !== null && alternate.child !== null) - ) { - // Next we need to figure out if the node that skipped past is - // nested within a dehydrated boundary and if so, which one. - var suspenseInstance = getParentSuspenseInstance(targetNode); - - while (suspenseInstance !== null) { - // We found a suspense instance. That means that we haven't - // hydrated it yet. Even though we leave the comments in the - // DOM after hydrating, and there are boundaries in the DOM - // that could already be hydrated, we wouldn't have found them - // through this pass since if the target is hydrated it would - // have had an internalInstanceKey on it. - // Let's get the fiber associated with the SuspenseComponent - // as the deepest instance. - // $FlowFixMe[prop-missing] - var targetSuspenseInst = suspenseInstance[internalInstanceKey]; - - if (targetSuspenseInst) { - return targetSuspenseInst; - } // If we don't find a Fiber on the comment, it might be because - // we haven't gotten to hydrate it yet. There might still be a - // parent boundary that hasn't above this one so we need to find - // the outer most that is known. - - suspenseInstance = getParentSuspenseInstance(suspenseInstance); // If we don't find one, then that should mean that the parent - // host component also hasn't hydrated yet. We can return it - // below since it will bail out on the isMounted check later. - } - } - - return targetInst; - } - - targetNode = parentNode; - parentNode = targetNode.parentNode; - } - - return null; -} -/** - * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent - * instance, or null if the node was not rendered by this React. - */ - -function getInstanceFromNode$1(node) { - var inst = node[internalInstanceKey] || node[internalContainerInstanceKey]; - - if (inst) { - var tag = inst.tag; - - if ( - tag === HostComponent || - tag === HostText || - tag === SuspenseComponent || - tag === HostResource || - tag === HostSingleton || - tag === HostRoot - ) { - return inst; - } else { - return null; - } - } - - return null; -} -/** - * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding - * DOM node. - */ - -function getNodeFromInstance(inst) { - var tag = inst.tag; - - if ( - tag === HostComponent || - tag === HostResource || - tag === HostSingleton || - tag === HostText - ) { - // In Fiber this, is just the state node right now. We assume it will be - // a host component or host text. - return inst.stateNode; - } // Without this first invariant, passing a non-DOM-component triggers the next - // invariant for a missing parent, which is super confusing. - - throw new Error("getNodeFromInstance: Invalid argument."); -} -function getFiberCurrentPropsFromNode(node) { - return node[internalPropsKey] || null; -} -function updateFiberProps(node, props) { - node[internalPropsKey] = props; -} -function getEventListenerSet(node) { - var elementListenerSet = node[internalEventHandlersKey]; - - if (elementListenerSet === undefined) { - elementListenerSet = node[internalEventHandlersKey] = new Set(); - } - - return elementListenerSet; -} -function getFiberFromScopeInstance(scope) { - { - return scope[internalInstanceKey] || null; - } -} -function setEventHandlerListeners(scope, listeners) { - scope[internalEventHandlerListenersKey] = listeners; -} -function getEventHandlerListeners(scope) { - return scope[internalEventHandlerListenersKey] || null; -} -function addEventHandleToTarget(target, eventHandle) { - var eventHandles = target[internalEventHandlesSetKey]; - - if (eventHandles === undefined) { - eventHandles = target[internalEventHandlesSetKey] = new Set(); - } - - eventHandles.add(eventHandle); -} -function doesTargetHaveEventHandle(target, eventHandle) { - var eventHandles = target[internalEventHandlesSetKey]; - - if (eventHandles === undefined) { - return false; - } - - return eventHandles.has(eventHandle); -} -function getResourcesFromRoot(root) { - var resources = root[internalRootNodeResourcesKey]; - - if (!resources) { - resources = root[internalRootNodeResourcesKey] = { - styles: new Map(), - scripts: new Map(), - head: new Map(), - lastStructuredMeta: new Map() - }; - } - - return resources; -} -function isMarkedResource(node) { - return !!node[internalResourceMarker]; -} -function markNodeAsResource(node) { - node[internalResourceMarker] = true; -} - var loggedTypeFailures = {}; var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; @@ -29217,7 +29217,7 @@ function DO_NOT_USE_queryFirstNode(fn) { } function containsNode$1(node) { - var fiber = getInstanceFromNode(node); + var fiber = getInstanceFromNode$1(node); while (fiber !== null) { if (fiber.tag === ScopeComponent && fiber.stateNode === this) { @@ -34025,7 +34025,7 @@ function createTestNameSelector(id) { } function findFiberRootForHostRoot(hostRoot) { - var maybeFiber = getInstanceFromNode(hostRoot); + var maybeFiber = getInstanceFromNode$1(hostRoot); if (maybeFiber != null) { if (typeof maybeFiber.memoizedProps["data-testname"] !== "string") { @@ -38514,7 +38514,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-758fc7fde-20230207"; +var ReactVersion = "18.3.0-www-modern-a3152eda5-20230208"; function createPortal( children, @@ -39579,7 +39579,7 @@ function flushSync$1(fn) { // This is an array for better minification. Internals.Events = [ - getInstanceFromNode$1, + getInstanceFromNode, getNodeFromInstance, getFiberCurrentPropsFromNode, enqueueStateRestore, diff --git a/compiled/facebook-www/ReactDOMTesting-prod.classic.js b/compiled/facebook-www/ReactDOMTesting-prod.classic.js index fc53e5ab3326e..d02f80475618b 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.classic.js @@ -7120,24 +7120,8 @@ function commitBeforeMutationEffects(root, firstChild) { } break; case 3: - if (0 !== (flags & 1024)) { - var container = firstChild.stateNode.containerInfo, - nodeType = container.nodeType; - if (9 === nodeType) - clearRootResources(container), - clearContainerSparingly(container); - else if (1 === nodeType) - switch (container.nodeName) { - case "HEAD": - clearRootResources(container); - case "HTML": - case "BODY": - clearContainerSparingly(container); - break; - default: - container.textContent = ""; - } - } + 0 !== (flags & 1024) && + clearContainer(firstChild.stateNode.containerInfo); break; case 5: case 26: @@ -11154,8 +11138,7 @@ function legacyCreateRootFromDOMContainer( flushSync(); return root$161; } - for (; (isHydrationContainer = container.lastChild); ) - container.removeChild(isHydrationContainer); + clearContainer(container); if ("function" === typeof callback) { var originalCallback$162 = callback; callback = function () { @@ -11373,7 +11356,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1518 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-758fc7fde-20230207", + version: "18.3.0-www-classic-a3152eda5-20230208", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2047 = { @@ -11403,7 +11386,7 @@ var internals$jscomp$inline_2047 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-758fc7fde-20230207" + reconcilerVersion: "18.3.0-next-a3152eda5-20230208" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2048 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -12230,6 +12213,22 @@ function clearSuspenseBoundary(parentInstance, suspenseInstance) { } while (node); retryIfBlockedOn(suspenseInstance); } +function clearContainer(container) { + var nodeType = container.nodeType; + if (9 === nodeType) + clearRootResources(container), clearContainerSparingly(container); + else if (1 === nodeType) + switch (container.nodeName) { + case "HEAD": + clearRootResources(container); + case "HTML": + case "BODY": + clearContainerSparingly(container); + break; + default: + container.textContent = ""; + } +} function clearContainerSparingly(container) { var nextNode = container.firstChild; nextNode && 10 === nextNode.nodeType && (nextNode = nextNode.nextSibling); @@ -14904,4 +14903,4 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-758fc7fde-20230207"; +exports.version = "18.3.0-next-a3152eda5-20230208"; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.modern.js b/compiled/facebook-www/ReactDOMTesting-prod.modern.js index bef1711f442f6..4e6b84a754bd8 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.modern.js @@ -37,6 +37,104 @@ function formatProdErrorMessage(code) { " for the full message or use the non-minified dev environment for full errors and additional helpful warnings." ); } +var randomKey = Math.random().toString(36).slice(2), + internalInstanceKey = "__reactFiber$" + randomKey, + internalPropsKey = "__reactProps$" + randomKey, + internalContainerInstanceKey = "__reactContainer$" + randomKey, + internalEventHandlersKey = "__reactEvents$" + randomKey, + internalEventHandlerListenersKey = "__reactListeners$" + randomKey, + internalEventHandlesSetKey = "__reactHandles$" + randomKey, + internalRootNodeResourcesKey = "__reactResources$" + randomKey, + internalResourceMarker = "__reactMarker$" + randomKey; +function detachDeletedInstance(node) { + delete node[internalInstanceKey]; + delete node[internalPropsKey]; + delete node[internalEventHandlersKey]; + delete node[internalEventHandlerListenersKey]; + delete node[internalEventHandlesSetKey]; +} +function getClosestInstanceFromNode(targetNode) { + var targetInst = targetNode[internalInstanceKey]; + if (targetInst) return targetInst; + for (var parentNode = targetNode.parentNode; parentNode; ) { + if ( + (targetInst = + parentNode[internalContainerInstanceKey] || + parentNode[internalInstanceKey]) + ) { + parentNode = targetInst.alternate; + if ( + null !== targetInst.child || + (null !== parentNode && null !== parentNode.child) + ) + for ( + targetNode = getParentSuspenseInstance(targetNode); + null !== targetNode; + + ) { + if ((parentNode = targetNode[internalInstanceKey])) return parentNode; + targetNode = getParentSuspenseInstance(targetNode); + } + return targetInst; + } + targetNode = parentNode; + parentNode = targetNode.parentNode; + } + return null; +} +function getInstanceFromNode(node) { + if ( + (node = node[internalInstanceKey] || node[internalContainerInstanceKey]) + ) { + var tag = node.tag; + if ( + 5 === tag || + 6 === tag || + 13 === tag || + 26 === tag || + 27 === tag || + 3 === tag + ) + return node; + } + return null; +} +function getNodeFromInstance(inst) { + var tag = inst.tag; + if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return inst.stateNode; + throw Error(formatProdErrorMessage(33)); +} +function getFiberCurrentPropsFromNode(node) { + return node[internalPropsKey] || null; +} +function getEventListenerSet(node) { + var elementListenerSet = node[internalEventHandlersKey]; + void 0 === elementListenerSet && + (elementListenerSet = node[internalEventHandlersKey] = new Set()); + return elementListenerSet; +} +function addEventHandleToTarget(target, eventHandle) { + var eventHandles = target[internalEventHandlesSetKey]; + void 0 === eventHandles && + (eventHandles = target[internalEventHandlesSetKey] = new Set()); + eventHandles.add(eventHandle); +} +function doesTargetHaveEventHandle(target, eventHandle) { + target = target[internalEventHandlesSetKey]; + return void 0 === target ? !1 : target.has(eventHandle); +} +function getResourcesFromRoot(root) { + var resources = root[internalRootNodeResourcesKey]; + resources || + (resources = root[internalRootNodeResourcesKey] = + { + styles: new Map(), + scripts: new Map(), + head: new Map(), + lastStructuredMeta: new Map() + }); + return resources; +} var tagToRoleMappings = { ARTICLE: "article", ASIDE: "complementary", @@ -1055,7 +1153,7 @@ var restoreImpl = null, restoreTarget = null, restoreQueue = null; function restoreStateOfTarget(target) { - if ((target = getInstanceFromNode$1(target))) { + if ((target = getInstanceFromNode(target))) { if ("function" !== typeof restoreImpl) throw Error(formatProdErrorMessage(280)); var stateNode = target.stateNode; @@ -1655,7 +1753,7 @@ function accumulateOrCreateContinuousQueuedReplayableEvent( targetContainers: [targetContainer] }), null !== blockedOn && - ((blockedOn = getInstanceFromNode$1(blockedOn)), + ((blockedOn = getInstanceFromNode(blockedOn)), null !== blockedOn && attemptContinuousHydration(blockedOn)), existingQueuedEvent ); @@ -1796,7 +1894,7 @@ function attemptReplayContinuousQueuedEvent(queuedEvent) { currentReplayingEvent = null; } else return ( - (targetContainers = getInstanceFromNode$1(nextBlockedOn)), + (targetContainers = getInstanceFromNode(nextBlockedOn)), null !== targetContainers && attemptContinuousHydration(targetContainers), (queuedEvent.blockedOn = nextBlockedOn), @@ -1937,7 +2035,7 @@ function dispatchEvent( -1 < discreteReplayableEvents.indexOf(domEventName)) ) { for (; null !== blockedOn; ) { - var fiber = getInstanceFromNode$1(blockedOn); + var fiber = getInstanceFromNode(blockedOn); null !== fiber && _attemptSynchronousHydration(fiber); fiber = findInstanceBlockingEvent( domEventName, @@ -2555,7 +2653,7 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$224; + var JSCompiler_inline_result$jscomp$225; if (canUseDOM) { var isSupported$jscomp$inline_376 = "oninput" in document; if (!isSupported$jscomp$inline_376) { @@ -2564,10 +2662,10 @@ if (canUseDOM) { isSupported$jscomp$inline_376 = "function" === typeof element$jscomp$inline_377.oninput; } - JSCompiler_inline_result$jscomp$224 = isSupported$jscomp$inline_376; - } else JSCompiler_inline_result$jscomp$224 = !1; + JSCompiler_inline_result$jscomp$225 = isSupported$jscomp$inline_376; + } else JSCompiler_inline_result$jscomp$225 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$224 && + JSCompiler_inline_result$jscomp$225 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -4920,104 +5018,6 @@ function resolveSingletonInstance(type, props, rootContainerInstance) { throw Error(formatProdErrorMessage(451)); } } -var randomKey = Math.random().toString(36).slice(2), - internalInstanceKey = "__reactFiber$" + randomKey, - internalPropsKey = "__reactProps$" + randomKey, - internalContainerInstanceKey = "__reactContainer$" + randomKey, - internalEventHandlersKey = "__reactEvents$" + randomKey, - internalEventHandlerListenersKey = "__reactListeners$" + randomKey, - internalEventHandlesSetKey = "__reactHandles$" + randomKey, - internalRootNodeResourcesKey = "__reactResources$" + randomKey, - internalResourceMarker = "__reactMarker$" + randomKey; -function detachDeletedInstance(node) { - delete node[internalInstanceKey]; - delete node[internalPropsKey]; - delete node[internalEventHandlersKey]; - delete node[internalEventHandlerListenersKey]; - delete node[internalEventHandlesSetKey]; -} -function getClosestInstanceFromNode(targetNode) { - var targetInst = targetNode[internalInstanceKey]; - if (targetInst) return targetInst; - for (var parentNode = targetNode.parentNode; parentNode; ) { - if ( - (targetInst = - parentNode[internalContainerInstanceKey] || - parentNode[internalInstanceKey]) - ) { - parentNode = targetInst.alternate; - if ( - null !== targetInst.child || - (null !== parentNode && null !== parentNode.child) - ) - for ( - targetNode = getParentSuspenseInstance(targetNode); - null !== targetNode; - - ) { - if ((parentNode = targetNode[internalInstanceKey])) return parentNode; - targetNode = getParentSuspenseInstance(targetNode); - } - return targetInst; - } - targetNode = parentNode; - parentNode = targetNode.parentNode; - } - return null; -} -function getInstanceFromNode$1(node) { - if ( - (node = node[internalInstanceKey] || node[internalContainerInstanceKey]) - ) { - var tag = node.tag; - if ( - 5 === tag || - 6 === tag || - 13 === tag || - 26 === tag || - 27 === tag || - 3 === tag - ) - return node; - } - return null; -} -function getNodeFromInstance(inst) { - var tag = inst.tag; - if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return inst.stateNode; - throw Error(formatProdErrorMessage(33)); -} -function getFiberCurrentPropsFromNode(node) { - return node[internalPropsKey] || null; -} -function getEventListenerSet(node) { - var elementListenerSet = node[internalEventHandlersKey]; - void 0 === elementListenerSet && - (elementListenerSet = node[internalEventHandlersKey] = new Set()); - return elementListenerSet; -} -function addEventHandleToTarget(target, eventHandle) { - var eventHandles = target[internalEventHandlesSetKey]; - void 0 === eventHandles && - (eventHandles = target[internalEventHandlesSetKey] = new Set()); - eventHandles.add(eventHandle); -} -function doesTargetHaveEventHandle(target, eventHandle) { - target = target[internalEventHandlesSetKey]; - return void 0 === target ? !1 : target.has(eventHandle); -} -function getResourcesFromRoot(root) { - var resources = root[internalRootNodeResourcesKey]; - resources || - (resources = root[internalRootNodeResourcesKey] = - { - styles: new Map(), - scripts: new Map(), - head: new Map(), - lastStructuredMeta: new Map() - }); - return resources; -} var emptyContextObject = {}, syncQueue = null, includesLegacySyncCallbacks = !1, @@ -11604,7 +11604,7 @@ function findFiberRootForHostRoot(hostRoot) { for (maybeFiber = 0; maybeFiber < hostRoot.length; ) { var current = hostRoot[maybeFiber++]; if (current[internalContainerInstanceKey]) { - hostRoot = getInstanceFromNode$1(current); + hostRoot = getInstanceFromNode(current); break a; } hostRoot.push.apply(hostRoot, current.children); @@ -13997,7 +13997,7 @@ restoreImpl = function (domElement, tag, props) { batchedUpdatesImpl = batchedUpdates$1; flushSyncImpl = flushSync; Internals.Events = [ - getInstanceFromNode$1, + getInstanceFromNode, getNodeFromInstance, getFiberCurrentPropsFromNode, enqueueStateRestore, @@ -14007,7 +14007,7 @@ Internals.Events = [ var devToolsConfig$jscomp$inline_1673 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-758fc7fde-20230207", + version: "18.3.0-www-modern-a3152eda5-20230208", rendererPackageName: "react-dom" }; var internals$jscomp$inline_2072 = { @@ -14038,7 +14038,7 @@ var internals$jscomp$inline_2072 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-next-758fc7fde-20230207" + reconcilerVersion: "18.3.0-next-a3152eda5-20230208" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_2073 = __REACT_DEVTOOLS_GLOBAL_HOOK__; @@ -14369,4 +14369,4 @@ exports.unstable_flushControlled = function (fn) { } }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-next-758fc7fde-20230207"; +exports.version = "18.3.0-next-a3152eda5-20230208"; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.classic.js b/compiled/facebook-www/ReactTestRenderer-dev.classic.js index 56aceebb88bde..f038ff7a0b886 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.classic.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.classic.js @@ -23911,7 +23911,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-758fc7fde-20230207"; +var ReactVersion = "18.3.0-www-classic-a3152eda5-20230208"; // Might add PROFILE later. diff --git a/compiled/facebook-www/ReactTestRenderer-dev.modern.js b/compiled/facebook-www/ReactTestRenderer-dev.modern.js index f09fa61d9c5ff..e6e5c4bd4e3e0 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.modern.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.modern.js @@ -23911,7 +23911,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-758fc7fde-20230207"; +var ReactVersion = "18.3.0-www-modern-a3152eda5-20230208"; // Might add PROFILE later.