diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js index 4bbe341a4d..d050c95b18 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<3151ca79177b1e7b421f14db372bfd97>> + * @generated SignedSource<<2fd27704711e4d0ffab11c7c21fee224>> */ "use strict"; @@ -21,7 +21,7 @@ if (__DEV__) { var Scheduler$1 = require("scheduler"); var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; // by calls to these methods by a Babel plugin. // @@ -67,9 +67,7 @@ if (__DEV__) { // When changing this logic, you might want to also // update consoleWithStackDev.www.js as well. { - var ReactDebugCurrentFrame = - ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); + var stack = ReactSharedInternals.getStackAddendum(); if (stack !== "") { format += "%s"; @@ -121,6 +119,9 @@ if (__DEV__) { var assign = Object.assign; + var LegacyRoot = 0; + var ConcurrentRoot = 1; + /** * `ReactInstanceMap` maintains a mapping from a public facing stateful * instance (key) and the internal representation (value). This allows public @@ -349,6 +350,17 @@ if (__DEV__) { return type.displayName || "Context"; } + function getComponentNameFromOwner(owner) { + if (typeof owner.tag === "number") { + return getComponentNameFromFiber(owner); + } + + if (typeof owner.name === "string") { + return owner.name; + } + + return null; + } function getComponentNameFromFiber(fiber) { var tag = fiber.tag, type = fiber.type; @@ -503,6 +515,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; var DidDefer = ContentReset; + var FormReset = Snapshot; var LifecycleEffectMask = Passive$1 | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) @@ -561,7 +574,8 @@ if (__DEV__) { ContentReset | Ref | Hydrating | - Visibility; + Visibility | + FormReset; var LayoutMask = Update | Callback | Ref | Visibility; // TODO: Split into PassiveMountMask and PassiveUnmountMask var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that don't get reset on clones. @@ -571,7 +585,6 @@ if (__DEV__) { var StaticMask = LayoutStatic | PassiveStatic | RefStatic | MaySuspendCommit; - var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner; function getNearestMountedFiber(fiber) { var node = fiber; var nearestMounted = fiber; @@ -613,7 +626,7 @@ if (__DEV__) { } function isMounted(component) { { - var owner = ReactCurrentOwner$2.current; + var owner = ReactSharedInternals.owner; if (owner !== null && owner.tag === ClassComponent) { var ownerFiber = owner; @@ -2305,17 +2318,11 @@ if (__DEV__) { } } + var NoEventPriority = NoLane; var DiscreteEventPriority = SyncLane; var ContinuousEventPriority = InputContinuousLane; var DefaultEventPriority = DefaultLane; var IdleEventPriority = IdleLane; - var currentUpdatePriority = NoLane; - function getCurrentUpdatePriority() { - return currentUpdatePriority; - } - function setCurrentUpdatePriority(newPriority) { - currentUpdatePriority = newPriority; - } function higherEventPriority(a, b) { return a !== 0 && a < b ? a : b; } @@ -2325,6 +2332,9 @@ if (__DEV__) { function isHigherEventPriority(a, b) { return a !== 0 && a < b; } + function eventPriorityToLane(updatePriority) { + return updatePriority; + } function lanesToEventPriority(lanes) { var lane = getHighestPriorityLane(lanes); @@ -2482,7 +2492,18 @@ if (__DEV__) { tag: "TEXT" }; } - function getCurrentEventPriority() { + var currentUpdatePriority = NoEventPriority; + function setCurrentUpdatePriority(newPriority) { + currentUpdatePriority = newPriority; + } + function getCurrentUpdatePriority() { + return currentUpdatePriority; + } + function resolveUpdatePriority() { + if (currentUpdatePriority !== NoEventPriority) { + return currentUpdatePriority; + } + return DefaultEventPriority; } function shouldAttemptEagerTransition() { @@ -2848,9 +2869,6 @@ if (__DEV__) { } } - var LegacyRoot = 0; - var ConcurrentRoot = 1; - // We use the existence of the state object as an indicator that the component // is hidden. var OffscreenVisible = @@ -2881,21 +2899,14 @@ if (__DEV__) { var objectIs = typeof Object.is === "function" ? Object.is : is; // $FlowFixMe[method-unbinding] - function describeBuiltInComponentFrame(name, ownerFn) { + function describeBuiltInComponentFrame(name) { { - var ownerName = null; - - if (ownerFn) { - ownerName = ownerFn.displayName || ownerFn.name || null; - } - - return describeComponentFrame(name, ownerName); + return describeComponentFrame(name); } } function describeDebugInfoFrame(name, env) { return describeBuiltInComponentFrame( - name + (env ? " (" + env + ")" : ""), - null + name + (env ? " (" + env + ")" : "") ); } @@ -2904,65 +2915,51 @@ if (__DEV__) { new PossiblyWeakMap$1(); } - function describeComponentFrame(name, ownerName) { - var sourceInfo = ""; - - if (ownerName) { - sourceInfo = " (created by " + ownerName + ")"; - } - - return "\n in " + (name || "Unknown") + sourceInfo; + function describeComponentFrame(name) { + return "\n in " + (name || "Unknown"); } - function describeClassComponentFrame(ctor, ownerFn) { + function describeClassComponentFrame(ctor) { { - return describeFunctionComponentFrame(ctor, ownerFn); + return describeFunctionComponentFrame(ctor); } } - function describeFunctionComponentFrame(fn, ownerFn) { + function describeFunctionComponentFrame(fn) { { if (!fn) { return ""; } var name = fn.displayName || fn.name || null; - var ownerName = null; - - if (ownerFn) { - ownerName = ownerFn.displayName || ownerFn.name || null; - } - - return describeComponentFrame(name, ownerName); + return describeComponentFrame(name); } } function describeFiber(fiber) { - var owner = fiber._debugOwner ? fiber._debugOwner.type : null; - switch (fiber.tag) { case HostHoistable: case HostSingleton: case HostComponent: - return describeBuiltInComponentFrame(fiber.type, owner); + return describeBuiltInComponentFrame(fiber.type); case LazyComponent: - return describeBuiltInComponentFrame("Lazy", owner); + return describeBuiltInComponentFrame("Lazy"); case SuspenseComponent: - return describeBuiltInComponentFrame("Suspense", owner); + return describeBuiltInComponentFrame("Suspense"); case SuspenseListComponent: - return describeBuiltInComponentFrame("SuspenseList", owner); + return describeBuiltInComponentFrame("SuspenseList"); case FunctionComponent: case SimpleMemoComponent: - return describeFunctionComponentFrame(fiber.type, owner); + return describeFunctionComponentFrame(fiber.type); case ForwardRef: - return describeFunctionComponentFrame(fiber.type.render, owner); + return describeFunctionComponentFrame(fiber.type.render); case ClassComponent: - return describeClassComponentFrame(fiber.type, owner); + return describeClassComponentFrame(fiber.type); default: return ""; @@ -4125,7 +4122,6 @@ if (__DEV__) { } } - var ReactCurrentActQueue$4 = ReactSharedInternals.ReactCurrentActQueue; // A linked list of all the roots with pending work. In an idiomatic app, // there's only a single root, but we do support multi root apps, hence this // extra complexity. But this module is optimized for the single root case. @@ -4164,7 +4160,7 @@ if (__DEV__) { mightHavePendingSyncWork = true; // At the end of the current event, go through each of the roots and ensure // there's a task scheduled for each one at the correct priority. - if (ReactCurrentActQueue$4.current !== null) { + if (ReactSharedInternals.actQueue !== null) { // We're inside an `act` scope. if (!didScheduleMicrotask_act) { didScheduleMicrotask_act = true; @@ -4185,9 +4181,9 @@ if (__DEV__) { scheduleTaskForRootDuringMicrotask(root, now$1()); } - if (ReactCurrentActQueue$4.isBatchingLegacy && root.tag === LegacyRoot) { + if (ReactSharedInternals.isBatchingLegacy && root.tag === LegacyRoot) { // Special `act` case: Record whenever a legacy update is scheduled. - ReactCurrentActQueue$4.didScheduleLegacyUpdate = true; + ReactSharedInternals.didScheduleLegacyUpdate = true; } } function flushSyncWorkOnAllRoots() { @@ -4378,7 +4374,7 @@ if (__DEV__) { // Scheduler task, rather than an `act` task, cancel it and re-schedule // on the `act` queue. !( - ReactCurrentActQueue$4.current !== null && + ReactSharedInternals.actQueue !== null && existingCallbackNode !== fakeActCallbackNode$1 ) ) { @@ -4445,11 +4441,11 @@ if (__DEV__) { var fakeActCallbackNode$1 = {}; function scheduleCallback$2(priorityLevel, callback) { - if (ReactCurrentActQueue$4.current !== null) { + if (ReactSharedInternals.actQueue !== null) { // Special case: We're inside an `act` scope (a testing utility). // Instead of scheduling work in the host environment, add it to a // fake internal queue that's managed by the `act` implementation. - ReactCurrentActQueue$4.current.push(callback); + ReactSharedInternals.actQueue.push(callback); return fakeActCallbackNode$1; } else { return scheduleCallback$3(priorityLevel, callback); @@ -4464,13 +4460,13 @@ if (__DEV__) { } function scheduleImmediateTask(cb) { - if (ReactCurrentActQueue$4.current !== null) { + if (ReactSharedInternals.actQueue !== null) { // Special case: Inside an `act` scope, we push microtasks to the fake `act` // callback queue. This is because we currently support calling `act` // without awaiting the result. The plan is to deprecate that, and require // that you always await the result so that the microtasks have a chance to // run. But it hasn't happened yet. - ReactCurrentActQueue$4.current.push(function () { + ReactSharedInternals.actQueue.push(function () { cb(); return null; }); @@ -5242,7 +5238,6 @@ if (__DEV__) { return true; } - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; var current = null; var isRendering = false; function getCurrentFiberOwnerNameInDevOrNull() { @@ -5253,8 +5248,8 @@ if (__DEV__) { var owner = current._debugOwner; - if (owner !== null && typeof owner !== "undefined") { - return getComponentNameFromFiber(owner); + if (owner != null) { + return getComponentNameFromOwner(owner); } } @@ -5274,14 +5269,14 @@ if (__DEV__) { function resetCurrentFiber() { { - ReactDebugCurrentFrame.getCurrentStack = null; + ReactSharedInternals.getCurrentStack = null; current = null; isRendering = false; } } function setCurrentFiber(fiber) { { - ReactDebugCurrentFrame.getCurrentStack = + ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; current = fiber; isRendering = false; @@ -5656,83 +5651,6 @@ if (__DEV__) { }; } - /* - * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol - * and Temporal.* types. See https://github.com/facebook/react/pull/22064. - * - * The functions in this module will throw an easier-to-understand, - * easier-to-debug exception with a clear errors message message explaining the - * problem. (Instead of a confusing exception thrown inside the implementation - * of the `value` object). - */ - // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. - function typeName(value) { - { - // toStringTag is needed for namespaced types like Temporal.Instant - var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; - var type = - (hasToStringTag && value[Symbol.toStringTag]) || - value.constructor.name || - "Object"; // $FlowFixMe[incompatible-return] - - return type; - } - } // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. - - function willCoercionThrow(value) { - { - try { - testStringCoercion(value); - return false; - } catch (e) { - return true; - } - } - } - - function testStringCoercion(value) { - // If you ended up here by following an exception call stack, here's what's - // happened: you supplied an object or symbol value to React (as a prop, key, - // DOM attribute, CSS property, string ref, etc.) and when React tried to - // coerce it to a string using `'' + value`, an exception was thrown. - // - // The most common types that will cause this exception are `Symbol` instances - // and Temporal objects like `Temporal.Instant`. But any object that has a - // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this - // exception. (Library authors do this to prevent users from using built-in - // numeric operators like `+` or comparison operators like `>=` because custom - // methods are needed to perform accurate arithmetic or comparison.) - // - // To fix the problem, coerce this object or symbol value to a string before - // passing it to React. The most reliable way is usually `String(value)`. - // - // To find which value is throwing, check the browser or debugger console. - // Before this exception was thrown, there should be `console.error` output - // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the - // problem and how that type was used: key, atrribute, input value prop, etc. - // In most cases, this console output also shows the component and its - // ancestor components where the exception happened. - // - // eslint-disable-next-line react-internal/safe-string-coercion - return "" + value; - } - function checkPropStringCoercion(value, propName) { - { - if (willCoercionThrow(value)) { - error( - "The provided `%s` prop is an unsupported type %s." + - " This value must be coerced to a string before using it here.", - propName, - typeName(value) - ); - - return testStringCoercion(value); // throw (to help callers find troubleshooting comments) - } - } - } - - var ReactCurrentActQueue$3 = ReactSharedInternals.ReactCurrentActQueue; - function getThenablesFromState(state) { { var devState = state; @@ -5786,8 +5704,8 @@ if (__DEV__) { function noop() {} function trackUsedThenable(thenableState, thenable, index) { - if (ReactCurrentActQueue$3.current !== null) { - ReactCurrentActQueue$3.didUsePromise = true; + if (ReactSharedInternals.actQueue !== null) { + ReactSharedInternals.didUsePromise = true; } var trackedThenables = getThenablesFromState(thenableState); @@ -6010,7 +5928,6 @@ if (__DEV__) { var didWarnAboutMaps; var didWarnAboutGenerators; - var didWarnAboutStringRefs; var ownerHasKeyUseWarning; var ownerHasFunctionTypeWarning; var ownerHasSymbolTypeWarning; @@ -6020,7 +5937,6 @@ if (__DEV__) { { didWarnAboutMaps = false; didWarnAboutGenerators = false; - didWarnAboutStringRefs = {}; /** * Warn if there's no key explicitly set on dynamic arrays of children or * object keys are not valid. This allows us to keep track of children between @@ -6065,10 +5981,6 @@ if (__DEV__) { }; } - function isReactClass(type) { - return type.prototype && type.prototype.isReactComponent; - } - function unwrapThenable(thenable) { var index = thenableIndexCounter$1; thenableIndexCounter$1 += 1; @@ -6080,128 +5992,16 @@ if (__DEV__) { return trackUsedThenable(thenableState$1, thenable, index); } - function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef - ) { - { - checkPropStringCoercion(mixedRef, "ref"); - } - - var stringRef = "" + mixedRef; - var owner = element._owner; - - if (!owner) { - throw new Error( - "Element ref was specified as a string (" + - stringRef + - ") but no owner was set. This could happen for one of" + - " the following reasons:\n" + - "1. You may be adding a ref to a function component\n" + - "2. You may be adding a ref to a component that was not created inside a component's render method\n" + - "3. You have multiple copies of React loaded\n" + - "See https://react.dev/link/refs-must-have-owner for more information." - ); - } - - if (owner.tag !== ClassComponent) { - throw new Error( - "Function components cannot have string refs. " + - "We recommend using useRef() instead. " + - "Learn more about using refs safely here: " + - "https://react.dev/link/strict-mode-string-ref" - ); - } - - { - if ( - // Will already warn with "Function components cannot be given refs" - !(typeof element.type === "function" && !isReactClass(element.type)) - ) { - var componentName = - getComponentNameFromFiber(returnFiber) || "Component"; - - if (!didWarnAboutStringRefs[componentName]) { - error( - 'Component "%s" contains the string ref "%s". Support for string refs ' + - "will be removed in a future major release. We recommend using " + - "useRef() or createRef() instead. " + - "Learn more about using refs safely here: " + - "https://react.dev/link/strict-mode-string-ref", - componentName, - stringRef - ); - - didWarnAboutStringRefs[componentName] = true; - } - } - } - - var inst = owner.stateNode; - - if (!inst) { - throw new Error( - "Missing owner for string ref " + - stringRef + - ". This error is likely caused by a " + - "bug in React. Please file an issue." - ); - } // Check if previous string ref matches new string ref - - if ( - current !== null && - current.ref !== null && - typeof current.ref === "function" && - current.ref._stringRef === stringRef - ) { - // Reuse the existing string ref - var currentRef = current.ref; - return currentRef; - } // Create a new string ref - - var ref = function (value) { - var refs = inst.refs; - - if (value === null) { - delete refs[stringRef]; - } else { - refs[stringRef] = value; - } - }; - - ref._stringRef = stringRef; - return ref; - } - function coerceRef(returnFiber, current, workInProgress, element) { - var mixedRef; + var ref; { // Old behavior. - mixedRef = element.ref; - } - - var coercedRef; - - if ( - typeof mixedRef === "string" || - typeof mixedRef === "number" || - typeof mixedRef === "boolean" - ) { - coercedRef = convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef - ); - } else { - coercedRef = mixedRef; + ref = element.ref; } // TODO: If enableRefAsProp is on, we shouldn't use the `ref` field. We // should always read the ref from the prop. - workInProgress.ref = coercedRef; + workInProgress.ref = ref; } function throwOnInvalidObjectType(returnFiber, newChild) { @@ -7995,8 +7795,6 @@ if (__DEV__) { /* */ 8; - var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig; var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; var didWarnAboutUseWrappedInTryCatch; @@ -8160,8 +7958,8 @@ if (__DEV__) { didWarnAboutUseFormState.add(componentName); error( - "ReactDOM.useFormState has been deprecated and replaced by " + - "React.useActionState. Please update %s to use React.useActionState.", + "ReactDOM.useFormState has been renamed to React.useActionState. " + + "Please update %s to use React.useActionState.", componentName ); } @@ -8297,17 +8095,16 @@ if (__DEV__) { { if (current !== null && current.memoizedState !== null) { - ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV; + ReactSharedInternals.H = HooksDispatcherOnUpdateInDEV; } else if (hookTypesDev !== null) { // This dispatcher handles an edge case where a component is updating, // but no stateful hooks have been used. // We want to match the production code behavior (which will use HooksDispatcherOnMount), // but with the extra DEV validation to ensure hooks ordering hasn't changed. // This dispatcher does that. - ReactCurrentDispatcher$1.current = - HooksDispatcherOnMountWithHookTypesInDEV; + ReactSharedInternals.H = HooksDispatcherOnMountWithHookTypesInDEV; } else { - ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV; + ReactSharedInternals.H = HooksDispatcherOnMountInDEV; } } // In Strict Mode, during development, user functions are double invoked to // help detect side effects. The logic for how this is implemented for in @@ -8362,7 +8159,7 @@ if (__DEV__) { } // We can assume the previous dispatcher is always this one, since we set it // at the beginning of the render phase and there's no re-entrance. - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; // This check uses currentHook so that it works the same in DEV and prod bundles. + ReactSharedInternals.H = ContextOnlyDispatcher; // This check uses currentHook so that it works the same in DEV and prod bundles. // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles. var didRenderTooFewHooks = @@ -8513,7 +8310,7 @@ if (__DEV__) { hookTypesUpdateIndexDev = -1; } - ReactCurrentDispatcher$1.current = HooksDispatcherOnRerenderInDEV; + ReactSharedInternals.H = HooksDispatcherOnRerenderInDEV; children = Component(props, secondArg); } while (didScheduleRenderPhaseUpdateDuringThisPass); @@ -8535,18 +8332,34 @@ if (__DEV__) { ); } function TransitionAwareHostComponent() { - var dispatcher = ReactCurrentDispatcher$1.current; + var dispatcher = ReactSharedInternals.H; var _dispatcher$useState = dispatcher.useState(), maybeThenable = _dispatcher$useState[0]; + var nextState; + if (typeof maybeThenable.then === "function") { var thenable = maybeThenable; - return useThenable(thenable); + nextState = useThenable(thenable); } else { var status = maybeThenable; - return status; + nextState = status; + } // The "reset state" is an object. If it changes, that means something + // requested that we reset the form. + + var _dispatcher$useState2 = dispatcher.useState(), + nextResetState = _dispatcher$useState2[0]; + + var prevResetState = + currentHook !== null ? currentHook.memoizedState : null; + + if (prevResetState !== nextResetState) { + // Schedule a form reset + currentlyRenderingFiber$1.flags |= FormReset; } + + return nextState; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; // TODO: Don't need to reset the flags here, because they're reset in the @@ -8575,7 +8388,7 @@ if (__DEV__) { currentlyRenderingFiber$1 = null; // We can assume the previous dispatcher is always this one, since we set it // at the beginning of the render phase and there's no re-entrance. - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + ReactSharedInternals.H = ContextOnlyDispatcher; } function resetHooksOnUnwind(workInProgress) { if (didScheduleRenderPhaseUpdate) { @@ -8748,7 +8561,7 @@ if (__DEV__) { // time (perhaps because it threw). Subsequent Hook calls should use the // mount dispatcher. { - ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV; + ReactSharedInternals.H = HooksDispatcherOnMountInDEV; } } @@ -9557,14 +9370,14 @@ if (__DEV__) { var action = actionQueue.action; var prevState = actionQueue.state; // This is a fork of startTransition - var prevTransition = ReactCurrentBatchConfig$2.transition; + var prevTransition = ReactSharedInternals.T; var currentTransition = { _callbacks: new Set() }; - ReactCurrentBatchConfig$2.transition = currentTransition; + ReactSharedInternals.T = currentTransition; { - ReactCurrentBatchConfig$2.transition._updatedFibers = new Set(); + ReactSharedInternals.T._updatedFibers = new Set(); } // Optimistically update the pending state, similar to useTransition. // This will be reverted automatically when all actions are finished. @@ -9622,7 +9435,7 @@ if (__DEV__) { setState(rejectedThenable); finishRunningActionStateAction(actionQueue, setPendingState, setState); } finally { - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactSharedInternals.T = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { @@ -10190,7 +10003,7 @@ if (__DEV__) { setCurrentUpdatePriority( higherEventPriority(previousPriority, ContinuousEventPriority) ); - var prevTransition = ReactCurrentBatchConfig$2.transition; + var prevTransition = ReactSharedInternals.T; var currentTransition = { _callbacks: new Set() }; @@ -10202,12 +10015,12 @@ if (__DEV__) { // optimistic update anyway to make it less likely the behavior accidentally // diverges; for example, both an optimistic update and this one should // share the same lane. - ReactCurrentBatchConfig$2.transition = currentTransition; + ReactSharedInternals.T = currentTransition; dispatchOptimisticSetState(fiber, false, queue, pendingState); } { - ReactCurrentBatchConfig$2.transition._updatedFibers = new Set(); + currentTransition._updatedFibers = new Set(); } try { @@ -10253,7 +10066,7 @@ if (__DEV__) { } } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactSharedInternals.T = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { @@ -10477,11 +10290,11 @@ if (__DEV__) { var lastRenderedReducer = queue.lastRenderedReducer; if (lastRenderedReducer !== null) { - var prevDispatcher; + var prevDispatcher = null; { - prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = + prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; } @@ -10512,7 +10325,7 @@ if (__DEV__) { // Suppress the error. It will throw again in the render phase. } finally { { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } } } @@ -10773,27 +10586,25 @@ if (__DEV__) { currentHookNameInDev = "useMemo"; mountHookTypesDev(); checkDepsAreArrayDev(deps); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -10804,14 +10615,13 @@ if (__DEV__) { useState: function (initialState) { currentHookNameInDev = "useState"; mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -10932,27 +10742,25 @@ if (__DEV__) { useMemo: function (create, deps) { currentHookNameInDev = "useMemo"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -10963,14 +10771,13 @@ if (__DEV__) { useState: function (initialState) { currentHookNameInDev = "useState"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -11084,27 +10891,25 @@ if (__DEV__) { useMemo: function (create, deps) { currentHookNameInDev = "useMemo"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -11115,14 +10920,13 @@ if (__DEV__) { useState: function (initialState) { currentHookNameInDev = "useState"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -11244,27 +11048,25 @@ if (__DEV__) { useMemo: function (create, deps) { currentHookNameInDev = "useMemo"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnRerenderInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnRerenderInDEV; try { return updateMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnRerenderInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnRerenderInDEV; try { return rerenderReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -11275,14 +11077,13 @@ if (__DEV__) { useState: function (initialState) { currentHookNameInDev = "useState"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnRerenderInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnRerenderInDEV; try { return rerenderState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -11415,28 +11216,26 @@ if (__DEV__) { currentHookNameInDev = "useMemo"; warnInvalidHookAccess(); mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; warnInvalidHookAccess(); mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -11449,14 +11248,13 @@ if (__DEV__) { currentHookNameInDev = "useState"; warnInvalidHookAccess(); mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -11593,28 +11391,26 @@ if (__DEV__) { currentHookNameInDev = "useMemo"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -11627,14 +11423,13 @@ if (__DEV__) { currentHookNameInDev = "useState"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -11771,28 +11566,26 @@ if (__DEV__) { currentHookNameInDev = "useMemo"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return rerenderReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -11805,14 +11598,13 @@ if (__DEV__) { currentHookNameInDev = "useState"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return rerenderState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -13202,7 +12994,7 @@ if (__DEV__) { // remove this extra check. alreadyResolvedDefaultProps ) { - var newProps = baseProps; // Resolve default props. Taken from old JSX runtime, where this used to live. + var newProps = baseProps; var defaultProps = Component.defaultProps; @@ -13211,11 +13003,15 @@ if (__DEV__) { // default props here in the reconciler, rather than in the JSX runtime. !alreadyResolvedDefaultProps ) { - newProps = assign({}, newProps, baseProps); + // We may have already copied the props object above to remove ref. If so, + // we can modify that. Otherwise, copy the props object with Object.assign. + if (newProps === baseProps) { + newProps = assign({}, newProps, baseProps); + } // Taken from old JSX runtime, where this used to live. - for (var propName in defaultProps) { - if (newProps[propName] === undefined) { - newProps[propName] = defaultProps[propName]; + for (var _propName in defaultProps) { + if (newProps[_propName] === undefined) { + newProps[_propName] = defaultProps[_propName]; } } } @@ -13280,8 +13076,6 @@ if (__DEV__) { console["error"](error); }; - var ReactCurrentActQueue$2 = ReactSharedInternals.ReactCurrentActQueue; // Side-channel since I'm not sure we want to make this part of the public API - var componentName = null; var errorBoundaryName = null; function defaultOnUncaughtError(error, errorInfo) { @@ -13346,10 +13140,10 @@ if (__DEV__) { var error = errorInfo.value; - if (true && ReactCurrentActQueue$2.current !== null) { + if (true && ReactSharedInternals.actQueue !== null) { // For uncaught errors inside act, we track them on the act and then // rethrow them into the test. - ReactCurrentActQueue$2.thrownErrors.push(error); + ReactSharedInternals.thrownErrors.push(error); return; } @@ -13884,7 +13678,6 @@ if (__DEV__) { return false; } - var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; // A special exception that's used to unwind the stack when an update flows // into a dehydrated boundary. var SelectiveHydrationException = new Error( @@ -14003,7 +13796,7 @@ if (__DEV__) { } { - ReactCurrentOwner$1.current = workInProgress; + ReactSharedInternals.owner = workInProgress; setIsRendering(true); nextChildren = renderWithHooks( current, @@ -14514,7 +14307,27 @@ if (__DEV__) { } if (current === null || current.ref !== ref) { - // Schedule a Ref effect + if (current !== null) { + var oldRef = current.ref; + var newRef = ref; + + if ( + typeof oldRef === "function" && + typeof newRef === "function" && + typeof oldRef.__stringRef === "string" && + oldRef.__stringRef === newRef.__stringRef && + oldRef.__stringRefType === newRef.__stringRefType && + oldRef.__stringRefOwner === newRef.__stringRefOwner + ) { + // Although this is a different callback, it represents the same + // string ref. To avoid breaking old Meta code that relies on string + // refs only being attached once, reuse the old ref. This will + // prevent us from detaching and reattaching the ref on each update. + workInProgress.ref = oldRef; + return; + } + } // Schedule a Ref effect + workInProgress.flags |= Ref | RefStatic; } } @@ -14597,7 +14410,7 @@ if (__DEV__) { } { - ReactCurrentOwner$1.current = workInProgress; + ReactSharedInternals.owner = workInProgress; setIsRendering(true); nextChildren = renderWithHooks( current, @@ -14820,7 +14633,10 @@ if (__DEV__) { var instance = workInProgress.stateNode; // Rerender - ReactCurrentOwner$1.current = workInProgress; + { + ReactSharedInternals.owner = workInProgress; + } + var nextChildren; if ( @@ -16541,7 +16357,7 @@ if (__DEV__) { var newChildren; { - ReactCurrentOwner$1.current = workInProgress; + ReactSharedInternals.owner = workInProgress; setIsRendering(true); newChildren = render(newValue); setIsRendering(false); @@ -17616,10 +17432,8 @@ if (__DEV__) { popProvider(CacheContext, workInProgress); } - var ReactCurrentBatchConfig$1 = - ReactSharedInternals.ReactCurrentBatchConfig; function requestCurrentTransition() { - var transition = ReactCurrentBatchConfig$1.transition; + var transition = ReactSharedInternals.T; if (transition !== null) { // Whenever a transition update is scheduled, register a callback on the @@ -19026,7 +18840,7 @@ if (__DEV__) { // Allows us to avoid traversing the return path to find the nearest Offscreen ancestor. var offscreenSubtreeIsHidden = false; - var offscreenSubtreeWasHidden = false; + var offscreenSubtreeWasHidden = false; // Used to track if a form needs to be reset at the end of the mutation phase. var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set; var nextEffect = null; // Used for Profiling builds to track updaters. @@ -20959,6 +20773,19 @@ if (__DEV__) { } } } + + if (flags & FormReset) { + { + if (finishedWork.type !== "form") { + // Paranoid coding. In case we accidentally start using the + // FormReset bit for something else. + error( + "Unexpected host component type. Expected a form. This is a " + + "bug in React." + ); + } + } + } } return; @@ -22561,7 +22388,6 @@ if (__DEV__) { symbolFor("selector.text"); } - var ReactCurrentActQueue$1 = ReactSharedInternals.ReactCurrentActQueue; function isLegacyActEnvironment(fiber) { { // Legacy mode. We preserve the behavior of React 17's act. It assumes an @@ -22586,7 +22412,7 @@ if (__DEV__) { if ( !isReactActEnvironmentGlobal && - ReactCurrentActQueue$1.current !== null + ReactSharedInternals.actQueue !== null ) { // TODO: Include link to relevant documentation page. error( @@ -22600,11 +22426,6 @@ if (__DEV__) { } var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, - ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; var NoContext = /* */ 0; @@ -22751,13 +22572,11 @@ if (__DEV__) { if (transition !== null) { { - var batchConfigTransition = ReactCurrentBatchConfig.transition; - - if (!batchConfigTransition._updatedFibers) { - batchConfigTransition._updatedFibers = new Set(); + if (!transition._updatedFibers) { + transition._updatedFibers = new Set(); } - batchConfigTransition._updatedFibers.add(fiber); + transition._updatedFibers.add(fiber); } var actionScopeLane = peekEntangledActionLane(); @@ -22766,26 +22585,9 @@ if (__DEV__) { : // is the first update in that scope. Either way, we need to get a // fresh transition lane. requestTransitionLane(); - } // Updates originating inside certain React methods, like flushSync, have - // their priority set by tracking it with a context variable. - // - // The opaque type returned by the host config is internally a lane, so we can - // use that directly. - // TODO: Move this type conversion to the event priority module. + } - var updateLane = getCurrentUpdatePriority(); - - if (updateLane !== NoLane) { - return updateLane; - } // This update originated outside React. Ask the host environment for an - // appropriate priority, based on the type of event. - // - // The opaque type returned by the host config is internally a lane, so we can - // use that directly. - // TODO: Move this type conversion to the event priority module. - - var eventLane = getCurrentEventPriority(); - return eventLane; + return eventPriorityToLane(resolveUpdatePriority()); } function requestRetryLane(fiber) { @@ -22920,7 +22722,7 @@ if (__DEV__) { !disableLegacyMode && (fiber.mode & ConcurrentMode) === NoMode ) { - if (ReactCurrentActQueue.isBatchingLegacy); + if (ReactSharedInternals.isBatchingLegacy); else { // Flush the synchronous work now, unless we're already working or inside // a batch. This is intentionally inside scheduleUpdateOnFiber instead of @@ -23022,20 +22824,31 @@ if (__DEV__) { } // Check if something threw if (exitStatus === RootErrored) { - var originallyAttemptedLanes = lanes; + var lanesThatJustErrored = lanes; var errorRetryLanes = getLanesToRetrySynchronouslyOnError( root, - originallyAttemptedLanes + lanesThatJustErrored ); if (errorRetryLanes !== NoLanes) { lanes = errorRetryLanes; exitStatus = recoverFromConcurrentError( root, - originallyAttemptedLanes, + lanesThatJustErrored, errorRetryLanes ); - renderWasConcurrent = false; + renderWasConcurrent = false; // Need to check the exit status again. + + if (exitStatus !== RootErrored) { + // The root did not error this time. Restart the exit algorithm + // from the beginning. + // TODO: Refactor the exit algorithm to be less confusing. Maybe + // more branches + recursion instead of a loop. I think the only + // thing that causes it to be a loop is the RootDidNotComplete + // check. If that's true, then we don't need a loop/recursion + // at all. + continue; + } } } @@ -23460,7 +23273,7 @@ if (__DEV__) { if ( executionContext === NoContext && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode. - !ReactCurrentActQueue.isBatchingLegacy + !ReactSharedInternals.isBatchingLegacy ) { resetRenderTimer(); flushSyncWorkOnLegacyRootsOnly(); @@ -23473,7 +23286,7 @@ if (__DEV__) { // eslint-disable-next-line no-redeclare // eslint-disable-next-line no-redeclare - function flushSync(fn) { + function flushSyncFromReconciler(fn) { // In legacy mode, we flush pending passive effects at the beginning of the // next event, not at the end of the previous one. if ( @@ -23487,12 +23300,12 @@ if (__DEV__) { var prevExecutionContext = executionContext; executionContext |= BatchedContext; - var prevTransition = ReactCurrentBatchConfig.transition; + var prevTransition = ReactSharedInternals.T; var previousPriority = getCurrentUpdatePriority(); try { - ReactCurrentBatchConfig.transition = null; setCurrentUpdatePriority(DiscreteEventPriority); + ReactSharedInternals.T = null; if (fn) { return fn(); @@ -23501,7 +23314,7 @@ if (__DEV__) { } } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig.transition = prevTransition; + ReactSharedInternals.T = prevTransition; executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch. // Note that this will happen even if batchedUpdates is higher up // the stack. @@ -23513,6 +23326,16 @@ if (__DEV__) { flushSyncWorkOnAllRoots(); } } + } // If called outside of a render or commit will flush all sync work on all roots + // Returns whether the the call was during a render or not + + function flushSyncWork() { + if ((executionContext & (RenderContext | CommitContext)) === NoContext) { + flushSyncWorkOnAllRoots(); + return false; + } + + return true; } // hidden subtree. The stack logic is managed there because that's the only // place that ever modifies it. Which module it lives in doesn't matter for @@ -23626,7 +23449,10 @@ if (__DEV__) { // when React is executing user code. resetHooksAfterThrow(); resetCurrentFiber(); - ReactCurrentOwner.current = null; + + { + ReactSharedInternals.owner = null; + } if (thrownValue === SuspenseException) { // This is a special type of exception used for Suspense. For historical @@ -23778,8 +23604,8 @@ if (__DEV__) { } function pushDispatcher(container) { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = ContextOnlyDispatcher; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = ContextOnlyDispatcher; if (prevDispatcher === null) { // The React isomorphic package does not include a default dispatcher. @@ -23792,20 +23618,20 @@ if (__DEV__) { } function popDispatcher(prevDispatcher) { - ReactCurrentDispatcher.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } function pushCacheDispatcher() { { - var prevCacheDispatcher = ReactCurrentCache.current; - ReactCurrentCache.current = DefaultCacheDispatcher; + var prevCacheDispatcher = ReactSharedInternals.C; + ReactSharedInternals.C = DefaultCacheDispatcher; return prevCacheDispatcher; } } function popCacheDispatcher(prevCacheDispatcher) { { - ReactCurrentCache.current = prevCacheDispatcher; + ReactSharedInternals.C = prevCacheDispatcher; } } @@ -24182,7 +24008,7 @@ if (__DEV__) { } } - if (true && ReactCurrentActQueue.current !== null) { + if (true && ReactSharedInternals.actQueue !== null) { // `act` special case: If we're inside an `act` scope, don't consult // `shouldYield`. Always keep working until the render is complete. // This is not just an optimization: in a unit test environment, we @@ -24261,7 +24087,9 @@ if (__DEV__) { workInProgress = next; } - ReactCurrentOwner.current = null; + { + ReactSharedInternals.owner = null; + } } function replaySuspendedUnitOfWork(unitOfWork) { @@ -24387,7 +24215,9 @@ if (__DEV__) { workInProgress = next; } - ReactCurrentOwner.current = null; + { + ReactSharedInternals.owner = null; + } } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { @@ -24597,12 +24427,12 @@ if (__DEV__) { ) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. + var prevTransition = ReactSharedInternals.T; var previousUpdateLanePriority = getCurrentUpdatePriority(); - var prevTransition = ReactCurrentBatchConfig.transition; try { - ReactCurrentBatchConfig.transition = null; setCurrentUpdatePriority(DiscreteEventPriority); + ReactSharedInternals.T = null; commitRootImpl( root, recoverableErrors, @@ -24612,7 +24442,7 @@ if (__DEV__) { spawnedLane ); } finally { - ReactCurrentBatchConfig.transition = prevTransition; + ReactSharedInternals.T = prevTransition; setCurrentUpdatePriority(previousUpdateLanePriority); } @@ -24742,14 +24572,16 @@ if (__DEV__) { NoFlags$1; if (subtreeHasEffects || rootHasEffect) { - var prevTransition = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = null; + var prevTransition = ReactSharedInternals.T; + ReactSharedInternals.T = null; var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(DiscreteEventPriority); var prevExecutionContext = executionContext; executionContext |= CommitContext; // Reset this to null before calling lifecycles - ReactCurrentOwner.current = null; // The commit phase is broken into several sub-phases. We do a separate pass + { + ReactSharedInternals.owner = null; + } // The commit phase is broken into several sub-phases. We do a separate pass // of the effect list for each phase: all mutation effects come before all // layout effects, and so on. // The first phase a "before mutation" phase. We use this phase to read the @@ -24786,7 +24618,7 @@ if (__DEV__) { executionContext = prevExecutionContext; // Reset the priority to the previous non-sync value. setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig.transition = prevTransition; + ReactSharedInternals.T = prevTransition; } else { // No effects. root.current = finishedWork; // Measure these anyway so the flamegraph explicitly shows that there were @@ -24963,16 +24795,16 @@ if (__DEV__) { pendingPassiveEffectsRemainingLanes = NoLanes; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes); var priority = lowerEventPriority(DefaultEventPriority, renderPriority); - var prevTransition = ReactCurrentBatchConfig.transition; + var prevTransition = ReactSharedInternals.T; var previousPriority = getCurrentUpdatePriority(); try { - ReactCurrentBatchConfig.transition = null; setCurrentUpdatePriority(priority); + ReactSharedInternals.T = null; return flushPassiveEffectsImpl(); } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig.transition = prevTransition; // Once passive effects have run for the tree - giving components a + ReactSharedInternals.T = prevTransition; // Once passive effects have run for the tree - giving components a // chance to retain cache instances they use - release the pooled // cache at the root (if there is one) @@ -25550,7 +25382,7 @@ if (__DEV__) { { // If we're currently inside an `act` scope, bypass Scheduler and push to // the `act` queue instead. - var actQueue = ReactCurrentActQueue.current; + var actQueue = ReactSharedInternals.actQueue; if (actQueue !== null) { actQueue.push(callback); @@ -25563,7 +25395,7 @@ if (__DEV__) { function shouldForceFlushFallbacksInDEV() { // Never force flush in production. This function should get stripped out. - return ReactCurrentActQueue.current !== null; + return ReactSharedInternals.actQueue !== null; } function warnIfUpdatesNotWrappedWithActDEV(fiber) { @@ -25597,7 +25429,7 @@ if (__DEV__) { } } - if (ReactCurrentActQueue.current === null) { + if (ReactSharedInternals.actQueue === null) { var previousFiber = current; try { @@ -25632,7 +25464,7 @@ if (__DEV__) { if ( root.tag !== LegacyRoot && isConcurrentActEnvironment() && - ReactCurrentActQueue.current === null + ReactSharedInternals.actQueue === null ) { error( "A suspended resource finished loading inside a test, but the event " + @@ -25841,13 +25673,12 @@ if (__DEV__) { var staleFamilies = update.staleFamilies, updatedFamilies = update.updatedFamilies; flushPassiveEffects(); - flushSync(function () { - scheduleFibersWithFamiliesRecursively( - root.current, - updatedFamilies, - staleFamilies - ); - }); + scheduleFibersWithFamiliesRecursively( + root.current, + updatedFamilies, + staleFamilies + ); + flushSyncWork(); } }; var scheduleRoot = function (root, element) { @@ -25859,10 +25690,8 @@ if (__DEV__) { return; } - flushPassiveEffects(); - flushSync(function () { - updateContainer(element, root, null, null); - }); + updateContainerSync(element, root, null, null); + flushSyncWork(); } }; @@ -26560,7 +26389,7 @@ if (__DEV__) { "named imports."; } - var ownerName = owner ? getComponentNameFromFiber(owner) : null; + var ownerName = owner ? getComponentNameFromOwner(owner) : null; if (ownerName) { info += "\n\nCheck the render method of `" + ownerName + "`."; @@ -26823,7 +26652,82 @@ if (__DEV__) { return root; } - var ReactVersion = "19.0.0-canary-29bd6113"; + var ReactVersion = "19.0.0-canary-0c0d6d6d"; + + /* + * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol + * and Temporal.* types. See https://github.com/facebook/react/pull/22064. + * + * The functions in this module will throw an easier-to-understand, + * easier-to-debug exception with a clear errors message message explaining the + * problem. (Instead of a confusing exception thrown inside the implementation + * of the `value` object). + */ + // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. + function typeName(value) { + { + // toStringTag is needed for namespaced types like Temporal.Instant + var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; + var type = + (hasToStringTag && value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; // $FlowFixMe[incompatible-return] + + return type; + } + } // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. + + function willCoercionThrow(value) { + { + try { + testStringCoercion(value); + return false; + } catch (e) { + return true; + } + } + } + + function testStringCoercion(value) { + // If you ended up here by following an exception call stack, here's what's + // happened: you supplied an object or symbol value to React (as a prop, key, + // DOM attribute, CSS property, string ref, etc.) and when React tried to + // coerce it to a string using `'' + value`, an exception was thrown. + // + // The most common types that will cause this exception are `Symbol` instances + // and Temporal objects like `Temporal.Instant`. But any object that has a + // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this + // exception. (Library authors do this to prevent users from using built-in + // numeric operators like `+` or comparison operators like `>=` because custom + // methods are needed to perform accurate arithmetic or comparison.) + // + // To fix the problem, coerce this object or symbol value to a string before + // passing it to React. The most reliable way is usually `String(value)`. + // + // To find which value is throwing, check the browser or debugger console. + // Before this exception was thrown, there should be `console.error` output + // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the + // problem and how that type was used: key, atrribute, input value prop, etc. + // In most cases, this console output also shows the component and its + // ancestor components where the exception happened. + // + // eslint-disable-next-line react-internal/safe-string-coercion + return "" + value; + } + function checkPropStringCoercion(value, propName) { + { + if (willCoercionThrow(value)) { + error( + "The provided `%s` prop is an unsupported type %s." + + " This value must be coerced to a string before using it here.", + propName, + typeName(value) + ); + + return testStringCoercion(value); // throw (to help callers find troubleshooting comments) + } + } + } // Might add PROFILE later. @@ -26883,13 +26787,52 @@ if (__DEV__) { ); } function updateContainer(element, container, parentComponent, callback) { + var current = container.current; + var lane = requestUpdateLane(current); + updateContainerImpl( + current, + lane, + element, + container, + parentComponent, + callback + ); + return lane; + } + function updateContainerSync( + element, + container, + parentComponent, + callback + ) { + if (container.tag === LegacyRoot) { + flushPassiveEffects(); + } + + var current = container.current; + updateContainerImpl( + current, + SyncLane, + element, + container, + parentComponent, + callback + ); + return SyncLane; + } + + function updateContainerImpl( + rootFiber, + lane, + element, + container, + parentComponent, + callback + ) { { onScheduleRoot(container, element); } - var current$1 = container.current; - var lane = requestUpdateLane(current$1); - { markRenderScheduled(lane); } @@ -26938,14 +26881,12 @@ if (__DEV__) { update.callback = callback; } - var root = enqueueUpdate(current$1, update, lane); + var root = enqueueUpdate(rootFiber, update, lane); if (root !== null) { - scheduleUpdateOnFiber(root, current$1, lane); - entangleTransitions(root, current$1, lane); + scheduleUpdateOnFiber(root, rootFiber, lane); + entangleTransitions(root, rootFiber, lane); } - - return lane; } function getPublicRootInstance(container) { var containerFiber = container.current; @@ -27235,7 +27176,6 @@ if (__DEV__) { function injectIntoDevTools(devToolsConfig) { var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; return injectInternals({ bundleType: devToolsConfig.bundleType, version: devToolsConfig.version, @@ -27250,7 +27190,7 @@ if (__DEV__) { setErrorHandler: setErrorHandler, setSuspenseHandler: setSuspenseHandler, scheduleUpdate: scheduleUpdate, - currentDispatcherRef: ReactCurrentDispatcher, + currentDispatcherRef: ReactSharedInternals, findHostInstanceByFiber: findHostInstanceByFiber, findFiberByHostInstance: findFiberByHostInstance || emptyFindFiberByHostInstance, @@ -27846,7 +27786,7 @@ if (__DEV__) { return getPublicRootInstance(root); }, - unstable_flushSync: flushSync + unstable_flushSync: flushSyncFromReconciler }; Object.defineProperty(entry, "root", { configurable: true, diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js index dd824d4f4d..c66008955e 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<432e9d2dc4a6b45da0162dd89f63ecfc>> + * @generated SignedSource<<1dd8bb3dc2153d156dd96432dba441cd>> */ "use strict"; @@ -30,7 +30,7 @@ function _createClass(Constructor, protoProps, staticProps) { } var assign = Object.assign, ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, REACT_ELEMENT_TYPE = Symbol.for("react.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), @@ -509,7 +509,6 @@ function markRootEntangled(root, entangledLanes) { rootEntangledLanes &= ~lane; } } -var currentUpdatePriority = 0; function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes @@ -551,7 +550,8 @@ function insertBefore(parentInstance, child, beforeChild) { beforeChild = parentInstance.children.indexOf(beforeChild); parentInstance.children.splice(beforeChild, 0, child); } -var scheduleTimeout = setTimeout, +var currentUpdatePriority = 0, + scheduleTimeout = setTimeout, cancelTimeout = clearTimeout, valueStack = [], index = -1; @@ -654,28 +654,24 @@ function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); } var objectIs = "function" === typeof Object.is ? Object.is : is; -function describeComponentFrame(name, ownerName) { - var sourceInfo = ""; - ownerName && (sourceInfo = " (created by " + ownerName + ")"); - return "\n in " + (name || "Unknown") + sourceInfo; +function describeBuiltInComponentFrame(name) { + return "\n in " + (name || "Unknown"); } function describeFunctionComponentFrame(fn) { - return fn - ? describeComponentFrame(fn.displayName || fn.name || null, null) - : ""; + return fn ? "\n in " + (fn.displayName || fn.name || "Unknown") : ""; } function describeFiber(fiber) { switch (fiber.tag) { case 26: case 27: case 5: - return describeComponentFrame(fiber.type, null); + return describeBuiltInComponentFrame(fiber.type); case 16: - return describeComponentFrame("Lazy", null); + return describeBuiltInComponentFrame("Lazy"); case 13: - return describeComponentFrame("Suspense", null); + return describeBuiltInComponentFrame("Suspense"); case 19: - return describeComponentFrame("SuspenseList", null); + return describeBuiltInComponentFrame("SuspenseList"); case 0: case 15: return describeFunctionComponentFrame(fiber.type); @@ -1388,55 +1384,6 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef -) { - function ref(value) { - var refs = inst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - } - var stringRef = "" + mixedRef; - returnFiber = element._owner; - if (!returnFiber) - throw Error( - "Element ref was specified as a string (" + - stringRef + - ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://react.dev/link/refs-must-have-owner for more information." - ); - if (1 !== returnFiber.tag) - throw Error( - "Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref" - ); - var inst = returnFiber.stateNode; - if (!inst) - throw Error( - "Missing owner for string ref " + - stringRef + - ". This error is likely caused by a bug in React. Please file an issue." - ); - if ( - null !== current && - null !== current.ref && - "function" === typeof current.ref && - current.ref._stringRef === stringRef - ) - return current.ref; - ref._stringRef = stringRef; - return ref; -} -function coerceRef(returnFiber, current, workInProgress, element) { - var mixedRef = element.ref; - returnFiber = - "string" === typeof mixedRef || - "number" === typeof mixedRef || - "boolean" === typeof mixedRef - ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) - : mixedRef; - workInProgress.ref = returnFiber; -} function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); throw Error( @@ -1532,12 +1479,12 @@ function createChildReconciler(shouldTrackSideEffects) { resolveLazy(elementType) === current.type)) ) return ( - (lanes = useFiber(current, element.props)), - coerceRef(returnFiber, current, lanes, element), - (lanes.return = returnFiber), - lanes + (current = useFiber(current, element.props)), + (current.ref = element.ref), + (current.return = returnFiber), + current ); - lanes = createFiberFromTypeAndProps( + current = createFiberFromTypeAndProps( element.type, element.key, element.props, @@ -1545,9 +1492,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - coerceRef(returnFiber, current, lanes, element); - lanes.return = returnFiber; - return lanes; + current.ref = element.ref; + current.return = returnFiber; + return current; } function updatePortal(returnFiber, current, portal, lanes) { if ( @@ -1608,7 +1555,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, null, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), lanes ); @@ -1948,52 +1895,54 @@ function createChildReconciler(shouldTrackSideEffects) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: a: { - for ( - var key = newChild.key, child = currentFirstChild; - null !== child; - - ) { - if (child.key === key) { + for (var key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) { key = newChild.type; if (key === REACT_FRAGMENT_TYPE) { - if (7 === child.tag) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber( - child, + if (7 === currentFirstChild.tag) { + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber( + currentFirstChild, newChild.props.children ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes.return = returnFiber; + returnFiber = lanes; break a; } } else if ( - child.elementType === key || + currentFirstChild.elementType === key || ("object" === typeof key && null !== key && key.$$typeof === REACT_LAZY_TYPE && - resolveLazy(key) === child.type) + resolveLazy(key) === currentFirstChild.type) ) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber(child, newChild.props); - coerceRef(returnFiber, child, currentFirstChild, newChild); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber(currentFirstChild, newChild.props); + lanes.ref = newChild.ref; + lanes.return = returnFiber; + returnFiber = lanes; break a; } - deleteRemainingChildren(returnFiber, child); + deleteRemainingChildren(returnFiber, currentFirstChild); break; - } else deleteChild(returnFiber, child); - child = child.sibling; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; } newChild.type === REACT_FRAGMENT_TYPE - ? ((currentFirstChild = createFiberFromFragment( + ? ((lanes = createFiberFromFragment( newChild.props.children, returnFiber.mode, lanes, newChild.key )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes.return = returnFiber), + (returnFiber = lanes)) : ((lanes = createFiberFromTypeAndProps( newChild.type, newChild.key, @@ -2002,15 +1951,15 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, currentFirstChild, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), (returnFiber = lanes)); } return placeSingleChild(returnFiber); case REACT_PORTAL_TYPE: a: { - for (child = newChild.key; null !== currentFirstChild; ) { - if (currentFirstChild.key === child) + for (key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) if ( 4 === currentFirstChild.tag && currentFirstChild.stateNode.containerInfo === @@ -2022,12 +1971,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber, currentFirstChild.sibling ); - currentFirstChild = useFiber( - currentFirstChild, - newChild.children || [] - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = useFiber(currentFirstChild, newChild.children || []); + lanes.return = returnFiber; + returnFiber = lanes; break a; } else { deleteRemainingChildren(returnFiber, currentFirstChild); @@ -2036,22 +1982,18 @@ function createChildReconciler(shouldTrackSideEffects) { else deleteChild(returnFiber, currentFirstChild); currentFirstChild = currentFirstChild.sibling; } - currentFirstChild = createFiberFromPortal( - newChild, - returnFiber.mode, - lanes - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = createFiberFromPortal(newChild, returnFiber.mode, lanes); + lanes.return = returnFiber; + returnFiber = lanes; } return placeSingleChild(returnFiber); case REACT_LAZY_TYPE: return ( - (child = newChild._init), + (key = newChild._init), reconcileChildFibersImpl( returnFiber, currentFirstChild, - child(newChild._payload), + key(newChild._payload), lanes ) ); @@ -2092,17 +2034,13 @@ function createChildReconciler(shouldTrackSideEffects) { ? ((newChild = "" + newChild), null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), - (currentFirstChild = useFiber(currentFirstChild, newChild)), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes = useFiber(currentFirstChild, newChild)), + (lanes.return = returnFiber), + (returnFiber = lanes)) : (deleteRemainingChildren(returnFiber, currentFirstChild), - (currentFirstChild = createFiberFromText( - newChild, - returnFiber.mode, - lanes - )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)), + (lanes = createFiberFromText(newChild, returnFiber.mode, lanes)), + (lanes.return = returnFiber), + (returnFiber = lanes)), placeSingleChild(returnFiber)) : deleteRemainingChildren(returnFiber, currentFirstChild); } @@ -2195,9 +2133,7 @@ function findFirstSuspended(row) { } return null; } -var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, - renderLanes = 0, +var renderLanes = 0, currentlyRenderingFiber$1 = null, currentHook = null, workInProgressHook = null, @@ -2231,7 +2167,7 @@ function renderWithHooks( workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; - ReactCurrentDispatcher$1.current = + ReactSharedInternals.H = null === current || null === current.memoizedState ? HooksDispatcherOnMount : HooksDispatcherOnUpdate; @@ -2249,7 +2185,7 @@ function renderWithHooks( return current; } function finishRenderingHooks() { - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + ReactSharedInternals.H = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; @@ -2275,16 +2211,22 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { numberOfReRenders += 1; workInProgressHook = currentHook = null; workInProgress.updateQueue = null; - ReactCurrentDispatcher$1.current = HooksDispatcherOnRerender; + ReactSharedInternals.H = HooksDispatcherOnRerender; var children = Component(props, secondArg); } while (didScheduleRenderPhaseUpdateDuringThisPass); return children; } function TransitionAwareHostComponent() { - var maybeThenable = ReactCurrentDispatcher$1.current.useState()[0]; - return "function" === typeof maybeThenable.then - ? useThenable(maybeThenable) - : maybeThenable; + var dispatcher = ReactSharedInternals.H, + maybeThenable = dispatcher.useState()[0]; + maybeThenable = + "function" === typeof maybeThenable.then + ? useThenable(maybeThenable) + : maybeThenable; + dispatcher = dispatcher.useState()[0]; + (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher && + (currentlyRenderingFiber$1.flags |= 1024); + return maybeThenable; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; @@ -2372,7 +2314,7 @@ function useThenable(thenable) { (null === workInProgressHook ? null === currentlyRenderingFiber$1.memoizedState : null === workInProgressHook.next) && - (ReactCurrentDispatcher$1.current = HooksDispatcherOnMount); + (ReactSharedInternals.H = HooksDispatcherOnMount); return thenable; } function use(usable) { @@ -2672,9 +2614,9 @@ function dispatchActionState( function runActionStateAction(actionQueue, setPendingState, setState, payload) { var action = actionQueue.action, prevState = actionQueue.state, - prevTransition = ReactCurrentBatchConfig$2.transition, + prevTransition = ReactSharedInternals.T, currentTransition = { _callbacks: new Set() }; - ReactCurrentBatchConfig$2.transition = currentTransition; + ReactSharedInternals.T = currentTransition; setPendingState(!0); try { var returnValue = action(prevState, payload); @@ -2707,7 +2649,7 @@ function runActionStateAction(actionQueue, setPendingState, setState, payload) { setState({ then: function () {}, status: "rejected", reason: error }), finishRunningActionStateAction(actionQueue, setPendingState, setState); } finally { - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactSharedInternals.T = prevTransition; } } function finishRunningActionStateAction( @@ -2916,26 +2858,24 @@ function updateMemo(nextCreate, deps) { hook.memoizedState = [prevState, deps]; return prevState; } -function mountDeferredValueImpl(hook, value, initialValue) { - if (void 0 === initialValue || 0 !== (renderLanes & 1073741824)) - return (hook.memoizedState = value); - hook.memoizedState = initialValue; - hook = requestDeferredLane(); - currentlyRenderingFiber$1.lanes |= hook; - workInProgressRootSkippedLanes |= hook; - return initialValue; -} -function updateDeferredValueImpl(hook, prevValue, value, initialValue) { +function updateDeferredValueImpl(hook, prevValue, value) { if (objectIs(value, prevValue)) return value; if (null !== currentTreeHiddenStackCursor.current) return ( - (hook = mountDeferredValueImpl(hook, value, initialValue)), - objectIs(hook, prevValue) || (didReceiveUpdate = !0), - hook + (hook.memoizedState = value), + objectIs(value, prevValue) || (didReceiveUpdate = !0), + value ); if (0 === (renderLanes & 42)) return (didReceiveUpdate = !0), (hook.memoizedState = value); - hook = requestDeferredLane(); + 0 === workInProgressDeferredLane && + (workInProgressDeferredLane = + 0 !== (workInProgressRootRenderLanes & 536870912) + ? 536870912 + : claimNextTransitionLane()); + hook = suspenseHandlerStackCursor.current; + null !== hook && (hook.flags |= 32); + hook = workInProgressDeferredLane; currentlyRenderingFiber$1.lanes |= hook; workInProgressRootSkippedLanes |= hook; return prevValue; @@ -2944,9 +2884,9 @@ function startTransition(fiber, queue, pendingState, finishedState, callback) { var previousPriority = currentUpdatePriority; currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; - var prevTransition = ReactCurrentBatchConfig$2.transition, + var prevTransition = ReactSharedInternals.T, currentTransition = { _callbacks: new Set() }; - ReactCurrentBatchConfig$2.transition = currentTransition; + ReactSharedInternals.T = currentTransition; dispatchOptimisticSetState(fiber, !1, queue, pendingState); try { var returnValue = callback(); @@ -2970,7 +2910,7 @@ function startTransition(fiber, queue, pendingState, finishedState, callback) { }); } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$2.transition = prevTransition); + (ReactSharedInternals.T = prevTransition); } } function useHostTransitionStatus() { @@ -3198,9 +3138,9 @@ var HooksDispatcherOnMount = { return [initialState.memoizedState, dispatch]; }, useDebugValue: mountDebugValue, - useDeferredValue: function (value, initialValue) { - var hook = mountWorkInProgressHook(); - return mountDeferredValueImpl(hook, value, initialValue); + useDeferredValue: function (value) { + mountWorkInProgressHook().memoizedState = value; + return value; }, useTransition: function () { var stateHook = mountStateImpl(!1); @@ -3295,14 +3235,9 @@ var HooksDispatcherOnUpdate = { return updateReducer(basicStateReducer); }, useDebugValue: mountDebugValue, - useDeferredValue: function (value, initialValue) { + useDeferredValue: function (value) { var hook = updateWorkInProgressHook(); - return updateDeferredValueImpl( - hook, - currentHook.memoizedState, - value, - initialValue - ); + return updateDeferredValueImpl(hook, currentHook.memoizedState, value); }, useTransition: function () { var booleanOrThenable = updateReducer(basicStateReducer)[0], @@ -3342,16 +3277,11 @@ var HooksDispatcherOnRerender = { return rerenderReducer(basicStateReducer); }, useDebugValue: mountDebugValue, - useDeferredValue: function (value, initialValue) { + useDeferredValue: function (value) { var hook = updateWorkInProgressHook(); return null === currentHook - ? mountDeferredValueImpl(hook, value, initialValue) - : updateDeferredValueImpl( - hook, - currentHook.memoizedState, - value, - initialValue - ); + ? ((hook.memoizedState = value), value) + : updateDeferredValueImpl(hook, currentHook.memoizedState, value); }, useTransition: function () { var booleanOrThenable = rerenderReducer(basicStateReducer)[0], @@ -3534,7 +3464,7 @@ function resolveClassComponentProps( ) { var newProps = baseProps; if ((Component = Component.defaultProps) && !alreadyResolvedDefaultProps) { - newProps = assign({}, newProps, baseProps); + newProps === baseProps && (newProps = assign({}, newProps, baseProps)); for (var propName in Component) void 0 === newProps[propName] && (newProps[propName] = Component[propName]); @@ -3806,8 +3736,7 @@ function throwException( } while (null !== returnFiber); return !1; } -var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner, - SelectiveHydrationException = Error( +var SelectiveHydrationException = Error( "This is not a real error. It's an implementation detail of React's selective hydration feature. If this leaks into userspace, it's a bug in React. Please file an issue." ), didReceiveUpdate = !1; @@ -4022,8 +3951,22 @@ function markRef(current, workInProgress) { throw Error( "Expected ref to be a function, an object returned by React.createRef(), or undefined/null." ); - if (null === current || current.ref !== ref) + if (null === current || current.ref !== ref) { + if ( + null !== current && + ((current = current.ref), + "function" === typeof current && + "function" === typeof ref && + "string" === typeof current.__stringRef && + current.__stringRef === ref.__stringRef && + current.__stringRefType === ref.__stringRefType && + current.__stringRefOwner === ref.__stringRefOwner) + ) { + workInProgress.ref = current; + return; + } workInProgress.flags |= 2097664; + } } } function updateFunctionComponent( @@ -4304,7 +4247,7 @@ function finishClassComponent( bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) ); shouldUpdate = workInProgress.stateNode; - ReactCurrentOwner$1.current = workInProgress; + ReactSharedInternals.owner = workInProgress; var nextChildren = didCaptureError && "function" !== typeof Component.getDerivedStateFromError ? null @@ -5500,9 +5443,8 @@ function releaseCache(cache) { cache.controller.abort(); }); } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; function requestCurrentTransition() { - var transition = ReactCurrentBatchConfig$1.transition; + var transition = ReactSharedInternals.T; null !== transition && transition._callbacks.add(handleAsyncAction); return transition; } @@ -6586,7 +6528,7 @@ function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { captureCommitPhaseError(childToDelete, parentFiber, error); } } - if (parentFiber.subtreeFlags & 12854) + if (parentFiber.subtreeFlags & 13878) for (parentFiber = parentFiber.child; null !== parentFiber; ) commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), (parentFiber = parentFiber.sibling); @@ -7445,10 +7387,6 @@ var DefaultCacheDispatcher = { } }, PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, - ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, executionContext = 0, workInProgressRoot = null, workInProgress = null, @@ -7485,18 +7423,8 @@ function requestUpdateLane(fiber) { (fiber = currentEntangledLane), 0 !== fiber ? fiber : requestTransitionLane() ); - fiber = currentUpdatePriority; - return 0 !== fiber ? fiber : 32; -} -function requestDeferredLane() { - 0 === workInProgressDeferredLane && - (workInProgressDeferredLane = - 0 !== (workInProgressRootRenderLanes & 536870912) - ? 536870912 - : claimNextTransitionLane()); - var suspenseHandler = suspenseHandlerStackCursor.current; - null !== suspenseHandler && (suspenseHandler.flags |= 32); - return workInProgressDeferredLane; + fiber = 0 !== currentUpdatePriority ? currentUpdatePriority : 32; + return fiber; } function scheduleUpdateOnFiber(root, fiber, lane) { if ( @@ -7564,13 +7492,18 @@ function performConcurrentWorkOnRoot(root, didTimeout) { root, renderWasConcurrent ); - 0 !== errorRetryLanes && + if ( + 0 !== errorRetryLanes && ((lanes = errorRetryLanes), (exitStatus = recoverFromConcurrentError( root, renderWasConcurrent, errorRetryLanes - ))); + )), + (renderWasConcurrent = !1), + 2 !== exitStatus) + ) + continue; } if (1 === exitStatus) { prepareFreshStack(root, 0); @@ -7795,25 +7728,21 @@ function performSyncWorkOnRoot(root, lanes) { ensureRootIsScheduled(root); return null; } -function flushSync(fn) { +function flushSyncFromReconciler(fn) { null !== rootWithPendingPassiveEffects && 0 === rootWithPendingPassiveEffects.tag && 0 === (executionContext & 6) && flushPassiveEffects(); var prevExecutionContext = executionContext; executionContext |= 1; - var prevTransition = ReactCurrentBatchConfig.transition, + var prevTransition = ReactSharedInternals.T, previousPriority = currentUpdatePriority; try { - if ( - ((ReactCurrentBatchConfig.transition = null), - (currentUpdatePriority = 2), - fn) - ) + if (((currentUpdatePriority = 2), (ReactSharedInternals.T = null), fn)) return fn(); } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig.transition = prevTransition), + (ReactSharedInternals.T = prevTransition), (executionContext = prevExecutionContext), 0 === (executionContext & 6) && flushSyncWorkAcrossRoots_impl(!1); } @@ -7879,8 +7808,8 @@ function prepareFreshStack(root, lanes) { } function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - ReactCurrentOwner.current = null; + ReactSharedInternals.H = ContextOnlyDispatcher; + ReactSharedInternals.owner = null; if (thrownValue === SuspenseException) { thrownValue = getSuspendedThenable(); var handler = suspenseHandlerStackCursor.current; @@ -7918,13 +7847,13 @@ function handleThrow(root, thrownValue) { )); } function pushDispatcher() { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = ContextOnlyDispatcher; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = ContextOnlyDispatcher; return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; } function pushCacheDispatcher() { - var prevCacheDispatcher = ReactCurrentCache.current; - ReactCurrentCache.current = DefaultCacheDispatcher; + var prevCacheDispatcher = ReactSharedInternals.C; + ReactSharedInternals.C = DefaultCacheDispatcher; return prevCacheDispatcher; } function renderDidSuspendDelayIfPossible() { @@ -7976,8 +7905,8 @@ function renderRootSync(root, lanes) { lanes && root.shellSuspendCounter++; resetContextDependencies(); executionContext = prevExecutionContext; - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; + ReactSharedInternals.H = prevDispatcher; + ReactSharedInternals.C = prevCacheDispatcher; if (null !== workInProgress) throw Error( "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." @@ -8083,8 +8012,8 @@ function renderRootConcurrent(root, lanes) { } while (1); resetContextDependencies(); - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; + ReactSharedInternals.H = prevDispatcher; + ReactSharedInternals.C = prevCacheDispatcher; executionContext = prevExecutionContext; if (null !== workInProgress) return 0; workInProgressRoot = null; @@ -8100,7 +8029,7 @@ function performUnitOfWork(unitOfWork) { var next = beginWork(unitOfWork.alternate, unitOfWork, entangledRenderLanes); unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; } function replaySuspendedUnitOfWork(unitOfWork) { var current = unitOfWork.alternate; @@ -8154,7 +8083,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { null === current ? completeUnitOfWork(unitOfWork) : (workInProgress = current); - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -8241,11 +8170,11 @@ function commitRoot( didIncludeRenderPhaseUpdate, spawnedLane ) { - var previousUpdateLanePriority = currentUpdatePriority, - prevTransition = ReactCurrentBatchConfig.transition; + var prevTransition = ReactSharedInternals.T, + previousUpdateLanePriority = currentUpdatePriority; try { - (ReactCurrentBatchConfig.transition = null), - (currentUpdatePriority = 2), + (currentUpdatePriority = 2), + (ReactSharedInternals.T = null), commitRootImpl( root, recoverableErrors, @@ -8255,7 +8184,7 @@ function commitRoot( spawnedLane ); } finally { - (ReactCurrentBatchConfig.transition = prevTransition), + (ReactSharedInternals.T = prevTransition), (currentUpdatePriority = previousUpdateLanePriority); } return null; @@ -8302,13 +8231,13 @@ function commitRootImpl( })); transitions = 0 !== (finishedWork.flags & 15990); if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = null; + transitions = ReactSharedInternals.T; + ReactSharedInternals.T = null; spawnedLane = currentUpdatePriority; currentUpdatePriority = 2; var prevExecutionContext = executionContext; executionContext |= 4; - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; commitBeforeMutationEffects(root, finishedWork); commitMutationEffectsOnFiber(finishedWork, root); root.current = finishedWork; @@ -8316,7 +8245,7 @@ function commitRootImpl( requestPaint(); executionContext = prevExecutionContext; currentUpdatePriority = spawnedLane; - ReactCurrentBatchConfig.transition = transitions; + ReactSharedInternals.T = transitions; } else root.current = finishedWork; rootDoesHavePassiveEffects ? ((rootDoesHavePassiveEffects = !1), @@ -8361,16 +8290,15 @@ function flushPassiveEffects() { remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), - priority = 32 > renderPriority ? 32 : renderPriority; - renderPriority = ReactCurrentBatchConfig.transition; - var previousPriority = currentUpdatePriority; + prevTransition = ReactSharedInternals.T, + previousPriority = currentUpdatePriority; try { - ReactCurrentBatchConfig.transition = null; - currentUpdatePriority = priority; + currentUpdatePriority = 32 > renderPriority ? 32 : renderPriority; + ReactSharedInternals.T = null; if (null === rootWithPendingPassiveEffects) var JSCompiler_inline_result = !1; else { - priority = pendingPassiveTransitions; + renderPriority = pendingPassiveTransitions; pendingPassiveTransitions = null; var root$jscomp$0 = rootWithPendingPassiveEffects, lanes = pendingPassiveEffectsLanes; @@ -8385,7 +8313,7 @@ function flushPassiveEffects() { root$jscomp$0, root$jscomp$0.current, lanes, - priority + renderPriority ); executionContext = prevExecutionContext; flushSyncWorkAcrossRoots_impl(!1); @@ -8401,7 +8329,7 @@ function flushPassiveEffects() { return JSCompiler_inline_result; } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig.transition = renderPriority), + (ReactSharedInternals.T = prevTransition), releaseRootPooledCache(root, remainingLanes); } } @@ -9211,19 +9139,19 @@ function wrapFiber(fiber) { fiberToWrapper.set(fiber, wrapper)); return wrapper; } -var devToolsConfig$jscomp$inline_995 = { +var devToolsConfig$jscomp$inline_1019 = { findFiberByHostInstance: function () { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "19.0.0-canary-0689007c", + version: "19.0.0-canary-5154cd5b", rendererPackageName: "react-test-renderer" }; -var internals$jscomp$inline_1185 = { - bundleType: devToolsConfig$jscomp$inline_995.bundleType, - version: devToolsConfig$jscomp$inline_995.version, - rendererPackageName: devToolsConfig$jscomp$inline_995.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_995.rendererConfig, +var internals$jscomp$inline_1238 = { + bundleType: devToolsConfig$jscomp$inline_1019.bundleType, + version: devToolsConfig$jscomp$inline_1019.version, + rendererPackageName: devToolsConfig$jscomp$inline_1019.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1019.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -9233,33 +9161,33 @@ var internals$jscomp$inline_1185 = { setErrorHandler: null, setSuspenseHandler: null, scheduleUpdate: null, - currentDispatcherRef: ReactSharedInternals.ReactCurrentDispatcher, + currentDispatcherRef: ReactSharedInternals, findHostInstanceByFiber: function (fiber) { fiber = findCurrentFiberUsingSlowPath(fiber); fiber = null !== fiber ? findCurrentHostFiberImpl(fiber) : null; return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_995.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1019.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-0689007c" + reconcilerVersion: "19.0.0-canary-5154cd5b" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1186 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1239 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1186.isDisabled && - hook$jscomp$inline_1186.supportsFiber + !hook$jscomp$inline_1239.isDisabled && + hook$jscomp$inline_1239.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1186.inject( - internals$jscomp$inline_1185 + (rendererID = hook$jscomp$inline_1239.inject( + internals$jscomp$inline_1238 )), - (injectedHook = hook$jscomp$inline_1186); + (injectedHook = hook$jscomp$inline_1239); } catch (err) {} } exports._Scheduler = Scheduler; @@ -9359,7 +9287,7 @@ exports.create = function (element, options) { } return JSCompiler_inline_result; }, - unstable_flushSync: flushSync + unstable_flushSync: flushSyncFromReconciler }; Object.defineProperty(element, "root", { configurable: !0, diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js index 00aeb66066..c42289461c 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<479c2ca549cdf886d9b952949809f126>> */ "use strict"; @@ -30,7 +30,7 @@ function _createClass(Constructor, protoProps, staticProps) { } var assign = Object.assign, ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, REACT_ELEMENT_TYPE = Symbol.for("react.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), @@ -597,7 +597,6 @@ function markRootEntangled(root, entangledLanes) { rootEntangledLanes &= ~lane; } } -var currentUpdatePriority = 0; function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes @@ -639,7 +638,8 @@ function insertBefore(parentInstance, child, beforeChild) { beforeChild = parentInstance.children.indexOf(beforeChild); parentInstance.children.splice(beforeChild, 0, child); } -var scheduleTimeout = setTimeout, +var currentUpdatePriority = 0, + scheduleTimeout = setTimeout, cancelTimeout = clearTimeout, valueStack = [], index = -1; @@ -742,28 +742,24 @@ function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); } var objectIs = "function" === typeof Object.is ? Object.is : is; -function describeComponentFrame(name, ownerName) { - var sourceInfo = ""; - ownerName && (sourceInfo = " (created by " + ownerName + ")"); - return "\n in " + (name || "Unknown") + sourceInfo; +function describeBuiltInComponentFrame(name) { + return "\n in " + (name || "Unknown"); } function describeFunctionComponentFrame(fn) { - return fn - ? describeComponentFrame(fn.displayName || fn.name || null, null) - : ""; + return fn ? "\n in " + (fn.displayName || fn.name || "Unknown") : ""; } function describeFiber(fiber) { switch (fiber.tag) { case 26: case 27: case 5: - return describeComponentFrame(fiber.type, null); + return describeBuiltInComponentFrame(fiber.type); case 16: - return describeComponentFrame("Lazy", null); + return describeBuiltInComponentFrame("Lazy"); case 13: - return describeComponentFrame("Suspense", null); + return describeBuiltInComponentFrame("Suspense"); case 19: - return describeComponentFrame("SuspenseList", null); + return describeBuiltInComponentFrame("SuspenseList"); case 0: case 15: return describeFunctionComponentFrame(fiber.type); @@ -1476,55 +1472,6 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef -) { - function ref(value) { - var refs = inst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - } - var stringRef = "" + mixedRef; - returnFiber = element._owner; - if (!returnFiber) - throw Error( - "Element ref was specified as a string (" + - stringRef + - ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://react.dev/link/refs-must-have-owner for more information." - ); - if (1 !== returnFiber.tag) - throw Error( - "Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref" - ); - var inst = returnFiber.stateNode; - if (!inst) - throw Error( - "Missing owner for string ref " + - stringRef + - ". This error is likely caused by a bug in React. Please file an issue." - ); - if ( - null !== current && - null !== current.ref && - "function" === typeof current.ref && - current.ref._stringRef === stringRef - ) - return current.ref; - ref._stringRef = stringRef; - return ref; -} -function coerceRef(returnFiber, current, workInProgress, element) { - var mixedRef = element.ref; - returnFiber = - "string" === typeof mixedRef || - "number" === typeof mixedRef || - "boolean" === typeof mixedRef - ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) - : mixedRef; - workInProgress.ref = returnFiber; -} function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); throw Error( @@ -1620,12 +1567,12 @@ function createChildReconciler(shouldTrackSideEffects) { resolveLazy(elementType) === current.type)) ) return ( - (lanes = useFiber(current, element.props)), - coerceRef(returnFiber, current, lanes, element), - (lanes.return = returnFiber), - lanes + (current = useFiber(current, element.props)), + (current.ref = element.ref), + (current.return = returnFiber), + current ); - lanes = createFiberFromTypeAndProps( + current = createFiberFromTypeAndProps( element.type, element.key, element.props, @@ -1633,9 +1580,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - coerceRef(returnFiber, current, lanes, element); - lanes.return = returnFiber; - return lanes; + current.ref = element.ref; + current.return = returnFiber; + return current; } function updatePortal(returnFiber, current, portal, lanes) { if ( @@ -1696,7 +1643,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, null, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), lanes ); @@ -2036,52 +1983,54 @@ function createChildReconciler(shouldTrackSideEffects) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: a: { - for ( - var key = newChild.key, child = currentFirstChild; - null !== child; - - ) { - if (child.key === key) { + for (var key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) { key = newChild.type; if (key === REACT_FRAGMENT_TYPE) { - if (7 === child.tag) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber( - child, + if (7 === currentFirstChild.tag) { + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber( + currentFirstChild, newChild.props.children ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes.return = returnFiber; + returnFiber = lanes; break a; } } else if ( - child.elementType === key || + currentFirstChild.elementType === key || ("object" === typeof key && null !== key && key.$$typeof === REACT_LAZY_TYPE && - resolveLazy(key) === child.type) + resolveLazy(key) === currentFirstChild.type) ) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber(child, newChild.props); - coerceRef(returnFiber, child, currentFirstChild, newChild); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber(currentFirstChild, newChild.props); + lanes.ref = newChild.ref; + lanes.return = returnFiber; + returnFiber = lanes; break a; } - deleteRemainingChildren(returnFiber, child); + deleteRemainingChildren(returnFiber, currentFirstChild); break; - } else deleteChild(returnFiber, child); - child = child.sibling; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; } newChild.type === REACT_FRAGMENT_TYPE - ? ((currentFirstChild = createFiberFromFragment( + ? ((lanes = createFiberFromFragment( newChild.props.children, returnFiber.mode, lanes, newChild.key )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes.return = returnFiber), + (returnFiber = lanes)) : ((lanes = createFiberFromTypeAndProps( newChild.type, newChild.key, @@ -2090,15 +2039,15 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, currentFirstChild, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), (returnFiber = lanes)); } return placeSingleChild(returnFiber); case REACT_PORTAL_TYPE: a: { - for (child = newChild.key; null !== currentFirstChild; ) { - if (currentFirstChild.key === child) + for (key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) if ( 4 === currentFirstChild.tag && currentFirstChild.stateNode.containerInfo === @@ -2110,12 +2059,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber, currentFirstChild.sibling ); - currentFirstChild = useFiber( - currentFirstChild, - newChild.children || [] - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = useFiber(currentFirstChild, newChild.children || []); + lanes.return = returnFiber; + returnFiber = lanes; break a; } else { deleteRemainingChildren(returnFiber, currentFirstChild); @@ -2124,22 +2070,18 @@ function createChildReconciler(shouldTrackSideEffects) { else deleteChild(returnFiber, currentFirstChild); currentFirstChild = currentFirstChild.sibling; } - currentFirstChild = createFiberFromPortal( - newChild, - returnFiber.mode, - lanes - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = createFiberFromPortal(newChild, returnFiber.mode, lanes); + lanes.return = returnFiber; + returnFiber = lanes; } return placeSingleChild(returnFiber); case REACT_LAZY_TYPE: return ( - (child = newChild._init), + (key = newChild._init), reconcileChildFibersImpl( returnFiber, currentFirstChild, - child(newChild._payload), + key(newChild._payload), lanes ) ); @@ -2180,17 +2122,13 @@ function createChildReconciler(shouldTrackSideEffects) { ? ((newChild = "" + newChild), null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), - (currentFirstChild = useFiber(currentFirstChild, newChild)), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes = useFiber(currentFirstChild, newChild)), + (lanes.return = returnFiber), + (returnFiber = lanes)) : (deleteRemainingChildren(returnFiber, currentFirstChild), - (currentFirstChild = createFiberFromText( - newChild, - returnFiber.mode, - lanes - )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)), + (lanes = createFiberFromText(newChild, returnFiber.mode, lanes)), + (lanes.return = returnFiber), + (returnFiber = lanes)), placeSingleChild(returnFiber)) : deleteRemainingChildren(returnFiber, currentFirstChild); } @@ -2283,9 +2221,7 @@ function findFirstSuspended(row) { } return null; } -var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, - renderLanes = 0, +var renderLanes = 0, currentlyRenderingFiber$1 = null, currentHook = null, workInProgressHook = null, @@ -2319,7 +2255,7 @@ function renderWithHooks( workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; - ReactCurrentDispatcher$1.current = + ReactSharedInternals.H = null === current || null === current.memoizedState ? HooksDispatcherOnMount : HooksDispatcherOnUpdate; @@ -2337,7 +2273,7 @@ function renderWithHooks( return current; } function finishRenderingHooks() { - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + ReactSharedInternals.H = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; @@ -2363,16 +2299,22 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { numberOfReRenders += 1; workInProgressHook = currentHook = null; workInProgress.updateQueue = null; - ReactCurrentDispatcher$1.current = HooksDispatcherOnRerender; + ReactSharedInternals.H = HooksDispatcherOnRerender; var children = Component(props, secondArg); } while (didScheduleRenderPhaseUpdateDuringThisPass); return children; } function TransitionAwareHostComponent() { - var maybeThenable = ReactCurrentDispatcher$1.current.useState()[0]; - return "function" === typeof maybeThenable.then - ? useThenable(maybeThenable) - : maybeThenable; + var dispatcher = ReactSharedInternals.H, + maybeThenable = dispatcher.useState()[0]; + maybeThenable = + "function" === typeof maybeThenable.then + ? useThenable(maybeThenable) + : maybeThenable; + dispatcher = dispatcher.useState()[0]; + (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher && + (currentlyRenderingFiber$1.flags |= 1024); + return maybeThenable; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; @@ -2460,7 +2402,7 @@ function useThenable(thenable) { (null === workInProgressHook ? null === currentlyRenderingFiber$1.memoizedState : null === workInProgressHook.next) && - (ReactCurrentDispatcher$1.current = HooksDispatcherOnMount); + (ReactSharedInternals.H = HooksDispatcherOnMount); return thenable; } function use(usable) { @@ -2760,9 +2702,9 @@ function dispatchActionState( function runActionStateAction(actionQueue, setPendingState, setState, payload) { var action = actionQueue.action, prevState = actionQueue.state, - prevTransition = ReactCurrentBatchConfig$2.transition, + prevTransition = ReactSharedInternals.T, currentTransition = { _callbacks: new Set() }; - ReactCurrentBatchConfig$2.transition = currentTransition; + ReactSharedInternals.T = currentTransition; setPendingState(!0); try { var returnValue = action(prevState, payload); @@ -2795,7 +2737,7 @@ function runActionStateAction(actionQueue, setPendingState, setState, payload) { setState({ then: function () {}, status: "rejected", reason: error }), finishRunningActionStateAction(actionQueue, setPendingState, setState); } finally { - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactSharedInternals.T = prevTransition; } } function finishRunningActionStateAction( @@ -3032,9 +2974,9 @@ function startTransition(fiber, queue, pendingState, finishedState, callback) { var previousPriority = currentUpdatePriority; currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; - var prevTransition = ReactCurrentBatchConfig$2.transition, + var prevTransition = ReactSharedInternals.T, currentTransition = { _callbacks: new Set() }; - ReactCurrentBatchConfig$2.transition = currentTransition; + ReactSharedInternals.T = currentTransition; dispatchOptimisticSetState(fiber, !1, queue, pendingState); try { var returnValue = callback(); @@ -3058,7 +3000,7 @@ function startTransition(fiber, queue, pendingState, finishedState, callback) { }); } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$2.transition = prevTransition); + (ReactSharedInternals.T = prevTransition); } } function useHostTransitionStatus() { @@ -3692,7 +3634,7 @@ function resolveClassComponentProps( ) { var newProps = baseProps; if ((Component = Component.defaultProps) && !alreadyResolvedDefaultProps) { - newProps = assign({}, newProps, baseProps); + newProps === baseProps && (newProps = assign({}, newProps, baseProps)); for (var propName in Component) void 0 === newProps[propName] && (newProps[propName] = Component[propName]); @@ -3964,8 +3906,7 @@ function throwException( } while (null !== returnFiber); return !1; } -var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner, - SelectiveHydrationException = Error( +var SelectiveHydrationException = Error( "This is not a real error. It's an implementation detail of React's selective hydration feature. If this leaks into userspace, it's a bug in React. Please file an issue." ), didReceiveUpdate = !1; @@ -4182,8 +4123,22 @@ function markRef(current, workInProgress) { throw Error( "Expected ref to be a function, an object returned by React.createRef(), or undefined/null." ); - if (null === current || current.ref !== ref) + if (null === current || current.ref !== ref) { + if ( + null !== current && + ((current = current.ref), + "function" === typeof current && + "function" === typeof ref && + "string" === typeof current.__stringRef && + current.__stringRef === ref.__stringRef && + current.__stringRefType === ref.__stringRefType && + current.__stringRefOwner === ref.__stringRefOwner) + ) { + workInProgress.ref = current; + return; + } workInProgress.flags |= 2097664; + } } } function updateFunctionComponent( @@ -4468,7 +4423,7 @@ function finishClassComponent( bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) ); shouldUpdate = workInProgress.stateNode; - ReactCurrentOwner$1.current = workInProgress; + ReactSharedInternals.owner = workInProgress; if ( didCaptureError && "function" !== typeof Component.getDerivedStateFromError @@ -5695,9 +5650,8 @@ function releaseCache(cache) { cache.controller.abort(); }); } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; function requestCurrentTransition() { - var transition = ReactCurrentBatchConfig$1.transition; + var transition = ReactSharedInternals.T; null !== transition && transition._callbacks.add(handleAsyncAction); return transition; } @@ -7000,7 +6954,7 @@ function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { captureCommitPhaseError(childToDelete, parentFiber, error); } } - if (parentFiber.subtreeFlags & 12854) + if (parentFiber.subtreeFlags & 13878) for (parentFiber = parentFiber.child; null !== parentFiber; ) commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), (parentFiber = parentFiber.sibling); @@ -7915,10 +7869,6 @@ var DefaultCacheDispatcher = { } }, PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, - ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, executionContext = 0, workInProgressRoot = null, workInProgress = null, @@ -7956,8 +7906,8 @@ function requestUpdateLane(fiber) { (fiber = currentEntangledLane), 0 !== fiber ? fiber : requestTransitionLane() ); - fiber = currentUpdatePriority; - return 0 !== fiber ? fiber : 32; + fiber = 0 !== currentUpdatePriority ? currentUpdatePriority : 32; + return fiber; } function requestDeferredLane() { 0 === workInProgressDeferredLane && @@ -8036,13 +7986,18 @@ function performConcurrentWorkOnRoot(root, didTimeout) { root, renderWasConcurrent ); - 0 !== errorRetryLanes && + if ( + 0 !== errorRetryLanes && ((lanes = errorRetryLanes), (exitStatus = recoverFromConcurrentError( root, renderWasConcurrent, errorRetryLanes - ))); + )), + (renderWasConcurrent = !1), + 2 !== exitStatus) + ) + continue; } if (1 === exitStatus) { prepareFreshStack(root, 0); @@ -8269,25 +8224,21 @@ function performSyncWorkOnRoot(root, lanes) { ensureRootIsScheduled(root); return null; } -function flushSync(fn) { +function flushSyncFromReconciler(fn) { null !== rootWithPendingPassiveEffects && 0 === rootWithPendingPassiveEffects.tag && 0 === (executionContext & 6) && flushPassiveEffects(); var prevExecutionContext = executionContext; executionContext |= 1; - var prevTransition = ReactCurrentBatchConfig.transition, + var prevTransition = ReactSharedInternals.T, previousPriority = currentUpdatePriority; try { - if ( - ((ReactCurrentBatchConfig.transition = null), - (currentUpdatePriority = 2), - fn) - ) + if (((currentUpdatePriority = 2), (ReactSharedInternals.T = null), fn)) return fn(); } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig.transition = prevTransition), + (ReactSharedInternals.T = prevTransition), (executionContext = prevExecutionContext), 0 === (executionContext & 6) && flushSyncWorkAcrossRoots_impl(!1); } @@ -8353,8 +8304,8 @@ function prepareFreshStack(root, lanes) { } function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - ReactCurrentOwner.current = null; + ReactSharedInternals.H = ContextOnlyDispatcher; + ReactSharedInternals.owner = null; if (thrownValue === SuspenseException) { thrownValue = getSuspendedThenable(); var handler = suspenseHandlerStackCursor.current; @@ -8421,13 +8372,13 @@ function handleThrow(root, thrownValue) { } } function pushDispatcher() { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = ContextOnlyDispatcher; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = ContextOnlyDispatcher; return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; } function pushCacheDispatcher() { - var prevCacheDispatcher = ReactCurrentCache.current; - ReactCurrentCache.current = DefaultCacheDispatcher; + var prevCacheDispatcher = ReactSharedInternals.C; + ReactSharedInternals.C = DefaultCacheDispatcher; return prevCacheDispatcher; } function renderDidSuspendDelayIfPossible() { @@ -8480,8 +8431,8 @@ function renderRootSync(root, lanes) { lanes && root.shellSuspendCounter++; resetContextDependencies(); executionContext = prevExecutionContext; - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; + ReactSharedInternals.H = prevDispatcher; + ReactSharedInternals.C = prevCacheDispatcher; if (null !== workInProgress) throw Error( "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." @@ -8589,8 +8540,8 @@ function renderRootConcurrent(root, lanes) { } while (1); resetContextDependencies(); - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; + ReactSharedInternals.H = prevDispatcher; + ReactSharedInternals.C = prevCacheDispatcher; executionContext = prevExecutionContext; if (null !== workInProgress) return ( @@ -8620,7 +8571,7 @@ function performUnitOfWork(unitOfWork) { null === current ? completeUnitOfWork(unitOfWork) : (workInProgress = current); - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; } function replaySuspendedUnitOfWork(unitOfWork) { var current = unitOfWork.alternate, @@ -8677,7 +8628,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { null === current ? completeUnitOfWork(unitOfWork) : (workInProgress = current); - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -8773,11 +8724,11 @@ function commitRoot( didIncludeRenderPhaseUpdate, spawnedLane ) { - var previousUpdateLanePriority = currentUpdatePriority, - prevTransition = ReactCurrentBatchConfig.transition; + var prevTransition = ReactSharedInternals.T, + previousUpdateLanePriority = currentUpdatePriority; try { - (ReactCurrentBatchConfig.transition = null), - (currentUpdatePriority = 2), + (currentUpdatePriority = 2), + (ReactSharedInternals.T = null), commitRootImpl( root, recoverableErrors, @@ -8787,7 +8738,7 @@ function commitRoot( spawnedLane ); } finally { - (ReactCurrentBatchConfig.transition = prevTransition), + (ReactSharedInternals.T = prevTransition), (currentUpdatePriority = previousUpdateLanePriority); } return null; @@ -8837,13 +8788,13 @@ function commitRootImpl( })); transitions = 0 !== (finishedWork.flags & 15990); if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = null; + transitions = ReactSharedInternals.T; + ReactSharedInternals.T = null; spawnedLane = currentUpdatePriority; currentUpdatePriority = 2; var prevExecutionContext = executionContext; executionContext |= 4; - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; commitBeforeMutationEffects(root, finishedWork); commitTime = now(); commitMutationEffectsOnFiber(finishedWork, root); @@ -8860,7 +8811,7 @@ function commitRootImpl( requestPaint(); executionContext = prevExecutionContext; currentUpdatePriority = spawnedLane; - ReactCurrentBatchConfig.transition = transitions; + ReactSharedInternals.T = transitions; } else (root.current = finishedWork), (commitTime = now()); rootDoesHavePassiveEffects ? ((rootDoesHavePassiveEffects = !1), @@ -8907,18 +8858,17 @@ function flushPassiveEffects() { remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), - priority = 32 > renderPriority ? 32 : renderPriority; - renderPriority = ReactCurrentBatchConfig.transition; - var previousPriority = currentUpdatePriority; + prevTransition = ReactSharedInternals.T, + previousPriority = currentUpdatePriority; try { - ReactCurrentBatchConfig.transition = null; - currentUpdatePriority = priority; + currentUpdatePriority = 32 > renderPriority ? 32 : renderPriority; + ReactSharedInternals.T = null; if (null === rootWithPendingPassiveEffects) var JSCompiler_inline_result = !1; else { var transitions = pendingPassiveTransitions; pendingPassiveTransitions = null; - priority = rootWithPendingPassiveEffects; + renderPriority = rootWithPendingPassiveEffects; var lanes = pendingPassiveEffectsLanes; rootWithPendingPassiveEffects = null; pendingPassiveEffectsLanes = 0; @@ -8930,10 +8880,10 @@ function flushPassiveEffects() { injectedProfilingHooks.markPassiveEffectsStarted(lanes); var prevExecutionContext = executionContext; executionContext |= 4; - commitPassiveUnmountOnFiber(priority.current); + commitPassiveUnmountOnFiber(renderPriority.current); commitPassiveMountOnFiber( - priority, - priority.current, + renderPriority, + renderPriority.current, lanes, transitions ); @@ -8981,9 +8931,9 @@ function flushPassiveEffects() { "function" === typeof injectedHook.onPostCommitFiberRoot ) try { - injectedHook.onPostCommitFiberRoot(rendererID, priority); + injectedHook.onPostCommitFiberRoot(rendererID, renderPriority); } catch (err) {} - var stateNode = priority.current.stateNode; + var stateNode = renderPriority.current.stateNode; stateNode.effectDuration = 0; stateNode.passiveEffectDuration = 0; JSCompiler_inline_result = !0; @@ -8991,7 +8941,7 @@ function flushPassiveEffects() { return JSCompiler_inline_result; } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig.transition = renderPriority), + (ReactSharedInternals.T = prevTransition), releaseRootPooledCache(root, remainingLanes); } } @@ -9827,12 +9777,12 @@ function wrapFiber(fiber) { fiberToWrapper.set(fiber, wrapper)); return wrapper; } -var devToolsConfig$jscomp$inline_1079 = { +var devToolsConfig$jscomp$inline_1082 = { findFiberByHostInstance: function () { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "19.0.0-canary-3aa3c53d", + version: "19.0.0-canary-2a177f7f", rendererPackageName: "react-test-renderer" }; (function (internals) { @@ -9849,10 +9799,10 @@ var devToolsConfig$jscomp$inline_1079 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1079.bundleType, - version: devToolsConfig$jscomp$inline_1079.version, - rendererPackageName: devToolsConfig$jscomp$inline_1079.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1079.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1082.bundleType, + version: devToolsConfig$jscomp$inline_1082.version, + rendererPackageName: devToolsConfig$jscomp$inline_1082.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1082.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -9862,21 +9812,21 @@ var devToolsConfig$jscomp$inline_1079 = { setErrorHandler: null, setSuspenseHandler: null, scheduleUpdate: null, - currentDispatcherRef: ReactSharedInternals.ReactCurrentDispatcher, + currentDispatcherRef: ReactSharedInternals, findHostInstanceByFiber: function (fiber) { fiber = findCurrentFiberUsingSlowPath(fiber); fiber = null !== fiber ? findCurrentHostFiberImpl(fiber) : null; return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1079.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1082.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-3aa3c53d" + reconcilerVersion: "19.0.0-canary-2a177f7f" }); exports._Scheduler = Scheduler; exports.act = act; @@ -9975,7 +9925,7 @@ exports.create = function (element, options) { } return JSCompiler_inline_result; }, - unstable_flushSync: flushSync + unstable_flushSync: flushSyncFromReconciler }; Object.defineProperty(element, "root", { configurable: !0, diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXDEVRuntime-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXDEVRuntime-dev.js index 51250fb57d..ee31c66476 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXDEVRuntime-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXDEVRuntime-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<7bcb460fce55ee6870184e537edd4d8f>> */ "use strict"; @@ -57,7 +57,7 @@ if (__DEV__) { } var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; function error(format) { { @@ -81,9 +81,7 @@ if (__DEV__) { // When changing this logic, you might want to also // update consoleWithStackDev.www.js as well. { - var ReactDebugCurrentFrame = - ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); + var stack = ReactSharedInternals.getStackAddendum(); if (stack !== "") { format += "%s"; @@ -116,7 +114,7 @@ if (__DEV__) { var enableLegacyHidden = false; var enableTransitionTracing = false; - function getWrappedName(outerType, innerType, wrapperName) { + function getWrappedName$1(outerType, innerType, wrapperName) { var displayName = outerType.displayName; if (displayName) { @@ -129,7 +127,7 @@ if (__DEV__) { : wrapperName; } // Keep in sync with react-reconciler/getComponentNameFromFiber - function getContextName(type) { + function getContextName$1(type) { return type.displayName || "Context"; } @@ -190,28 +188,28 @@ if (__DEV__) { return null; } else { var provider = type; - return getContextName(provider._context) + ".Provider"; + return getContextName$1(provider._context) + ".Provider"; } case REACT_CONTEXT_TYPE: var context = type; if (enableRenderableContext) { - return getContextName(context) + ".Provider"; + return getContextName$1(context) + ".Provider"; } else { - return getContextName(context) + ".Consumer"; + return getContextName$1(context) + ".Consumer"; } case REACT_CONSUMER_TYPE: if (enableRenderableContext) { var consumer = type; - return getContextName(consumer._context) + ".Consumer"; + return getContextName$1(consumer._context) + ".Consumer"; } else { return null; } case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, "ForwardRef"); + return getWrappedName$1(type, type.render, "ForwardRef"); case REACT_MEMO_TYPE: var outerName = type.displayName || null; @@ -317,6 +315,20 @@ if (__DEV__) { } } } + function checkPropStringCoercion(value, propName) { + { + if (willCoercionThrow(value)) { + error( + "The provided `%s` prop is an unsupported type %s." + + " This value must be coerced to a string before using it here.", + propName, + typeName(value) + ); + + return testStringCoercion(value); // throw (to help callers find troubleshooting comments) + } + } + } var REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference"); function isValidElementType(type) { @@ -463,9 +475,8 @@ if (__DEV__) { } } - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; var prefix; - function describeBuiltInComponentFrame(name, ownerFn) { + function describeBuiltInComponentFrame(name) { if (enableComponentStackLocations) { if (prefix === undefined) { // Extract the VM specific prefix used by each line. @@ -479,13 +490,7 @@ if (__DEV__) { return "\n" + prefix + name; } else { - var ownerName = null; - - if (ownerFn) { - ownerName = ownerFn.displayName || ownerFn.name || null; - } - - return describeComponentFrame(name, ownerName); + return describeComponentFrame(name); } } var reentry = false; @@ -525,13 +530,13 @@ if (__DEV__) { var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. Error.prepareStackTrace = undefined; - var previousDispatcher; + var previousDispatcher = null; { - previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function + previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function // for warnings. - ReactCurrentDispatcher.current = null; + ReactSharedInternals.H = null; disableLogs(); } /** @@ -724,7 +729,7 @@ if (__DEV__) { reentry = false; { - ReactCurrentDispatcher.current = previousDispatcher; + ReactSharedInternals.H = previousDispatcher; reenableLogs(); } @@ -743,16 +748,10 @@ if (__DEV__) { return syntheticFrame; } - function describeComponentFrame(name, ownerName) { - var sourceInfo = ""; - - if (ownerName) { - sourceInfo = " (created by " + ownerName + ")"; - } - - return "\n in " + (name || "Unknown") + sourceInfo; + function describeComponentFrame(name) { + return "\n in " + (name || "Unknown"); } - function describeFunctionComponentFrame(fn, ownerFn) { + function describeFunctionComponentFrame(fn) { if (enableComponentStackLocations) { return describeNativeComponentFrame(fn, false); } else { @@ -761,13 +760,7 @@ if (__DEV__) { } var name = fn.displayName || fn.name || null; - var ownerName = null; - - if (ownerFn) { - ownerName = ownerFn.displayName || ownerFn.name || null; - } - - return describeComponentFrame(name, ownerName); + return describeComponentFrame(name); } } @@ -776,7 +769,7 @@ if (__DEV__) { return !!(prototype && prototype.isReactComponent); } - function describeUnknownElementTypeFrameInDEV(type, ownerFn) { + function describeUnknownElementTypeFrameInDEV(type) { if (type == null) { return ""; } @@ -785,30 +778,30 @@ if (__DEV__) { if (enableComponentStackLocations) { return describeNativeComponentFrame(type, shouldConstruct(type)); } else { - return describeFunctionComponentFrame(type, ownerFn); + return describeFunctionComponentFrame(type); } } if (typeof type === "string") { - return describeBuiltInComponentFrame(type, ownerFn); + return describeBuiltInComponentFrame(type); } switch (type) { case REACT_SUSPENSE_TYPE: - return describeBuiltInComponentFrame("Suspense", ownerFn); + return describeBuiltInComponentFrame("Suspense"); case REACT_SUSPENSE_LIST_TYPE: - return describeBuiltInComponentFrame("SuspenseList", ownerFn); + return describeBuiltInComponentFrame("SuspenseList"); } if (typeof type === "object") { switch (type.$$typeof) { case REACT_FORWARD_REF_TYPE: - return describeFunctionComponentFrame(type.render, ownerFn); + return describeFunctionComponentFrame(type.render); case REACT_MEMO_TYPE: // Memo may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(type.type, ownerFn); + return describeUnknownElementTypeFrameInDEV(type.type); case REACT_LAZY_TYPE: { var lazyComponent = type; @@ -817,10 +810,7 @@ if (__DEV__) { try { // Lazy may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV( - init(payload), - ownerFn - ); + return describeUnknownElementTypeFrameInDEV(init(payload)); } catch (x) {} } } @@ -829,8 +819,152 @@ if (__DEV__) { return ""; } - var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + var FunctionComponent = 0; + var ClassComponent = 1; + var HostRoot = 3; // Root of a host tree. Could be nested inside another node. + + var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. + + var HostComponent = 5; + var HostText = 6; + var Fragment = 7; + var Mode = 8; + var ContextConsumer = 9; + var ContextProvider = 10; + var ForwardRef = 11; + var Profiler = 12; + var SuspenseComponent = 13; + var MemoComponent = 14; + var SimpleMemoComponent = 15; + var LazyComponent = 16; + var IncompleteClassComponent = 17; + var DehydratedFragment = 18; + var SuspenseListComponent = 19; + var ScopeComponent = 21; + var OffscreenComponent = 22; + var CacheComponent = 24; + var TracingMarkerComponent = 25; + var HostHoistable = 26; + var HostSingleton = 27; + var IncompleteFunctionComponent = 28; + + function getWrappedName(outerType, innerType, wrapperName) { + var functionName = innerType.displayName || innerType.name || ""; + return ( + outerType.displayName || + (functionName !== "" + ? wrapperName + "(" + functionName + ")" + : wrapperName) + ); + } // Keep in sync with shared/getComponentNameFromType + + function getContextName(type) { + return type.displayName || "Context"; + } + function getComponentNameFromFiber(fiber) { + var tag = fiber.tag, + type = fiber.type; + + switch (tag) { + case CacheComponent: + return "Cache"; + + case ContextConsumer: + if (enableRenderableContext) { + var consumer = type; + return getContextName(consumer._context) + ".Consumer"; + } else { + var context = type; + return getContextName(context) + ".Consumer"; + } + + case ContextProvider: + if (enableRenderableContext) { + var _context = type; + return getContextName(_context) + ".Provider"; + } else { + var provider = type; + return getContextName(provider._context) + ".Provider"; + } + + case DehydratedFragment: + return "DehydratedFragment"; + + case ForwardRef: + return getWrappedName(type, type.render, "ForwardRef"); + + case Fragment: + return "Fragment"; + + case HostHoistable: + case HostSingleton: + case HostComponent: + // Host component type is the display name (e.g. "div", "View") + return type; + + case HostPortal: + return "Portal"; + + case HostRoot: + return "Root"; + + case HostText: + return "Text"; + + case LazyComponent: + // Name comes from the type in this case; we don't have a tag. + return getComponentNameFromType(type); + + case Mode: + if (type === REACT_STRICT_MODE_TYPE) { + // Don't be less specific than shared/getComponentNameFromType + return "StrictMode"; + } + + return "Mode"; + + case OffscreenComponent: + return "Offscreen"; + + case Profiler: + return "Profiler"; + + case ScopeComponent: + return "Scope"; + + case SuspenseComponent: + return "Suspense"; + + case SuspenseListComponent: + return "SuspenseList"; + + case TracingMarkerComponent: + return "TracingMarker"; + // The display name for these tags come from the user-provided type: + + case IncompleteClassComponent: + case IncompleteFunctionComponent: + + // Fallthrough + + case ClassComponent: + case FunctionComponent: + case MemoComponent: + case SimpleMemoComponent: + if (typeof type === "function") { + return type.displayName || type.name || null; + } + + if (typeof type === "string") { + return type; + } + + break; + } + + return null; + } + var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); var specialPropKeyWarningShown; var specialPropRefWarningShown; @@ -872,12 +1006,12 @@ if (__DEV__) { { if ( typeof config.ref === "string" && - ReactCurrentOwner.current && + ReactSharedInternals.owner && self && - ReactCurrentOwner.current.stateNode !== self + ReactSharedInternals.owner.stateNode !== self ) { var componentName = getComponentNameFromType( - ReactCurrentOwner.current.type + ReactSharedInternals.owner.type ); if (!didWarnAboutStringRefs[componentName]) { @@ -888,7 +1022,7 @@ if (__DEV__) { "We ask you to manually fix this case by using useRef() or createRef() instead. " + "Learn more about using refs safely here: " + "https://react.dev/link/strict-mode-string-ref", - getComponentNameFromType(ReactCurrentOwner.current.type), + getComponentNameFromType(ReactSharedInternals.owner.type), config.ref ); @@ -1141,9 +1275,6 @@ if (__DEV__) { } } - var propName; // Reserved names are extracted - - var props = {}; var key = null; var ref = null; // Currently, key can be spread in as a prop. This causes a potential // issue if key is also explicitly declared (ie.
@@ -1171,20 +1302,32 @@ if (__DEV__) { if (hasValidRef(config)) { { ref = config.ref; + + { + ref = coerceStringRef(ref, ReactSharedInternals.owner, type); + } } { warnIfStringRefCannotBeAutoConverted(config, self); } - } // Remaining properties are added to a new props object + } - for (propName in config) { - if ( - hasOwnProperty.call(config, propName) && // Skip over reserved prop names - propName !== "key" && - propName !== "ref" - ) { - props[propName] = config[propName]; + var props; + + { + // We need to remove reserved props (key, prop, ref). Create a fresh props + // object and copy over all the non-reserved props. We don't use `delete` + // because in V8 it will deopt the object to dictionary mode. + props = {}; + + for (var propName in config) { + // Skip over reserved prop names + if (propName !== "key" && propName !== "ref") { + { + props[propName] = config[propName]; + } + } } } @@ -1193,9 +1336,9 @@ if (__DEV__) { if (type && type.defaultProps) { var defaultProps = type.defaultProps; - for (propName in defaultProps) { - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; + for (var _propName2 in defaultProps) { + if (props[_propName2] === undefined) { + props[_propName2] = defaultProps[_propName2]; } } } @@ -1222,7 +1365,7 @@ if (__DEV__) { ref, self, source, - ReactCurrentOwner.current, + ReactSharedInternals.owner, props ); @@ -1236,8 +1379,8 @@ if (__DEV__) { function getDeclarationErrorAddendum() { { - if (ReactCurrentOwner.current) { - var name = getComponentNameFromType(ReactCurrentOwner.current.type); + if (ReactSharedInternals.owner) { + var name = getComponentNameFromType(ReactSharedInternals.owner.type); if (name) { return "\n\nCheck the render method of `" + name + "`."; @@ -1351,14 +1494,18 @@ if (__DEV__) { if ( element && - element._owner && - element._owner !== ReactCurrentOwner.current + element._owner != null && + element._owner !== ReactSharedInternals.owner ) { - // Give the component that originally created this child. - childOwner = - " It was passed a child from " + - getComponentNameFromType(element._owner.type) + - "."; + var ownerName = null; + + if (typeof element._owner.tag === "number") { + ownerName = getComponentNameFromType(element._owner.type); + } else if (typeof element._owner.name === "string") { + ownerName = element._owner.name; + } // Give the component that originally created this child. + + childOwner = " It was passed a child from " + ownerName + "."; } setCurrentlyValidatingElement(element); @@ -1377,14 +1524,10 @@ if (__DEV__) { function setCurrentlyValidatingElement(element) { { if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV( - element.type, - owner ? owner.type : null - ); - ReactDebugCurrentFrame.setExtraStackFrame(stack); + var stack = describeUnknownElementTypeFrameInDEV(element.type); + ReactSharedInternals.setExtraStackFrame(stack); } else { - ReactDebugCurrentFrame.setExtraStackFrame(null); + ReactSharedInternals.setExtraStackFrame(null); } } } @@ -1442,6 +1585,104 @@ if (__DEV__) { } } + function coerceStringRef(mixedRef, owner, type) { + var stringRef; + + if (typeof mixedRef === "string") { + stringRef = mixedRef; + } else { + if (typeof mixedRef === "number" || typeof mixedRef === "boolean") { + { + checkPropStringCoercion(mixedRef, "ref"); + } + + stringRef = "" + mixedRef; + } else { + return mixedRef; + } + } + + var callback = stringRefAsCallbackRef.bind(null, stringRef, type, owner); // This is used to check whether two callback refs conceptually represent + // the same string ref, and can therefore be reused by the reconciler. Needed + // for backwards compatibility with old Meta code that relies on string refs + // not being reattached on every render. + + callback.__stringRef = stringRef; + callback.__type = type; + callback.__owner = owner; + return callback; + } + + function stringRefAsCallbackRef(stringRef, type, owner, value) { + if (!owner) { + throw new Error( + "Element ref was specified as a string (" + + stringRef + + ") but no owner was set. This could happen for one of" + + " the following reasons:\n" + + "1. You may be adding a ref to a function component\n" + + "2. You may be adding a ref to a component that was not created inside a component's render method\n" + + "3. You have multiple copies of React loaded\n" + + "See https://react.dev/link/refs-must-have-owner for more information." + ); + } + + if (owner.tag !== ClassComponent) { + throw new Error( + "Function components cannot have string refs. " + + "We recommend using useRef() instead. " + + "Learn more about using refs safely here: " + + "https://react.dev/link/strict-mode-string-ref" + ); + } + + { + if ( + // Will already warn with "Function components cannot be given refs" + !(typeof type === "function" && !isReactClass(type)) + ) { + var componentName = getComponentNameFromFiber(owner) || "Component"; + + if (!didWarnAboutStringRefs[componentName]) { + error( + 'Component "%s" contains the string ref "%s". Support for string refs ' + + "will be removed in a future major release. We recommend using " + + "useRef() or createRef() instead. " + + "Learn more about using refs safely here: " + + "https://react.dev/link/strict-mode-string-ref", + componentName, + stringRef + ); + + didWarnAboutStringRefs[componentName] = true; + } + } + } + + var inst = owner.stateNode; + + if (!inst) { + throw new Error( + "Missing owner for string ref " + + stringRef + + ". This error is likely caused by a " + + "bug in React. Please file an issue." + ); + } + + var refs = inst.refs; + + if (value === null) { + delete refs[stringRef]; + } else { + refs[stringRef] = value; + } + } + + function isReactClass(type) { + return type.prototype && type.prototype.isReactComponent; + } + var jsxDEV = jsxDEV$1; exports.Fragment = REACT_FRAGMENT_TYPE; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-dev.js index 5f049d7e55..e5b32204ff 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<282fb3cb626f5517884e1ac1196ba98f>> + * @generated SignedSource<<7b2e78bcb8542591ec0d9c0850e3ca30>> */ "use strict"; @@ -57,7 +57,7 @@ if (__DEV__) { } var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; function error(format) { { @@ -81,9 +81,7 @@ if (__DEV__) { // When changing this logic, you might want to also // update consoleWithStackDev.www.js as well. { - var ReactDebugCurrentFrame = - ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); + var stack = ReactSharedInternals.getStackAddendum(); if (stack !== "") { format += "%s"; @@ -116,7 +114,7 @@ if (__DEV__) { var enableLegacyHidden = false; var enableTransitionTracing = false; - function getWrappedName(outerType, innerType, wrapperName) { + function getWrappedName$1(outerType, innerType, wrapperName) { var displayName = outerType.displayName; if (displayName) { @@ -129,7 +127,7 @@ if (__DEV__) { : wrapperName; } // Keep in sync with react-reconciler/getComponentNameFromFiber - function getContextName(type) { + function getContextName$1(type) { return type.displayName || "Context"; } @@ -190,28 +188,28 @@ if (__DEV__) { return null; } else { var provider = type; - return getContextName(provider._context) + ".Provider"; + return getContextName$1(provider._context) + ".Provider"; } case REACT_CONTEXT_TYPE: var context = type; if (enableRenderableContext) { - return getContextName(context) + ".Provider"; + return getContextName$1(context) + ".Provider"; } else { - return getContextName(context) + ".Consumer"; + return getContextName$1(context) + ".Consumer"; } case REACT_CONSUMER_TYPE: if (enableRenderableContext) { var consumer = type; - return getContextName(consumer._context) + ".Consumer"; + return getContextName$1(consumer._context) + ".Consumer"; } else { return null; } case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, "ForwardRef"); + return getWrappedName$1(type, type.render, "ForwardRef"); case REACT_MEMO_TYPE: var outerName = type.displayName || null; @@ -317,6 +315,20 @@ if (__DEV__) { } } } + function checkPropStringCoercion(value, propName) { + { + if (willCoercionThrow(value)) { + error( + "The provided `%s` prop is an unsupported type %s." + + " This value must be coerced to a string before using it here.", + propName, + typeName(value) + ); + + return testStringCoercion(value); // throw (to help callers find troubleshooting comments) + } + } + } var REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference"); function isValidElementType(type) { @@ -463,9 +475,8 @@ if (__DEV__) { } } - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; var prefix; - function describeBuiltInComponentFrame(name, ownerFn) { + function describeBuiltInComponentFrame(name) { if (enableComponentStackLocations) { if (prefix === undefined) { // Extract the VM specific prefix used by each line. @@ -479,13 +490,7 @@ if (__DEV__) { return "\n" + prefix + name; } else { - var ownerName = null; - - if (ownerFn) { - ownerName = ownerFn.displayName || ownerFn.name || null; - } - - return describeComponentFrame(name, ownerName); + return describeComponentFrame(name); } } var reentry = false; @@ -525,13 +530,13 @@ if (__DEV__) { var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. Error.prepareStackTrace = undefined; - var previousDispatcher; + var previousDispatcher = null; { - previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function + previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function // for warnings. - ReactCurrentDispatcher.current = null; + ReactSharedInternals.H = null; disableLogs(); } /** @@ -724,7 +729,7 @@ if (__DEV__) { reentry = false; { - ReactCurrentDispatcher.current = previousDispatcher; + ReactSharedInternals.H = previousDispatcher; reenableLogs(); } @@ -743,16 +748,10 @@ if (__DEV__) { return syntheticFrame; } - function describeComponentFrame(name, ownerName) { - var sourceInfo = ""; - - if (ownerName) { - sourceInfo = " (created by " + ownerName + ")"; - } - - return "\n in " + (name || "Unknown") + sourceInfo; + function describeComponentFrame(name) { + return "\n in " + (name || "Unknown"); } - function describeFunctionComponentFrame(fn, ownerFn) { + function describeFunctionComponentFrame(fn) { if (enableComponentStackLocations) { return describeNativeComponentFrame(fn, false); } else { @@ -761,13 +760,7 @@ if (__DEV__) { } var name = fn.displayName || fn.name || null; - var ownerName = null; - - if (ownerFn) { - ownerName = ownerFn.displayName || ownerFn.name || null; - } - - return describeComponentFrame(name, ownerName); + return describeComponentFrame(name); } } @@ -776,7 +769,7 @@ if (__DEV__) { return !!(prototype && prototype.isReactComponent); } - function describeUnknownElementTypeFrameInDEV(type, ownerFn) { + function describeUnknownElementTypeFrameInDEV(type) { if (type == null) { return ""; } @@ -785,30 +778,30 @@ if (__DEV__) { if (enableComponentStackLocations) { return describeNativeComponentFrame(type, shouldConstruct(type)); } else { - return describeFunctionComponentFrame(type, ownerFn); + return describeFunctionComponentFrame(type); } } if (typeof type === "string") { - return describeBuiltInComponentFrame(type, ownerFn); + return describeBuiltInComponentFrame(type); } switch (type) { case REACT_SUSPENSE_TYPE: - return describeBuiltInComponentFrame("Suspense", ownerFn); + return describeBuiltInComponentFrame("Suspense"); case REACT_SUSPENSE_LIST_TYPE: - return describeBuiltInComponentFrame("SuspenseList", ownerFn); + return describeBuiltInComponentFrame("SuspenseList"); } if (typeof type === "object") { switch (type.$$typeof) { case REACT_FORWARD_REF_TYPE: - return describeFunctionComponentFrame(type.render, ownerFn); + return describeFunctionComponentFrame(type.render); case REACT_MEMO_TYPE: // Memo may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(type.type, ownerFn); + return describeUnknownElementTypeFrameInDEV(type.type); case REACT_LAZY_TYPE: { var lazyComponent = type; @@ -817,10 +810,7 @@ if (__DEV__) { try { // Lazy may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV( - init(payload), - ownerFn - ); + return describeUnknownElementTypeFrameInDEV(init(payload)); } catch (x) {} } } @@ -829,8 +819,152 @@ if (__DEV__) { return ""; } - var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + var FunctionComponent = 0; + var ClassComponent = 1; + var HostRoot = 3; // Root of a host tree. Could be nested inside another node. + + var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. + + var HostComponent = 5; + var HostText = 6; + var Fragment = 7; + var Mode = 8; + var ContextConsumer = 9; + var ContextProvider = 10; + var ForwardRef = 11; + var Profiler = 12; + var SuspenseComponent = 13; + var MemoComponent = 14; + var SimpleMemoComponent = 15; + var LazyComponent = 16; + var IncompleteClassComponent = 17; + var DehydratedFragment = 18; + var SuspenseListComponent = 19; + var ScopeComponent = 21; + var OffscreenComponent = 22; + var CacheComponent = 24; + var TracingMarkerComponent = 25; + var HostHoistable = 26; + var HostSingleton = 27; + var IncompleteFunctionComponent = 28; + + function getWrappedName(outerType, innerType, wrapperName) { + var functionName = innerType.displayName || innerType.name || ""; + return ( + outerType.displayName || + (functionName !== "" + ? wrapperName + "(" + functionName + ")" + : wrapperName) + ); + } // Keep in sync with shared/getComponentNameFromType + + function getContextName(type) { + return type.displayName || "Context"; + } + function getComponentNameFromFiber(fiber) { + var tag = fiber.tag, + type = fiber.type; + + switch (tag) { + case CacheComponent: + return "Cache"; + + case ContextConsumer: + if (enableRenderableContext) { + var consumer = type; + return getContextName(consumer._context) + ".Consumer"; + } else { + var context = type; + return getContextName(context) + ".Consumer"; + } + + case ContextProvider: + if (enableRenderableContext) { + var _context = type; + return getContextName(_context) + ".Provider"; + } else { + var provider = type; + return getContextName(provider._context) + ".Provider"; + } + + case DehydratedFragment: + return "DehydratedFragment"; + + case ForwardRef: + return getWrappedName(type, type.render, "ForwardRef"); + + case Fragment: + return "Fragment"; + + case HostHoistable: + case HostSingleton: + case HostComponent: + // Host component type is the display name (e.g. "div", "View") + return type; + + case HostPortal: + return "Portal"; + + case HostRoot: + return "Root"; + + case HostText: + return "Text"; + + case LazyComponent: + // Name comes from the type in this case; we don't have a tag. + return getComponentNameFromType(type); + + case Mode: + if (type === REACT_STRICT_MODE_TYPE) { + // Don't be less specific than shared/getComponentNameFromType + return "StrictMode"; + } + + return "Mode"; + + case OffscreenComponent: + return "Offscreen"; + + case Profiler: + return "Profiler"; + + case ScopeComponent: + return "Scope"; + + case SuspenseComponent: + return "Suspense"; + + case SuspenseListComponent: + return "SuspenseList"; + + case TracingMarkerComponent: + return "TracingMarker"; + // The display name for these tags come from the user-provided type: + + case IncompleteClassComponent: + case IncompleteFunctionComponent: + + // Fallthrough + + case ClassComponent: + case FunctionComponent: + case MemoComponent: + case SimpleMemoComponent: + if (typeof type === "function") { + return type.displayName || type.name || null; + } + + if (typeof type === "string") { + return type; + } + + break; + } + + return null; + } + var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); var specialPropKeyWarningShown; var specialPropRefWarningShown; @@ -872,12 +1006,12 @@ if (__DEV__) { { if ( typeof config.ref === "string" && - ReactCurrentOwner.current && + ReactSharedInternals.owner && self && - ReactCurrentOwner.current.stateNode !== self + ReactSharedInternals.owner.stateNode !== self ) { var componentName = getComponentNameFromType( - ReactCurrentOwner.current.type + ReactSharedInternals.owner.type ); if (!didWarnAboutStringRefs[componentName]) { @@ -888,7 +1022,7 @@ if (__DEV__) { "We ask you to manually fix this case by using useRef() or createRef() instead. " + "Learn more about using refs safely here: " + "https://react.dev/link/strict-mode-string-ref", - getComponentNameFromType(ReactCurrentOwner.current.type), + getComponentNameFromType(ReactSharedInternals.owner.type), config.ref ); @@ -1177,9 +1311,6 @@ if (__DEV__) { } } - var propName; // Reserved names are extracted - - var props = {}; var key = null; var ref = null; // Currently, key can be spread in as a prop. This causes a potential // issue if key is also explicitly declared (ie.
@@ -1207,20 +1338,32 @@ if (__DEV__) { if (hasValidRef(config)) { { ref = config.ref; + + { + ref = coerceStringRef(ref, ReactSharedInternals.owner, type); + } } { warnIfStringRefCannotBeAutoConverted(config, self); } - } // Remaining properties are added to a new props object + } - for (propName in config) { - if ( - hasOwnProperty.call(config, propName) && // Skip over reserved prop names - propName !== "key" && - propName !== "ref" - ) { - props[propName] = config[propName]; + var props; + + { + // We need to remove reserved props (key, prop, ref). Create a fresh props + // object and copy over all the non-reserved props. We don't use `delete` + // because in V8 it will deopt the object to dictionary mode. + props = {}; + + for (var propName in config) { + // Skip over reserved prop names + if (propName !== "key" && propName !== "ref") { + { + props[propName] = config[propName]; + } + } } } @@ -1229,9 +1372,9 @@ if (__DEV__) { if (type && type.defaultProps) { var defaultProps = type.defaultProps; - for (propName in defaultProps) { - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; + for (var _propName2 in defaultProps) { + if (props[_propName2] === undefined) { + props[_propName2] = defaultProps[_propName2]; } } } @@ -1258,7 +1401,7 @@ if (__DEV__) { ref, self, source, - ReactCurrentOwner.current, + ReactSharedInternals.owner, props ); @@ -1272,8 +1415,8 @@ if (__DEV__) { function getDeclarationErrorAddendum() { { - if (ReactCurrentOwner.current) { - var name = getComponentNameFromType(ReactCurrentOwner.current.type); + if (ReactSharedInternals.owner) { + var name = getComponentNameFromType(ReactSharedInternals.owner.type); if (name) { return "\n\nCheck the render method of `" + name + "`."; @@ -1387,14 +1530,18 @@ if (__DEV__) { if ( element && - element._owner && - element._owner !== ReactCurrentOwner.current + element._owner != null && + element._owner !== ReactSharedInternals.owner ) { - // Give the component that originally created this child. - childOwner = - " It was passed a child from " + - getComponentNameFromType(element._owner.type) + - "."; + var ownerName = null; + + if (typeof element._owner.tag === "number") { + ownerName = getComponentNameFromType(element._owner.type); + } else if (typeof element._owner.name === "string") { + ownerName = element._owner.name; + } // Give the component that originally created this child. + + childOwner = " It was passed a child from " + ownerName + "."; } setCurrentlyValidatingElement(element); @@ -1413,14 +1560,10 @@ if (__DEV__) { function setCurrentlyValidatingElement(element) { { if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV( - element.type, - owner ? owner.type : null - ); - ReactDebugCurrentFrame.setExtraStackFrame(stack); + var stack = describeUnknownElementTypeFrameInDEV(element.type); + ReactSharedInternals.setExtraStackFrame(stack); } else { - ReactDebugCurrentFrame.setExtraStackFrame(null); + ReactSharedInternals.setExtraStackFrame(null); } } } @@ -1478,6 +1621,104 @@ if (__DEV__) { } } + function coerceStringRef(mixedRef, owner, type) { + var stringRef; + + if (typeof mixedRef === "string") { + stringRef = mixedRef; + } else { + if (typeof mixedRef === "number" || typeof mixedRef === "boolean") { + { + checkPropStringCoercion(mixedRef, "ref"); + } + + stringRef = "" + mixedRef; + } else { + return mixedRef; + } + } + + var callback = stringRefAsCallbackRef.bind(null, stringRef, type, owner); // This is used to check whether two callback refs conceptually represent + // the same string ref, and can therefore be reused by the reconciler. Needed + // for backwards compatibility with old Meta code that relies on string refs + // not being reattached on every render. + + callback.__stringRef = stringRef; + callback.__type = type; + callback.__owner = owner; + return callback; + } + + function stringRefAsCallbackRef(stringRef, type, owner, value) { + if (!owner) { + throw new Error( + "Element ref was specified as a string (" + + stringRef + + ") but no owner was set. This could happen for one of" + + " the following reasons:\n" + + "1. You may be adding a ref to a function component\n" + + "2. You may be adding a ref to a component that was not created inside a component's render method\n" + + "3. You have multiple copies of React loaded\n" + + "See https://react.dev/link/refs-must-have-owner for more information." + ); + } + + if (owner.tag !== ClassComponent) { + throw new Error( + "Function components cannot have string refs. " + + "We recommend using useRef() instead. " + + "Learn more about using refs safely here: " + + "https://react.dev/link/strict-mode-string-ref" + ); + } + + { + if ( + // Will already warn with "Function components cannot be given refs" + !(typeof type === "function" && !isReactClass(type)) + ) { + var componentName = getComponentNameFromFiber(owner) || "Component"; + + if (!didWarnAboutStringRefs[componentName]) { + error( + 'Component "%s" contains the string ref "%s". Support for string refs ' + + "will be removed in a future major release. We recommend using " + + "useRef() or createRef() instead. " + + "Learn more about using refs safely here: " + + "https://react.dev/link/strict-mode-string-ref", + componentName, + stringRef + ); + + didWarnAboutStringRefs[componentName] = true; + } + } + } + + var inst = owner.stateNode; + + if (!inst) { + throw new Error( + "Missing owner for string ref " + + stringRef + + ". This error is likely caused by a " + + "bug in React. Please file an issue." + ); + } + + var refs = inst.refs; + + if (value === null) { + delete refs[stringRef]; + } else { + refs[stringRef] = value; + } + } + + function isReactClass(type) { + return type.prototype && type.prototype.isReactComponent; + } + var jsx = jsxProdSignatureRunningInDevWithDynamicChildren; // we may want to special case jsxs internally to take advantage of static children. // for now we can ship identical prod functions diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-prod.js index 298e91ad69..fa40034feb 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-prod.js @@ -7,44 +7,78 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<26fbc8eee6902991682d526f8537439c>> + * @generated SignedSource<<881038bf21de122675cb4eb0358c5cfd>> */ "use strict"; var dynamicFlagsUntyped = require("ReactNativeInternalFeatureFlags"), React = require("react"), REACT_ELEMENT_TYPE = Symbol.for("react.element"), - REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), - disableDefaultPropsExceptForClasses = + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); +function formatProdErrorMessage(code) { + var url = "https://react.dev/errors/" + code; + if (1 < arguments.length) { + url += "?args[]=" + encodeURIComponent(arguments[1]); + for (var i = 2; i < arguments.length; i++) + url += "&args[]=" + encodeURIComponent(arguments[i]); + } + return ( + "Minified React error #" + + code + + "; visit " + + url + + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings." + ); +} +var disableDefaultPropsExceptForClasses = dynamicFlagsUntyped.disableDefaultPropsExceptForClasses, - hasOwnProperty = Object.prototype.hasOwnProperty, - ReactCurrentOwner = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner; + ReactSharedInternals = + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; function jsxProd(type, config, maybeKey) { - var propName, - props = {}, - key = null, + var key = null, ref = null; void 0 !== maybeKey && (key = "" + maybeKey); void 0 !== config.key && (key = "" + config.key); - void 0 !== config.ref && (ref = config.ref); - for (propName in config) - hasOwnProperty.call(config, propName) && - "key" !== propName && + if (void 0 !== config.ref) + a: { + (ref = config.ref), (maybeKey = ReactSharedInternals.owner); + if ("string" !== typeof ref) + if ("number" === typeof ref || "boolean" === typeof ref) ref = "" + ref; + else break a; + var callback = stringRefAsCallbackRef.bind(null, ref, type, maybeKey); + callback.__stringRef = ref; + callback.__type = type; + callback.__owner = maybeKey; + ref = callback; + } + maybeKey = {}; + for (var propName in config) + "key" !== propName && "ref" !== propName && - (props[propName] = config[propName]); - if (!disableDefaultPropsExceptForClasses && type && type.defaultProps) - for (propName in ((config = type.defaultProps), config)) - void 0 === props[propName] && (props[propName] = config[propName]); + (maybeKey[propName] = config[propName]); + if (!disableDefaultPropsExceptForClasses && type && type.defaultProps) { + config = type.defaultProps; + for (var propName$0 in config) + void 0 === maybeKey[propName$0] && + (maybeKey[propName$0] = config[propName$0]); + } return { $$typeof: REACT_ELEMENT_TYPE, type: type, key: key, ref: ref, - props: props, - _owner: ReactCurrentOwner.current + props: maybeKey, + _owner: ReactSharedInternals.owner }; } +function stringRefAsCallbackRef(stringRef, type, owner, value) { + if (!owner) throw Error(formatProdErrorMessage(290, stringRef)); + if (1 !== owner.tag) throw Error(formatProdErrorMessage(309)); + type = owner.stateNode; + if (!type) throw Error(formatProdErrorMessage(147, stringRef)); + type = type.refs; + null === value ? delete type[stringRef] : (type[stringRef] = value); +} exports.Fragment = REACT_FRAGMENT_TYPE; exports.jsx = jsxProd; exports.jsxs = jsxProd; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-profiling.js index 298e91ad69..fa40034feb 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/JSXRuntime-profiling.js @@ -7,44 +7,78 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<26fbc8eee6902991682d526f8537439c>> + * @generated SignedSource<<881038bf21de122675cb4eb0358c5cfd>> */ "use strict"; var dynamicFlagsUntyped = require("ReactNativeInternalFeatureFlags"), React = require("react"), REACT_ELEMENT_TYPE = Symbol.for("react.element"), - REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), - disableDefaultPropsExceptForClasses = + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); +function formatProdErrorMessage(code) { + var url = "https://react.dev/errors/" + code; + if (1 < arguments.length) { + url += "?args[]=" + encodeURIComponent(arguments[1]); + for (var i = 2; i < arguments.length; i++) + url += "&args[]=" + encodeURIComponent(arguments[i]); + } + return ( + "Minified React error #" + + code + + "; visit " + + url + + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings." + ); +} +var disableDefaultPropsExceptForClasses = dynamicFlagsUntyped.disableDefaultPropsExceptForClasses, - hasOwnProperty = Object.prototype.hasOwnProperty, - ReactCurrentOwner = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner; + ReactSharedInternals = + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; function jsxProd(type, config, maybeKey) { - var propName, - props = {}, - key = null, + var key = null, ref = null; void 0 !== maybeKey && (key = "" + maybeKey); void 0 !== config.key && (key = "" + config.key); - void 0 !== config.ref && (ref = config.ref); - for (propName in config) - hasOwnProperty.call(config, propName) && - "key" !== propName && + if (void 0 !== config.ref) + a: { + (ref = config.ref), (maybeKey = ReactSharedInternals.owner); + if ("string" !== typeof ref) + if ("number" === typeof ref || "boolean" === typeof ref) ref = "" + ref; + else break a; + var callback = stringRefAsCallbackRef.bind(null, ref, type, maybeKey); + callback.__stringRef = ref; + callback.__type = type; + callback.__owner = maybeKey; + ref = callback; + } + maybeKey = {}; + for (var propName in config) + "key" !== propName && "ref" !== propName && - (props[propName] = config[propName]); - if (!disableDefaultPropsExceptForClasses && type && type.defaultProps) - for (propName in ((config = type.defaultProps), config)) - void 0 === props[propName] && (props[propName] = config[propName]); + (maybeKey[propName] = config[propName]); + if (!disableDefaultPropsExceptForClasses && type && type.defaultProps) { + config = type.defaultProps; + for (var propName$0 in config) + void 0 === maybeKey[propName$0] && + (maybeKey[propName$0] = config[propName$0]); + } return { $$typeof: REACT_ELEMENT_TYPE, type: type, key: key, ref: ref, - props: props, - _owner: ReactCurrentOwner.current + props: maybeKey, + _owner: ReactSharedInternals.owner }; } +function stringRefAsCallbackRef(stringRef, type, owner, value) { + if (!owner) throw Error(formatProdErrorMessage(290, stringRef)); + if (1 !== owner.tag) throw Error(formatProdErrorMessage(309)); + type = owner.stateNode; + if (!type) throw Error(formatProdErrorMessage(147, stringRef)); + type = type.refs; + null === value ? delete type[stringRef] : (type[stringRef] = value); +} exports.Fragment = REACT_FRAGMENT_TYPE; exports.jsx = jsxProd; exports.jsxs = jsxProd; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js index 9407a22d46..e6ce3bb8a1 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<150980e4b77b12c241c9997159b4f67a>> */ "use strict"; @@ -26,7 +26,7 @@ if (__DEV__) { } var dynamicFlagsUntyped = require("ReactNativeInternalFeatureFlags"); - var ReactVersion = "19.0.0-canary-1e7b10f9"; + var ReactVersion = "19.0.0-canary-a13a0c2f"; // ATTENTION // When adding new symbols to this file, @@ -69,75 +69,57 @@ if (__DEV__) { return null; } - /** - * Keeps track of the current dispatcher. - */ - var ReactCurrentDispatcher$1 = { - current: null - }; + // Re-export dynamic flags from the internal module. + var dynamicFlags = dynamicFlagsUntyped; // We destructure each value before re-exporting to avoid a dynamic look-up on + // the exports object every time a flag is read. - /** - * Keeps track of the current Cache dispatcher. - */ - var ReactCurrentCache = { - current: null - }; + var enableAsyncActions = dynamicFlags.enableAsyncActions, + enableComponentStackLocations = + dynamicFlags.enableComponentStackLocations, + enableRenderableContext = dynamicFlags.enableRenderableContext, + disableDefaultPropsExceptForClasses = + dynamicFlags.disableDefaultPropsExceptForClasses; // The rest of the flags are static for better dead code elimination. + var enableDebugTracing = false; + var enableScopeAPI = false; + var enableLegacyHidden = false; + var enableTransitionTracing = false; + // because JSX is an extremely hot path. - /** - * Keeps track of the current batch's configuration such as how long an update - * should suspend for if it needs to. - */ - var ReactCurrentBatchConfig = { - transition: null - }; + var enableRefAsProp = false; + var disableLegacyMode = false; - var ReactCurrentActQueue = { - current: null, - // Used to reproduce behavior of `batchedUpdates` in legacy mode. - isBatchingLegacy: false, - didScheduleLegacyUpdate: false, - // Tracks whether something called `use` during the current batch of work. - // Determines whether we should yield to microtasks to unwrap already resolved - // promises without suspending. - didUsePromise: false, - // Track first uncaught error within this act - thrownErrors: [] + var ReactSharedInternals = { + H: null, + C: null, + T: null }; - /** - * Keeps track of the current owner. - * - * The current owner is the component who should own any components that are - * currently being constructed. - */ - var ReactCurrentOwner$1 = { - /** - * @internal - * @type {ReactComponent} - */ - current: null - }; - - var ReactDebugCurrentFrame$1 = {}; - var currentExtraStackFrame = null; - { - ReactDebugCurrentFrame$1.setExtraStackFrame = function (stack) { - { - currentExtraStackFrame = stack; - } + ReactSharedInternals.owner = null; + } + + { + ReactSharedInternals.actQueue = null; + ReactSharedInternals.isBatchingLegacy = false; + ReactSharedInternals.didScheduleLegacyUpdate = false; + ReactSharedInternals.didUsePromise = false; + ReactSharedInternals.thrownErrors = []; + var currentExtraStackFrame = null; + + ReactSharedInternals.setExtraStackFrame = function (stack) { + currentExtraStackFrame = stack; }; // Stack implementation injected by the current renderer. - ReactDebugCurrentFrame$1.getCurrentStack = null; + ReactSharedInternals.getCurrentStack = null; - ReactDebugCurrentFrame$1.getStackAddendum = function () { + ReactSharedInternals.getStackAddendum = function () { var stack = ""; // Add an extra top frame while an element is being validated if (currentExtraStackFrame) { stack += currentExtraStackFrame; } // Delegate to the injected renderer-specific implementation - var impl = ReactDebugCurrentFrame$1.getCurrentStack; + var impl = ReactSharedInternals.getCurrentStack; if (impl) { stack += impl() || ""; @@ -147,18 +129,6 @@ if (__DEV__) { }; } - var ReactSharedInternals = { - ReactCurrentDispatcher: ReactCurrentDispatcher$1, - ReactCurrentCache: ReactCurrentCache, - ReactCurrentBatchConfig: ReactCurrentBatchConfig, - ReactCurrentOwner: ReactCurrentOwner$1 - }; - - { - ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame$1; - ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue; - } - // by calls to these methods by a Babel plugin. // // In PROD (or in packages without access to React internals), @@ -203,9 +173,7 @@ if (__DEV__) { // When changing this logic, you might want to also // update consoleWithStackDev.www.js as well. { - var ReactDebugCurrentFrame = - ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); + var stack = ReactSharedInternals.getStackAddendum(); if (stack !== "") { format += "%s"; @@ -564,27 +532,22 @@ if (__DEV__) { } } } + function checkPropStringCoercion(value, propName) { + { + if (willCoercionThrow(value)) { + error( + "The provided `%s` prop is an unsupported type %s." + + " This value must be coerced to a string before using it here.", + propName, + typeName(value) + ); - // Re-export dynamic flags from the internal module. - var dynamicFlags = dynamicFlagsUntyped; // We destructure each value before re-exporting to avoid a dynamic look-up on - // the exports object every time a flag is read. + return testStringCoercion(value); // throw (to help callers find troubleshooting comments) + } + } + } - var enableAsyncActions = dynamicFlags.enableAsyncActions, - enableComponentStackLocations = - dynamicFlags.enableComponentStackLocations, - enableRenderableContext = dynamicFlags.enableRenderableContext, - disableDefaultPropsExceptForClasses = - dynamicFlags.disableDefaultPropsExceptForClasses; // The rest of the flags are static for better dead code elimination. - var enableDebugTracing = false; - var enableScopeAPI = false; - var enableLegacyHidden = false; - var enableTransitionTracing = false; - // because JSX is an extremely hot path. - - var enableRefAsProp = false; - var disableLegacyMode = false; - - function getWrappedName(outerType, innerType, wrapperName) { + function getWrappedName$1(outerType, innerType, wrapperName) { var displayName = outerType.displayName; if (displayName) { @@ -597,7 +560,7 @@ if (__DEV__) { : wrapperName; } // Keep in sync with react-reconciler/getComponentNameFromFiber - function getContextName(type) { + function getContextName$1(type) { return type.displayName || "Context"; } @@ -658,28 +621,28 @@ if (__DEV__) { return null; } else { var provider = type; - return getContextName(provider._context) + ".Provider"; + return getContextName$1(provider._context) + ".Provider"; } case REACT_CONTEXT_TYPE: var context = type; if (enableRenderableContext) { - return getContextName(context) + ".Provider"; + return getContextName$1(context) + ".Provider"; } else { - return getContextName(context) + ".Consumer"; + return getContextName$1(context) + ".Consumer"; } case REACT_CONSUMER_TYPE: if (enableRenderableContext) { var consumer = type; - return getContextName(consumer._context) + ".Consumer"; + return getContextName$1(consumer._context) + ".Consumer"; } else { return null; } case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, "ForwardRef"); + return getWrappedName$1(type, type.render, "ForwardRef"); case REACT_MEMO_TYPE: var outerName = type.displayName || null; @@ -849,9 +812,8 @@ if (__DEV__) { } } - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; var prefix; - function describeBuiltInComponentFrame(name, ownerFn) { + function describeBuiltInComponentFrame(name) { if (enableComponentStackLocations) { if (prefix === undefined) { // Extract the VM specific prefix used by each line. @@ -865,13 +827,7 @@ if (__DEV__) { return "\n" + prefix + name; } else { - var ownerName = null; - - if (ownerFn) { - ownerName = ownerFn.displayName || ownerFn.name || null; - } - - return describeComponentFrame(name, ownerName); + return describeComponentFrame(name); } } var reentry = false; @@ -911,13 +867,13 @@ if (__DEV__) { var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. Error.prepareStackTrace = undefined; - var previousDispatcher; + var previousDispatcher = null; { - previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function + previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function // for warnings. - ReactCurrentDispatcher.current = null; + ReactSharedInternals.H = null; disableLogs(); } /** @@ -1110,7 +1066,7 @@ if (__DEV__) { reentry = false; { - ReactCurrentDispatcher.current = previousDispatcher; + ReactSharedInternals.H = previousDispatcher; reenableLogs(); } @@ -1129,16 +1085,10 @@ if (__DEV__) { return syntheticFrame; } - function describeComponentFrame(name, ownerName) { - var sourceInfo = ""; - - if (ownerName) { - sourceInfo = " (created by " + ownerName + ")"; - } - - return "\n in " + (name || "Unknown") + sourceInfo; + function describeComponentFrame(name) { + return "\n in " + (name || "Unknown"); } - function describeFunctionComponentFrame(fn, ownerFn) { + function describeFunctionComponentFrame(fn) { if (enableComponentStackLocations) { return describeNativeComponentFrame(fn, false); } else { @@ -1147,13 +1097,7 @@ if (__DEV__) { } var name = fn.displayName || fn.name || null; - var ownerName = null; - - if (ownerFn) { - ownerName = ownerFn.displayName || ownerFn.name || null; - } - - return describeComponentFrame(name, ownerName); + return describeComponentFrame(name); } } @@ -1162,7 +1106,7 @@ if (__DEV__) { return !!(prototype && prototype.isReactComponent); } - function describeUnknownElementTypeFrameInDEV(type, ownerFn) { + function describeUnknownElementTypeFrameInDEV(type) { if (type == null) { return ""; } @@ -1171,30 +1115,30 @@ if (__DEV__) { if (enableComponentStackLocations) { return describeNativeComponentFrame(type, shouldConstruct(type)); } else { - return describeFunctionComponentFrame(type, ownerFn); + return describeFunctionComponentFrame(type); } } if (typeof type === "string") { - return describeBuiltInComponentFrame(type, ownerFn); + return describeBuiltInComponentFrame(type); } switch (type) { case REACT_SUSPENSE_TYPE: - return describeBuiltInComponentFrame("Suspense", ownerFn); + return describeBuiltInComponentFrame("Suspense"); case REACT_SUSPENSE_LIST_TYPE: - return describeBuiltInComponentFrame("SuspenseList", ownerFn); + return describeBuiltInComponentFrame("SuspenseList"); } if (typeof type === "object") { switch (type.$$typeof) { case REACT_FORWARD_REF_TYPE: - return describeFunctionComponentFrame(type.render, ownerFn); + return describeFunctionComponentFrame(type.render); case REACT_MEMO_TYPE: // Memo may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(type.type, ownerFn); + return describeUnknownElementTypeFrameInDEV(type.type); case REACT_LAZY_TYPE: { var lazyComponent = type; @@ -1203,10 +1147,7 @@ if (__DEV__) { try { // Lazy may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV( - init(payload), - ownerFn - ); + return describeUnknownElementTypeFrameInDEV(init(payload)); } catch (x) {} } } @@ -1215,12 +1156,157 @@ if (__DEV__) { return ""; } - var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + var FunctionComponent = 0; + var ClassComponent = 1; + var HostRoot = 3; // Root of a host tree. Could be nested inside another node. + + var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. + + var HostComponent = 5; + var HostText = 6; + var Fragment = 7; + var Mode = 8; + var ContextConsumer = 9; + var ContextProvider = 10; + var ForwardRef = 11; + var Profiler = 12; + var SuspenseComponent = 13; + var MemoComponent = 14; + var SimpleMemoComponent = 15; + var LazyComponent = 16; + var IncompleteClassComponent = 17; + var DehydratedFragment = 18; + var SuspenseListComponent = 19; + var ScopeComponent = 21; + var OffscreenComponent = 22; + var CacheComponent = 24; + var TracingMarkerComponent = 25; + var HostHoistable = 26; + var HostSingleton = 27; + var IncompleteFunctionComponent = 28; + + function getWrappedName(outerType, innerType, wrapperName) { + var functionName = innerType.displayName || innerType.name || ""; + return ( + outerType.displayName || + (functionName !== "" + ? wrapperName + "(" + functionName + ")" + : wrapperName) + ); + } // Keep in sync with shared/getComponentNameFromType + + function getContextName(type) { + return type.displayName || "Context"; + } + function getComponentNameFromFiber(fiber) { + var tag = fiber.tag, + type = fiber.type; + + switch (tag) { + case CacheComponent: + return "Cache"; + + case ContextConsumer: + if (enableRenderableContext) { + var consumer = type; + return getContextName(consumer._context) + ".Consumer"; + } else { + var context = type; + return getContextName(context) + ".Consumer"; + } + + case ContextProvider: + if (enableRenderableContext) { + var _context = type; + return getContextName(_context) + ".Provider"; + } else { + var provider = type; + return getContextName(provider._context) + ".Provider"; + } + + case DehydratedFragment: + return "DehydratedFragment"; + + case ForwardRef: + return getWrappedName(type, type.render, "ForwardRef"); + + case Fragment: + return "Fragment"; + + case HostHoistable: + case HostSingleton: + case HostComponent: + // Host component type is the display name (e.g. "div", "View") + return type; + + case HostPortal: + return "Portal"; + + case HostRoot: + return "Root"; + + case HostText: + return "Text"; + + case LazyComponent: + // Name comes from the type in this case; we don't have a tag. + return getComponentNameFromType(type); + + case Mode: + if (type === REACT_STRICT_MODE_TYPE) { + // Don't be less specific than shared/getComponentNameFromType + return "StrictMode"; + } + + return "Mode"; + + case OffscreenComponent: + return "Offscreen"; + + case Profiler: + return "Profiler"; + + case ScopeComponent: + return "Scope"; + + case SuspenseComponent: + return "Suspense"; + + case SuspenseListComponent: + return "SuspenseList"; + + case TracingMarkerComponent: + return "TracingMarker"; + // The display name for these tags come from the user-provided type: + + case IncompleteClassComponent: + case IncompleteFunctionComponent: + + // Fallthrough + + case ClassComponent: + case FunctionComponent: + case MemoComponent: + case SimpleMemoComponent: + if (typeof type === "function") { + return type.displayName || type.name || null; + } + + if (typeof type === "string") { + return type; + } + + break; + } + + return null; + } + var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); var specialPropKeyWarningShown; var specialPropRefWarningShown; var didWarnAboutStringRefs; + var didWarnAboutOldJSXRuntime; { didWarnAboutStringRefs = {}; @@ -1258,12 +1344,12 @@ if (__DEV__) { { if ( typeof config.ref === "string" && - ReactCurrentOwner.current && + ReactSharedInternals.owner && self && - ReactCurrentOwner.current.stateNode !== self + ReactSharedInternals.owner.stateNode !== self ) { var componentName = getComponentNameFromType( - ReactCurrentOwner.current.type + ReactSharedInternals.owner.type ); if (!didWarnAboutStringRefs[componentName]) { @@ -1274,7 +1360,7 @@ if (__DEV__) { "We ask you to manually fix this case by using useRef() or createRef() instead. " + "Learn more about using refs safely here: " + "https://react.dev/link/strict-mode-string-ref", - getComponentNameFromType(ReactCurrentOwner.current.type), + getComponentNameFromType(ReactSharedInternals.owner.type), config.ref ); @@ -1563,9 +1649,6 @@ if (__DEV__) { } } - var propName; // Reserved names are extracted - - var props = {}; var key = null; var ref = null; // Currently, key can be spread in as a prop. This causes a potential // issue if key is also explicitly declared (ie.
@@ -1593,20 +1676,32 @@ if (__DEV__) { if (hasValidRef(config)) { { ref = config.ref; + + { + ref = coerceStringRef(ref, ReactSharedInternals.owner, type); + } } { warnIfStringRefCannotBeAutoConverted(config, self); } - } // Remaining properties are added to a new props object + } - for (propName in config) { - if ( - hasOwnProperty.call(config, propName) && // Skip over reserved prop names - propName !== "key" && - propName !== "ref" - ) { - props[propName] = config[propName]; + var props; + + { + // We need to remove reserved props (key, prop, ref). Create a fresh props + // object and copy over all the non-reserved props. We don't use `delete` + // because in V8 it will deopt the object to dictionary mode. + props = {}; + + for (var propName in config) { + // Skip over reserved prop names + if (propName !== "key" && propName !== "ref") { + { + props[propName] = config[propName]; + } + } } } @@ -1615,9 +1710,9 @@ if (__DEV__) { if (type && type.defaultProps) { var defaultProps = type.defaultProps; - for (propName in defaultProps) { - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; + for (var _propName2 in defaultProps) { + if (props[_propName2] === undefined) { + props[_propName2] = defaultProps[_propName2]; } } } @@ -1644,7 +1739,7 @@ if (__DEV__) { ref, self, source, - ReactCurrentOwner.current, + ReactSharedInternals.owner, props ); @@ -1725,9 +1820,34 @@ if (__DEV__) { var ref = null; if (config != null) { + { + if ( + !didWarnAboutOldJSXRuntime && + "__self" in config && // Do not assume this is the result of an oudated JSX transform if key + // is present, because the modern JSX transform sometimes outputs + // createElement to preserve precedence between a static key and a + // spread key. To avoid false positive warnings, we never warn if + // there's a key. + !("key" in config) + ) { + didWarnAboutOldJSXRuntime = true; + + warn( + "Your app (or one of its dependencies) is using an outdated JSX " + + "transform. Update to the modern JSX transform for " + + "faster performance: " + // TODO: Create a short link for this + "https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html" + ); + } + } + if (hasValidRef(config)) { { ref = config.ref; + + { + ref = coerceStringRef(ref, ReactSharedInternals.owner, type); + } } { @@ -1754,7 +1874,9 @@ if (__DEV__) { propName !== "__self" && propName !== "__source" ) { - props[propName] = config[propName]; + { + props[propName] = config[propName]; + } } } } // Children can be more than one argument, and those are transferred onto @@ -1813,7 +1935,7 @@ if (__DEV__) { ref, undefined, undefined, - ReactCurrentOwner.current, + ReactSharedInternals.owner, props ); @@ -1860,12 +1982,16 @@ if (__DEV__) { if (config != null) { if (hasValidRef(config)) { + owner = ReactSharedInternals.owner; + { // Silently steal the ref from the parent. ref = config.ref; - } - owner = ReactCurrentOwner.current; + { + ref = coerceStringRef(ref, owner, element.type); + } + } } if (hasValidKey(config)) { @@ -1910,7 +2036,9 @@ if (__DEV__) { // Resolve default props props[propName] = defaultProps[propName]; } else { - props[propName] = config[propName]; + { + props[propName] = config[propName]; + } } } } @@ -1950,8 +2078,8 @@ if (__DEV__) { function getDeclarationErrorAddendum() { { - if (ReactCurrentOwner.current) { - var name = getComponentNameFromType(ReactCurrentOwner.current.type); + if (ReactSharedInternals.owner) { + var name = getComponentNameFromType(ReactSharedInternals.owner.type); if (name) { return "\n\nCheck the render method of `" + name + "`."; @@ -2065,14 +2193,18 @@ if (__DEV__) { if ( element && - element._owner && - element._owner !== ReactCurrentOwner.current + element._owner != null && + element._owner !== ReactSharedInternals.owner ) { - // Give the component that originally created this child. - childOwner = - " It was passed a child from " + - getComponentNameFromType(element._owner.type) + - "."; + var ownerName = null; + + if (typeof element._owner.tag === "number") { + ownerName = getComponentNameFromType(element._owner.type); + } else if (typeof element._owner.name === "string") { + ownerName = element._owner.name; + } // Give the component that originally created this child. + + childOwner = " It was passed a child from " + ownerName + "."; } setCurrentlyValidatingElement(element); @@ -2091,14 +2223,10 @@ if (__DEV__) { function setCurrentlyValidatingElement(element) { { if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV( - element.type, - owner ? owner.type : null - ); - ReactDebugCurrentFrame.setExtraStackFrame(stack); + var stack = describeUnknownElementTypeFrameInDEV(element.type); + ReactSharedInternals.setExtraStackFrame(stack); } else { - ReactDebugCurrentFrame.setExtraStackFrame(null); + ReactSharedInternals.setExtraStackFrame(null); } } } @@ -2156,6 +2284,104 @@ if (__DEV__) { } } + function coerceStringRef(mixedRef, owner, type) { + var stringRef; + + if (typeof mixedRef === "string") { + stringRef = mixedRef; + } else { + if (typeof mixedRef === "number" || typeof mixedRef === "boolean") { + { + checkPropStringCoercion(mixedRef, "ref"); + } + + stringRef = "" + mixedRef; + } else { + return mixedRef; + } + } + + var callback = stringRefAsCallbackRef.bind(null, stringRef, type, owner); // This is used to check whether two callback refs conceptually represent + // the same string ref, and can therefore be reused by the reconciler. Needed + // for backwards compatibility with old Meta code that relies on string refs + // not being reattached on every render. + + callback.__stringRef = stringRef; + callback.__type = type; + callback.__owner = owner; + return callback; + } + + function stringRefAsCallbackRef(stringRef, type, owner, value) { + if (!owner) { + throw new Error( + "Element ref was specified as a string (" + + stringRef + + ") but no owner was set. This could happen for one of" + + " the following reasons:\n" + + "1. You may be adding a ref to a function component\n" + + "2. You may be adding a ref to a component that was not created inside a component's render method\n" + + "3. You have multiple copies of React loaded\n" + + "See https://react.dev/link/refs-must-have-owner for more information." + ); + } + + if (owner.tag !== ClassComponent) { + throw new Error( + "Function components cannot have string refs. " + + "We recommend using useRef() instead. " + + "Learn more about using refs safely here: " + + "https://react.dev/link/strict-mode-string-ref" + ); + } + + { + if ( + // Will already warn with "Function components cannot be given refs" + !(typeof type === "function" && !isReactClass(type)) + ) { + var componentName = getComponentNameFromFiber(owner) || "Component"; + + if (!didWarnAboutStringRefs[componentName]) { + error( + 'Component "%s" contains the string ref "%s". Support for string refs ' + + "will be removed in a future major release. We recommend using " + + "useRef() or createRef() instead. " + + "Learn more about using refs safely here: " + + "https://react.dev/link/strict-mode-string-ref", + componentName, + stringRef + ); + + didWarnAboutStringRefs[componentName] = true; + } + } + } + + var inst = owner.stateNode; + + if (!inst) { + throw new Error( + "Missing owner for string ref " + + stringRef + + ". This error is likely caused by a " + + "bug in React. Please file an issue." + ); + } + + var refs = inst.refs; + + if (value === null) { + delete refs[stringRef]; + } else { + refs[stringRef] = value; + } + } + + function isReactClass(type) { + return type.prototype && type.prototype.isReactComponent; + } + var SEPARATOR = "."; var SUBSEPARATOR = ":"; /** @@ -2910,7 +3136,7 @@ if (__DEV__) { var cache = noopCache; function resolveDispatcher() { - var dispatcher = ReactCurrentDispatcher$1.current; + var dispatcher = ReactSharedInternals.H; { if (dispatcher === null) { @@ -2931,7 +3157,7 @@ if (__DEV__) { } function getCacheForType(resourceType) { - var dispatcher = ReactCurrentCache.current; + var dispatcher = ReactSharedInternals.C; if (!dispatcher) { // If there is no dispatcher, then we treat this as not being cached. @@ -3090,18 +3316,18 @@ if (__DEV__) { }; function startTransition(scope, options) { - var prevTransition = ReactCurrentBatchConfig.transition; // Each renderer registers a callback to receive the return value of + var prevTransition = ReactSharedInternals.T; // Each renderer registers a callback to receive the return value of // the scope function. This is used to implement async actions. var callbacks = new Set(); var transition = { _callbacks: callbacks }; - ReactCurrentBatchConfig.transition = transition; - var currentTransition = ReactCurrentBatchConfig.transition; + ReactSharedInternals.T = transition; + var currentTransition = ReactSharedInternals.T; { - ReactCurrentBatchConfig.transition._updatedFibers = new Set(); + ReactSharedInternals.T._updatedFibers = new Set(); } if (enableAsyncActions) { @@ -3122,7 +3348,7 @@ if (__DEV__) { reportGlobalError(error); } finally { warnAboutTransitionSubscriptions(prevTransition, currentTransition); - ReactCurrentBatchConfig.transition = prevTransition; + ReactSharedInternals.T = prevTransition; } } else { // When async actions are not enabled, startTransition does not @@ -3131,7 +3357,7 @@ if (__DEV__) { scope(); } finally { warnAboutTransitionSubscriptions(prevTransition, currentTransition); - ReactCurrentBatchConfig.transition = prevTransition; + ReactSharedInternals.T = prevTransition; } } } @@ -3218,7 +3444,7 @@ if (__DEV__) { function act(callback) { { - // When ReactCurrentActQueue.current is not null, it signals to React that + // When ReactSharedInternals.actQueue is not null, it signals to React that // we're currently inside an `act` scope. React will push all its tasks to // this queue instead of scheduling them with platform APIs. // @@ -3227,18 +3453,18 @@ if (__DEV__) { // `act` calls can be nested. // // If we're already inside an `act` scope, reuse the existing queue. - var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy; - var prevActQueue = ReactCurrentActQueue.current; + var prevIsBatchingLegacy = ReactSharedInternals.isBatchingLegacy; + var prevActQueue = ReactSharedInternals.actQueue; var prevActScopeDepth = actScopeDepth; actScopeDepth++; - var queue = (ReactCurrentActQueue.current = + var queue = (ReactSharedInternals.actQueue = prevActQueue !== null ? prevActQueue : []); // Used to reproduce behavior of `batchedUpdates` in legacy mode. Only // set to `true` while the given callback is executed, not for updates // triggered during an async event, because this is how the legacy // implementation of `act` behaved. { - ReactCurrentActQueue.isBatchingLegacy = true; + ReactSharedInternals.isBatchingLegacy = true; } var result; // This tracks whether the `act` call is awaited. In certain cases, not @@ -3251,12 +3477,12 @@ if (__DEV__) { // only place we ever read this fields is just below, right after running // the callback. So we don't need to reset after the callback runs. if (!disableLegacyMode) { - ReactCurrentActQueue.didScheduleLegacyUpdate = false; + ReactSharedInternals.didScheduleLegacyUpdate = false; } result = callback(); var didScheduleLegacyUpdate = !disableLegacyMode - ? ReactCurrentActQueue.didScheduleLegacyUpdate + ? ReactSharedInternals.didScheduleLegacyUpdate : false; // Replicate behavior of original `act` implementation in legacy mode, // which flushed updates immediately after the scope function exits, even // if it's an async function. @@ -3269,24 +3495,24 @@ if (__DEV__) { // delete legacy mode!! if (!disableLegacyMode) { - ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy; + ReactSharedInternals.isBatchingLegacy = prevIsBatchingLegacy; } } catch (error) { // `isBatchingLegacy` gets reset using the regular stack, not the async // one used to track `act` scopes. Why, you may be wondering? Because // that's how it worked before version 18. Yes, it's confusing! We should // delete legacy mode!! - ReactCurrentActQueue.thrownErrors.push(error); + ReactSharedInternals.thrownErrors.push(error); } - if (ReactCurrentActQueue.thrownErrors.length > 0) { + if (ReactSharedInternals.thrownErrors.length > 0) { { - ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy; + ReactSharedInternals.isBatchingLegacy = prevIsBatchingLegacy; } popActScope(prevActQueue, prevActScopeDepth); - var thrownError = aggregateErrors(ReactCurrentActQueue.thrownErrors); - ReactCurrentActQueue.thrownErrors.length = 0; + var thrownError = aggregateErrors(ReactSharedInternals.thrownErrors); + ReactSharedInternals.thrownErrors.length = 0; throw thrownError; } @@ -3342,15 +3568,15 @@ if (__DEV__) { // `thenable` might not be a real promise, and `flushActQueue` // might throw, so we need to wrap `flushActQueue` in a // try/catch. - ReactCurrentActQueue.thrownErrors.push(error); + ReactSharedInternals.thrownErrors.push(error); } - if (ReactCurrentActQueue.thrownErrors.length > 0) { + if (ReactSharedInternals.thrownErrors.length > 0) { var _thrownError = aggregateErrors( - ReactCurrentActQueue.thrownErrors + ReactSharedInternals.thrownErrors ); - ReactCurrentActQueue.thrownErrors.length = 0; + ReactSharedInternals.thrownErrors.length = 0; reject(_thrownError); } } else { @@ -3360,12 +3586,12 @@ if (__DEV__) { function (error) { popActScope(prevActQueue, prevActScopeDepth); - if (ReactCurrentActQueue.thrownErrors.length > 0) { + if (ReactSharedInternals.thrownErrors.length > 0) { var _thrownError2 = aggregateErrors( - ReactCurrentActQueue.thrownErrors + ReactSharedInternals.thrownErrors ); - ReactCurrentActQueue.thrownErrors.length = 0; + ReactSharedInternals.thrownErrors.length = 0; reject(_thrownError2); } else { reject(error); @@ -3419,15 +3645,15 @@ if (__DEV__) { // TODO: In a future version, consider always requiring all `act` calls // to be awaited, regardless of whether the callback is sync or async. - ReactCurrentActQueue.current = null; + ReactSharedInternals.actQueue = null; } - if (ReactCurrentActQueue.thrownErrors.length > 0) { + if (ReactSharedInternals.thrownErrors.length > 0) { var _thrownError3 = aggregateErrors( - ReactCurrentActQueue.thrownErrors + ReactSharedInternals.thrownErrors ); - ReactCurrentActQueue.thrownErrors.length = 0; + ReactSharedInternals.thrownErrors.length = 0; throw _thrownError3; } @@ -3438,7 +3664,7 @@ if (__DEV__) { if (prevActScopeDepth === 0) { // If the `act` call is awaited, restore the queue we were // using before (see long comment above) so we can flush it. - ReactCurrentActQueue.current = queue; + ReactSharedInternals.actQueue = queue; enqueueTask(function () { return ( // Recursively flush tasks scheduled by a microtask. @@ -3470,7 +3696,7 @@ if (__DEV__) { function recursivelyFlushAsyncActWork(returnValue, resolve, reject) { { // Check if any tasks were scheduled asynchronously. - var queue = ReactCurrentActQueue.current; + var queue = ReactSharedInternals.actQueue; if (queue !== null) { if (queue.length !== 0) { @@ -3490,17 +3716,17 @@ if (__DEV__) { return; } catch (error) { // Leave remaining tasks on the queue if something throws. - ReactCurrentActQueue.thrownErrors.push(error); + ReactSharedInternals.thrownErrors.push(error); } } else { // The queue is empty. We can finish. - ReactCurrentActQueue.current = null; + ReactSharedInternals.actQueue = null; } } - if (ReactCurrentActQueue.thrownErrors.length > 0) { - var thrownError = aggregateErrors(ReactCurrentActQueue.thrownErrors); - ReactCurrentActQueue.thrownErrors.length = 0; + if (ReactSharedInternals.thrownErrors.length > 0) { + var thrownError = aggregateErrors(ReactSharedInternals.thrownErrors); + ReactSharedInternals.thrownErrors.length = 0; reject(thrownError); } else { resolve(returnValue); @@ -3522,11 +3748,11 @@ if (__DEV__) { var callback = queue[i]; do { - ReactCurrentActQueue.didUsePromise = false; + ReactSharedInternals.didUsePromise = false; var continuation = callback(false); if (continuation !== null) { - if (ReactCurrentActQueue.didUsePromise) { + if (ReactSharedInternals.didUsePromise) { // The component just suspended. Yield to the main thread in // case the promise is already resolved. If so, it will ping in // a microtask and we can resume without unwinding the stack. @@ -3546,7 +3772,7 @@ if (__DEV__) { } catch (error) { // If something throws, leave the remaining callbacks on the queue. queue.splice(0, i + 1); - ReactCurrentActQueue.thrownErrors.push(error); + ReactSharedInternals.thrownErrors.push(error); } finally { isFlushing = false; } @@ -3593,7 +3819,7 @@ if (__DEV__) { exports.PureComponent = PureComponent; exports.StrictMode = REACT_STRICT_MODE_TYPE; exports.Suspense = REACT_SUSPENSE_TYPE; - exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = + exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals; exports.act = act; exports.cache = cache; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js index 6ede3f8208..2347230b31 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<00252b7815c38ef0d757b44717a43f7d>> */ "use strict"; @@ -86,17 +86,8 @@ var isArrayImpl = Array.isArray, enableRenderableContext = dynamicFlagsUntyped.enableRenderableContext, disableDefaultPropsExceptForClasses = dynamicFlagsUntyped.disableDefaultPropsExceptForClasses, - ReactCurrentDispatcher = { current: null }, - ReactCurrentCache = { current: null }, - ReactCurrentBatchConfig = { transition: null }, - ReactSharedInternals = { - ReactCurrentDispatcher: ReactCurrentDispatcher, - ReactCurrentCache: ReactCurrentCache, - ReactCurrentBatchConfig: ReactCurrentBatchConfig, - ReactCurrentOwner: { current: null } - }, - hasOwnProperty = Object.prototype.hasOwnProperty, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; + ReactSharedInternals = { H: null, C: null, T: null, owner: null }, + hasOwnProperty = Object.prototype.hasOwnProperty; function ReactElement(type, key, _ref, self, source, owner, props) { return { $$typeof: REACT_ELEMENT_TYPE, @@ -108,29 +99,32 @@ function ReactElement(type, key, _ref, self, source, owner, props) { }; } function jsxProd(type, config, maybeKey) { - var propName, - props = {}, - key = null, + var key = null, ref = null; void 0 !== maybeKey && (key = "" + maybeKey); void 0 !== config.key && (key = "" + config.key); - void 0 !== config.ref && (ref = config.ref); - for (propName in config) - hasOwnProperty.call(config, propName) && - "key" !== propName && + void 0 !== config.ref && + ((ref = config.ref), + (ref = coerceStringRef(ref, ReactSharedInternals.owner, type))); + maybeKey = {}; + for (var propName in config) + "key" !== propName && "ref" !== propName && - (props[propName] = config[propName]); - if (!disableDefaultPropsExceptForClasses && type && type.defaultProps) - for (propName in ((config = type.defaultProps), config)) - void 0 === props[propName] && (props[propName] = config[propName]); + (maybeKey[propName] = config[propName]); + if (!disableDefaultPropsExceptForClasses && type && type.defaultProps) { + config = type.defaultProps; + for (var propName$0 in config) + void 0 === maybeKey[propName$0] && + (maybeKey[propName$0] = config[propName$0]); + } return ReactElement( type, key, ref, void 0, void 0, - ReactCurrentOwner.current, - props + ReactSharedInternals.owner, + maybeKey ); } function cloneAndReplaceKey(oldElement, newKey) { @@ -151,6 +145,38 @@ function isValidElement(object) { object.$$typeof === REACT_ELEMENT_TYPE ); } +function coerceStringRef(mixedRef, owner, type) { + if ("string" !== typeof mixedRef) + if ("number" === typeof mixedRef || "boolean" === typeof mixedRef) + mixedRef = "" + mixedRef; + else return mixedRef; + var callback = stringRefAsCallbackRef.bind(null, mixedRef, type, owner); + callback.__stringRef = mixedRef; + callback.__type = type; + callback.__owner = owner; + return callback; +} +function stringRefAsCallbackRef(stringRef, type, owner, value) { + if (!owner) + throw Error( + "Element ref was specified as a string (" + + stringRef + + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://react.dev/link/refs-must-have-owner for more information." + ); + if (1 !== owner.tag) + throw Error( + "Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref" + ); + type = owner.stateNode; + if (!type) + throw Error( + "Missing owner for string ref " + + stringRef + + ". This error is likely caused by a bug in React. Please file an issue." + ); + type = type.refs; + null === value ? delete type[stringRef] : (type[stringRef] = value); +} function escape(key) { var escaperLookup = { "=": "=0", ":": "=2" }; return ( @@ -404,7 +430,7 @@ exports.Profiler = REACT_PROFILER_TYPE; exports.PureComponent = PureComponent; exports.StrictMode = REACT_STRICT_MODE_TYPE; exports.Suspense = REACT_SUSPENSE_TYPE; -exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = +exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals; exports.act = function () { throw Error("act(...) is not supported in production builds of React."); @@ -425,7 +451,9 @@ exports.cloneElement = function (element, config, children) { owner = element._owner; if (null != config) { void 0 !== config.ref && - ((ref = config.ref), (owner = ReactCurrentOwner.current)); + ((owner = ReactSharedInternals.owner), + (ref = config.ref), + (ref = coerceStringRef(ref, owner, element.type))); void 0 !== config.key && (key = "" + config.key); if ( !disableDefaultPropsExceptForClasses && @@ -483,7 +511,9 @@ exports.createElement = function (type, config, children) { key = null, ref = null; if (null != config) - for (propName in (void 0 !== config.ref && (ref = config.ref), + for (propName in (void 0 !== config.ref && + ((ref = config.ref), + (ref = coerceStringRef(ref, ReactSharedInternals.owner, type))), void 0 !== config.key && (key = "" + config.key), config)) hasOwnProperty.call(config, propName) && @@ -509,7 +539,7 @@ exports.createElement = function (type, config, children) { ref, void 0, void 0, - ReactCurrentOwner.current, + ReactSharedInternals.owner, props ); }; @@ -517,7 +547,7 @@ exports.createRef = function () { return { current: null }; }; exports.experimental_useEffectEvent = function (callback) { - return ReactCurrentDispatcher.current.useEffectEvent(callback); + return ReactSharedInternals.H.useEffectEvent(callback); }; exports.forwardRef = function (render) { return { $$typeof: REACT_FORWARD_REF_TYPE, render: render }; @@ -541,10 +571,10 @@ exports.memo = function (type, compare) { }; }; exports.startTransition = function (scope) { - var prevTransition = ReactCurrentBatchConfig.transition, + var prevTransition = ReactSharedInternals.T, callbacks = new Set(); - ReactCurrentBatchConfig.transition = { _callbacks: callbacks }; - var currentTransition = ReactCurrentBatchConfig.transition; + ReactSharedInternals.T = { _callbacks: callbacks }; + var currentTransition = ReactSharedInternals.T; if (enableAsyncActions) try { var returnValue = scope(); @@ -558,13 +588,13 @@ exports.startTransition = function (scope) { } catch (error) { reportGlobalError(error); } finally { - ReactCurrentBatchConfig.transition = prevTransition; + ReactSharedInternals.T = prevTransition; } else try { scope(); } finally { - ReactCurrentBatchConfig.transition = prevTransition; + ReactSharedInternals.T = prevTransition; } }; exports.unstable_Activity = REACT_OFFSCREEN_TYPE; @@ -574,21 +604,21 @@ exports.unstable_Scope = REACT_SCOPE_TYPE; exports.unstable_SuspenseList = REACT_SUSPENSE_LIST_TYPE; exports.unstable_TracingMarker = REACT_TRACING_MARKER_TYPE; exports.unstable_getCacheForType = function (resourceType) { - var dispatcher = ReactCurrentCache.current; + var dispatcher = ReactSharedInternals.C; return dispatcher ? dispatcher.getCacheForType(resourceType) : resourceType(); }; exports.unstable_useCacheRefresh = function () { - return ReactCurrentDispatcher.current.useCacheRefresh(); + return ReactSharedInternals.H.useCacheRefresh(); }; exports.unstable_useMemoCache = function (size) { - return ReactCurrentDispatcher.current.useMemoCache(size); + return ReactSharedInternals.H.useMemoCache(size); }; exports.use = function (usable) { - return ReactCurrentDispatcher.current.use(usable); + return ReactSharedInternals.H.use(usable); }; exports.useActionState = function (action, initialState, permalink) { if (enableAsyncActions) - return ReactCurrentDispatcher.current.useActionState( + return ReactSharedInternals.H.useActionState( action, initialState, permalink @@ -596,57 +626,57 @@ exports.useActionState = function (action, initialState, permalink) { throw Error("Not implemented."); }; exports.useCallback = function (callback, deps) { - return ReactCurrentDispatcher.current.useCallback(callback, deps); + return ReactSharedInternals.H.useCallback(callback, deps); }; exports.useContext = function (Context) { - return ReactCurrentDispatcher.current.useContext(Context); + return ReactSharedInternals.H.useContext(Context); }; exports.useDebugValue = function () {}; exports.useDeferredValue = function (value, initialValue) { - return ReactCurrentDispatcher.current.useDeferredValue(value, initialValue); + return ReactSharedInternals.H.useDeferredValue(value, initialValue); }; exports.useEffect = function (create, deps) { - return ReactCurrentDispatcher.current.useEffect(create, deps); + return ReactSharedInternals.H.useEffect(create, deps); }; exports.useId = function () { - return ReactCurrentDispatcher.current.useId(); + return ReactSharedInternals.H.useId(); }; exports.useImperativeHandle = function (ref, create, deps) { - return ReactCurrentDispatcher.current.useImperativeHandle(ref, create, deps); + return ReactSharedInternals.H.useImperativeHandle(ref, create, deps); }; exports.useInsertionEffect = function (create, deps) { - return ReactCurrentDispatcher.current.useInsertionEffect(create, deps); + return ReactSharedInternals.H.useInsertionEffect(create, deps); }; exports.useLayoutEffect = function (create, deps) { - return ReactCurrentDispatcher.current.useLayoutEffect(create, deps); + return ReactSharedInternals.H.useLayoutEffect(create, deps); }; exports.useMemo = function (create, deps) { - return ReactCurrentDispatcher.current.useMemo(create, deps); + return ReactSharedInternals.H.useMemo(create, deps); }; exports.useOptimistic = function (passthrough, reducer) { - return ReactCurrentDispatcher.current.useOptimistic(passthrough, reducer); + return ReactSharedInternals.H.useOptimistic(passthrough, reducer); }; exports.useReducer = function (reducer, initialArg, init) { - return ReactCurrentDispatcher.current.useReducer(reducer, initialArg, init); + return ReactSharedInternals.H.useReducer(reducer, initialArg, init); }; exports.useRef = function (initialValue) { - return ReactCurrentDispatcher.current.useRef(initialValue); + return ReactSharedInternals.H.useRef(initialValue); }; exports.useState = function (initialState) { - return ReactCurrentDispatcher.current.useState(initialState); + return ReactSharedInternals.H.useState(initialState); }; exports.useSyncExternalStore = function ( subscribe, getSnapshot, getServerSnapshot ) { - return ReactCurrentDispatcher.current.useSyncExternalStore( + return ReactSharedInternals.H.useSyncExternalStore( subscribe, getSnapshot, getServerSnapshot ); }; exports.useTransition = function () { - return ReactCurrentDispatcher.current.useTransition(); + return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-canary-c781fee2"; +exports.version = "19.0.0-canary-3277b133"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js index d9cbcae7ab..1c52dbc17b 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<9fd3393509037fbe670735ccea6d8cca>> */ "use strict"; @@ -90,17 +90,8 @@ var isArrayImpl = Array.isArray, enableRenderableContext = dynamicFlagsUntyped.enableRenderableContext, disableDefaultPropsExceptForClasses = dynamicFlagsUntyped.disableDefaultPropsExceptForClasses, - ReactCurrentDispatcher = { current: null }, - ReactCurrentCache = { current: null }, - ReactCurrentBatchConfig = { transition: null }, - ReactSharedInternals = { - ReactCurrentDispatcher: ReactCurrentDispatcher, - ReactCurrentCache: ReactCurrentCache, - ReactCurrentBatchConfig: ReactCurrentBatchConfig, - ReactCurrentOwner: { current: null } - }, - hasOwnProperty = Object.prototype.hasOwnProperty, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; + ReactSharedInternals = { H: null, C: null, T: null, owner: null }, + hasOwnProperty = Object.prototype.hasOwnProperty; function ReactElement(type, key, _ref, self, source, owner, props) { return { $$typeof: REACT_ELEMENT_TYPE, @@ -112,29 +103,32 @@ function ReactElement(type, key, _ref, self, source, owner, props) { }; } function jsxProd(type, config, maybeKey) { - var propName, - props = {}, - key = null, + var key = null, ref = null; void 0 !== maybeKey && (key = "" + maybeKey); void 0 !== config.key && (key = "" + config.key); - void 0 !== config.ref && (ref = config.ref); - for (propName in config) - hasOwnProperty.call(config, propName) && - "key" !== propName && + void 0 !== config.ref && + ((ref = config.ref), + (ref = coerceStringRef(ref, ReactSharedInternals.owner, type))); + maybeKey = {}; + for (var propName in config) + "key" !== propName && "ref" !== propName && - (props[propName] = config[propName]); - if (!disableDefaultPropsExceptForClasses && type && type.defaultProps) - for (propName in ((config = type.defaultProps), config)) - void 0 === props[propName] && (props[propName] = config[propName]); + (maybeKey[propName] = config[propName]); + if (!disableDefaultPropsExceptForClasses && type && type.defaultProps) { + config = type.defaultProps; + for (var propName$0 in config) + void 0 === maybeKey[propName$0] && + (maybeKey[propName$0] = config[propName$0]); + } return ReactElement( type, key, ref, void 0, void 0, - ReactCurrentOwner.current, - props + ReactSharedInternals.owner, + maybeKey ); } function cloneAndReplaceKey(oldElement, newKey) { @@ -155,6 +149,38 @@ function isValidElement(object) { object.$$typeof === REACT_ELEMENT_TYPE ); } +function coerceStringRef(mixedRef, owner, type) { + if ("string" !== typeof mixedRef) + if ("number" === typeof mixedRef || "boolean" === typeof mixedRef) + mixedRef = "" + mixedRef; + else return mixedRef; + var callback = stringRefAsCallbackRef.bind(null, mixedRef, type, owner); + callback.__stringRef = mixedRef; + callback.__type = type; + callback.__owner = owner; + return callback; +} +function stringRefAsCallbackRef(stringRef, type, owner, value) { + if (!owner) + throw Error( + "Element ref was specified as a string (" + + stringRef + + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://react.dev/link/refs-must-have-owner for more information." + ); + if (1 !== owner.tag) + throw Error( + "Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref" + ); + type = owner.stateNode; + if (!type) + throw Error( + "Missing owner for string ref " + + stringRef + + ". This error is likely caused by a bug in React. Please file an issue." + ); + type = type.refs; + null === value ? delete type[stringRef] : (type[stringRef] = value); +} function escape(key) { var escaperLookup = { "=": "=0", ":": "=2" }; return ( @@ -408,7 +434,7 @@ exports.Profiler = REACT_PROFILER_TYPE; exports.PureComponent = PureComponent; exports.StrictMode = REACT_STRICT_MODE_TYPE; exports.Suspense = REACT_SUSPENSE_TYPE; -exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = +exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals; exports.act = function () { throw Error("act(...) is not supported in production builds of React."); @@ -429,7 +455,9 @@ exports.cloneElement = function (element, config, children) { owner = element._owner; if (null != config) { void 0 !== config.ref && - ((ref = config.ref), (owner = ReactCurrentOwner.current)); + ((owner = ReactSharedInternals.owner), + (ref = config.ref), + (ref = coerceStringRef(ref, owner, element.type))); void 0 !== config.key && (key = "" + config.key); if ( !disableDefaultPropsExceptForClasses && @@ -487,7 +515,9 @@ exports.createElement = function (type, config, children) { key = null, ref = null; if (null != config) - for (propName in (void 0 !== config.ref && (ref = config.ref), + for (propName in (void 0 !== config.ref && + ((ref = config.ref), + (ref = coerceStringRef(ref, ReactSharedInternals.owner, type))), void 0 !== config.key && (key = "" + config.key), config)) hasOwnProperty.call(config, propName) && @@ -513,7 +543,7 @@ exports.createElement = function (type, config, children) { ref, void 0, void 0, - ReactCurrentOwner.current, + ReactSharedInternals.owner, props ); }; @@ -521,7 +551,7 @@ exports.createRef = function () { return { current: null }; }; exports.experimental_useEffectEvent = function (callback) { - return ReactCurrentDispatcher.current.useEffectEvent(callback); + return ReactSharedInternals.H.useEffectEvent(callback); }; exports.forwardRef = function (render) { return { $$typeof: REACT_FORWARD_REF_TYPE, render: render }; @@ -545,10 +575,10 @@ exports.memo = function (type, compare) { }; }; exports.startTransition = function (scope) { - var prevTransition = ReactCurrentBatchConfig.transition, + var prevTransition = ReactSharedInternals.T, callbacks = new Set(); - ReactCurrentBatchConfig.transition = { _callbacks: callbacks }; - var currentTransition = ReactCurrentBatchConfig.transition; + ReactSharedInternals.T = { _callbacks: callbacks }; + var currentTransition = ReactSharedInternals.T; if (enableAsyncActions) try { var returnValue = scope(); @@ -562,13 +592,13 @@ exports.startTransition = function (scope) { } catch (error) { reportGlobalError(error); } finally { - ReactCurrentBatchConfig.transition = prevTransition; + ReactSharedInternals.T = prevTransition; } else try { scope(); } finally { - ReactCurrentBatchConfig.transition = prevTransition; + ReactSharedInternals.T = prevTransition; } }; exports.unstable_Activity = REACT_OFFSCREEN_TYPE; @@ -578,21 +608,21 @@ exports.unstable_Scope = REACT_SCOPE_TYPE; exports.unstable_SuspenseList = REACT_SUSPENSE_LIST_TYPE; exports.unstable_TracingMarker = REACT_TRACING_MARKER_TYPE; exports.unstable_getCacheForType = function (resourceType) { - var dispatcher = ReactCurrentCache.current; + var dispatcher = ReactSharedInternals.C; return dispatcher ? dispatcher.getCacheForType(resourceType) : resourceType(); }; exports.unstable_useCacheRefresh = function () { - return ReactCurrentDispatcher.current.useCacheRefresh(); + return ReactSharedInternals.H.useCacheRefresh(); }; exports.unstable_useMemoCache = function (size) { - return ReactCurrentDispatcher.current.useMemoCache(size); + return ReactSharedInternals.H.useMemoCache(size); }; exports.use = function (usable) { - return ReactCurrentDispatcher.current.use(usable); + return ReactSharedInternals.H.use(usable); }; exports.useActionState = function (action, initialState, permalink) { if (enableAsyncActions) - return ReactCurrentDispatcher.current.useActionState( + return ReactSharedInternals.H.useActionState( action, initialState, permalink @@ -600,60 +630,60 @@ exports.useActionState = function (action, initialState, permalink) { throw Error("Not implemented."); }; exports.useCallback = function (callback, deps) { - return ReactCurrentDispatcher.current.useCallback(callback, deps); + return ReactSharedInternals.H.useCallback(callback, deps); }; exports.useContext = function (Context) { - return ReactCurrentDispatcher.current.useContext(Context); + return ReactSharedInternals.H.useContext(Context); }; exports.useDebugValue = function () {}; exports.useDeferredValue = function (value, initialValue) { - return ReactCurrentDispatcher.current.useDeferredValue(value, initialValue); + return ReactSharedInternals.H.useDeferredValue(value, initialValue); }; exports.useEffect = function (create, deps) { - return ReactCurrentDispatcher.current.useEffect(create, deps); + return ReactSharedInternals.H.useEffect(create, deps); }; exports.useId = function () { - return ReactCurrentDispatcher.current.useId(); + return ReactSharedInternals.H.useId(); }; exports.useImperativeHandle = function (ref, create, deps) { - return ReactCurrentDispatcher.current.useImperativeHandle(ref, create, deps); + return ReactSharedInternals.H.useImperativeHandle(ref, create, deps); }; exports.useInsertionEffect = function (create, deps) { - return ReactCurrentDispatcher.current.useInsertionEffect(create, deps); + return ReactSharedInternals.H.useInsertionEffect(create, deps); }; exports.useLayoutEffect = function (create, deps) { - return ReactCurrentDispatcher.current.useLayoutEffect(create, deps); + return ReactSharedInternals.H.useLayoutEffect(create, deps); }; exports.useMemo = function (create, deps) { - return ReactCurrentDispatcher.current.useMemo(create, deps); + return ReactSharedInternals.H.useMemo(create, deps); }; exports.useOptimistic = function (passthrough, reducer) { - return ReactCurrentDispatcher.current.useOptimistic(passthrough, reducer); + return ReactSharedInternals.H.useOptimistic(passthrough, reducer); }; exports.useReducer = function (reducer, initialArg, init) { - return ReactCurrentDispatcher.current.useReducer(reducer, initialArg, init); + return ReactSharedInternals.H.useReducer(reducer, initialArg, init); }; exports.useRef = function (initialValue) { - return ReactCurrentDispatcher.current.useRef(initialValue); + return ReactSharedInternals.H.useRef(initialValue); }; exports.useState = function (initialState) { - return ReactCurrentDispatcher.current.useState(initialState); + return ReactSharedInternals.H.useState(initialState); }; exports.useSyncExternalStore = function ( subscribe, getSnapshot, getServerSnapshot ) { - return ReactCurrentDispatcher.current.useSyncExternalStore( + return ReactSharedInternals.H.useSyncExternalStore( subscribe, getSnapshot, getServerSnapshot ); }; exports.useTransition = function () { - return ReactCurrentDispatcher.current.useTransition(); + return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-canary-46b57fd6"; +exports.version = "19.0.0-canary-52747c26"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION index 745c141bfa..ff41bb76b1 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION @@ -1 +1 @@ -87b495f7d26a2c631c08952661d38bb5ce5acb03 +ed4023603632787db6416bee8e85e68d98ad29bd diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index c294fe0e4c..a451087c1e 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "use strict"; @@ -31,7 +31,7 @@ if (__DEV__) { var Scheduler = require("scheduler"); var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; var suppressWarning = false; function setSuppressWarning(newSuppressWarning) { @@ -83,9 +83,7 @@ if (__DEV__) { // When changing this logic, you might want to also // update consoleWithStackDev.www.js as well. { - var ReactDebugCurrentFrame = - ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); + var stack = ReactSharedInternals.getStackAddendum(); if (stack !== "") { format += "%s"; @@ -3057,6 +3055,7 @@ to return true:wantsResponderID| | var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; var DidDefer = ContentReset; + var FormReset = Snapshot; var LifecycleEffectMask = Passive$1 | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) @@ -3115,7 +3114,8 @@ to return true:wantsResponderID| | ContentReset | Ref | Hydrating | - Visibility; + Visibility | + FormReset; var LayoutMask = Update | Callback | Ref | Visibility; // TODO: Split into PassiveMountMask and PassiveUnmountMask var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that don't get reset on clones. @@ -4643,17 +4643,11 @@ to return true:wantsResponderID| | } } + var NoEventPriority = NoLane; var DiscreteEventPriority = SyncLane; var ContinuousEventPriority = InputContinuousLane; var DefaultEventPriority = DefaultLane; var IdleEventPriority = IdleLane; - var currentUpdatePriority = NoLane; - function getCurrentUpdatePriority() { - return currentUpdatePriority; - } - function setCurrentUpdatePriority(newPriority) { - currentUpdatePriority = newPriority; - } function higherEventPriority(a, b) { return a !== 0 && a < b ? a : b; } @@ -4663,6 +4657,9 @@ to return true:wantsResponderID| | function isHigherEventPriority(a, b) { return a !== 0 && a < b; } + function eventPriorityToLane(updatePriority) { + return updatePriority; + } function lanesToEventPriority(lanes) { var lane = getHighestPriorityLane(lanes); @@ -4904,7 +4901,18 @@ to return true:wantsResponderID| | // More context @ github.com/facebook/react/pull/8560#discussion_r92111303 return false; } - function getCurrentEventPriority() { + var currentUpdatePriority = NoEventPriority; + function setCurrentUpdatePriority(newPriority) { + currentUpdatePriority = newPriority; + } + function getCurrentUpdatePriority() { + return currentUpdatePriority; + } + function resolveUpdatePriority() { + if (currentUpdatePriority !== NoEventPriority) { + return currentUpdatePriority; + } + var currentEventPriority = fabricGetCurrentEventPriority ? fabricGetCurrentEventPriority() : null; @@ -5025,7 +5033,7 @@ to return true:wantsResponderID| | function waitForCommitToBeReady() { return null; } - var NotPendingTransition = null; // ------------------- + var NotPendingTransition = null; // Microtasks // ------------------- @@ -5096,6 +5104,9 @@ to return true:wantsResponderID| | ReactFabricGlobalResponderHandler ); + var LegacyRoot = 0; + var ConcurrentRoot = 1; + /** * `ReactInstanceMap` maintains a mapping from a public facing stateful * instance (key) and the internal representation (value). This allows public @@ -5291,6 +5302,17 @@ to return true:wantsResponderID| | return type.displayName || "Context"; } + function getComponentNameFromOwner(owner) { + if (typeof owner.tag === "number") { + return getComponentNameFromFiber(owner); + } + + if (typeof owner.name === "string") { + return owner.name; + } + + return null; + } function getComponentNameFromFiber(fiber) { var tag = fiber.tag, type = fiber.type; @@ -5395,7 +5417,6 @@ to return true:wantsResponderID| | return null; } - var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner; function getNearestMountedFiber(fiber) { var node = fiber; var nearestMounted = fiber; @@ -5437,7 +5458,7 @@ to return true:wantsResponderID| | } function isMounted(component) { { - var owner = ReactCurrentOwner$3.current; + var owner = ReactSharedInternals.owner; if (owner !== null && owner.tag === ClassComponent) { var ownerFiber = owner; @@ -5993,9 +6014,6 @@ to return true:wantsResponderID| | } } - var LegacyRoot = 0; - var ConcurrentRoot = 1; - // We use the existence of the state object as an indicator that the component // is hidden. var OffscreenVisible = @@ -6026,9 +6044,8 @@ to return true:wantsResponderID| | var objectIs = typeof Object.is === "function" ? Object.is : is; // $FlowFixMe[method-unbinding] - var ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher; var prefix; - function describeBuiltInComponentFrame(name, ownerFn) { + function describeBuiltInComponentFrame(name) { if (enableComponentStackLocations) { if (prefix === undefined) { // Extract the VM specific prefix used by each line. @@ -6042,19 +6059,12 @@ to return true:wantsResponderID| | return "\n" + prefix + name; } else { - var ownerName = null; - - if (ownerFn) { - ownerName = ownerFn.displayName || ownerFn.name || null; - } - - return describeComponentFrame(name, ownerName); + return describeComponentFrame(name); } } function describeDebugInfoFrame(name, env) { return describeBuiltInComponentFrame( - name + (env ? " (" + env + ")" : ""), - null + name + (env ? " (" + env + ")" : "") ); } var reentry = false; @@ -6094,13 +6104,13 @@ to return true:wantsResponderID| | var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. Error.prepareStackTrace = undefined; - var previousDispatcher; + var previousDispatcher = null; { - previousDispatcher = ReactCurrentDispatcher$2.current; // Set the dispatcher in DEV because this might be call in the render function + previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function // for warnings. - ReactCurrentDispatcher$2.current = null; + ReactSharedInternals.H = null; disableLogs(); } /** @@ -6293,7 +6303,7 @@ to return true:wantsResponderID| | reentry = false; { - ReactCurrentDispatcher$2.current = previousDispatcher; + ReactSharedInternals.H = previousDispatcher; reenableLogs(); } @@ -6312,24 +6322,18 @@ to return true:wantsResponderID| | return syntheticFrame; } - function describeComponentFrame(name, ownerName) { - var sourceInfo = ""; - - if (ownerName) { - sourceInfo = " (created by " + ownerName + ")"; - } - - return "\n in " + (name || "Unknown") + sourceInfo; + function describeComponentFrame(name) { + return "\n in " + (name || "Unknown"); } - function describeClassComponentFrame(ctor, ownerFn) { + function describeClassComponentFrame(ctor) { if (enableComponentStackLocations) { return describeNativeComponentFrame(ctor, true); } else { - return describeFunctionComponentFrame(ctor, ownerFn); + return describeFunctionComponentFrame(ctor); } } - function describeFunctionComponentFrame(fn, ownerFn) { + function describeFunctionComponentFrame(fn) { if (enableComponentStackLocations) { return describeNativeComponentFrame(fn, false); } else { @@ -6338,43 +6342,35 @@ to return true:wantsResponderID| | } var name = fn.displayName || fn.name || null; - var ownerName = null; - - if (ownerFn) { - ownerName = ownerFn.displayName || ownerFn.name || null; - } - - return describeComponentFrame(name, ownerName); + return describeComponentFrame(name); } } function describeFiber(fiber) { - var owner = fiber._debugOwner ? fiber._debugOwner.type : null; - switch (fiber.tag) { case HostHoistable: case HostSingleton: case HostComponent: - return describeBuiltInComponentFrame(fiber.type, owner); + return describeBuiltInComponentFrame(fiber.type); case LazyComponent: - return describeBuiltInComponentFrame("Lazy", owner); + return describeBuiltInComponentFrame("Lazy"); case SuspenseComponent: - return describeBuiltInComponentFrame("Suspense", owner); + return describeBuiltInComponentFrame("Suspense"); case SuspenseListComponent: - return describeBuiltInComponentFrame("SuspenseList", owner); + return describeBuiltInComponentFrame("SuspenseList"); case FunctionComponent: case SimpleMemoComponent: - return describeFunctionComponentFrame(fiber.type, owner); + return describeFunctionComponentFrame(fiber.type); case ForwardRef: - return describeFunctionComponentFrame(fiber.type.render, owner); + return describeFunctionComponentFrame(fiber.type.render); case ClassComponent: - return describeClassComponentFrame(fiber.type, owner); + return describeClassComponentFrame(fiber.type); default: return ""; @@ -7537,7 +7533,6 @@ to return true:wantsResponderID| | } } - var ReactCurrentActQueue$4 = ReactSharedInternals.ReactCurrentActQueue; // A linked list of all the roots with pending work. In an idiomatic app, // there's only a single root, but we do support multi root apps, hence this // extra complexity. But this module is optimized for the single root case. @@ -7576,7 +7571,7 @@ to return true:wantsResponderID| | mightHavePendingSyncWork = true; // At the end of the current event, go through each of the roots and ensure // there's a task scheduled for each one at the correct priority. - if (ReactCurrentActQueue$4.current !== null) { + if (ReactSharedInternals.actQueue !== null) { // We're inside an `act` scope. if (!didScheduleMicrotask_act) { didScheduleMicrotask_act = true; @@ -7597,9 +7592,9 @@ to return true:wantsResponderID| | scheduleTaskForRootDuringMicrotask(root, now$1()); } - if (ReactCurrentActQueue$4.isBatchingLegacy && root.tag === LegacyRoot) { + if (ReactSharedInternals.isBatchingLegacy && root.tag === LegacyRoot) { // Special `act` case: Record whenever a legacy update is scheduled. - ReactCurrentActQueue$4.didScheduleLegacyUpdate = true; + ReactSharedInternals.didScheduleLegacyUpdate = true; } } function flushSyncWorkOnAllRoots() { @@ -7790,7 +7785,7 @@ to return true:wantsResponderID| | // Scheduler task, rather than an `act` task, cancel it and re-schedule // on the `act` queue. !( - ReactCurrentActQueue$4.current !== null && + ReactSharedInternals.actQueue !== null && existingCallbackNode !== fakeActCallbackNode$1 ) ) { @@ -7857,11 +7852,11 @@ to return true:wantsResponderID| | var fakeActCallbackNode$1 = {}; function scheduleCallback$2(priorityLevel, callback) { - if (ReactCurrentActQueue$4.current !== null) { + if (ReactSharedInternals.actQueue !== null) { // Special case: We're inside an `act` scope (a testing utility). // Instead of scheduling work in the host environment, add it to a // fake internal queue that's managed by the `act` implementation. - ReactCurrentActQueue$4.current.push(callback); + ReactSharedInternals.actQueue.push(callback); return fakeActCallbackNode$1; } else { return scheduleCallback$3(priorityLevel, callback); @@ -7876,13 +7871,13 @@ to return true:wantsResponderID| | } function scheduleImmediateTask(cb) { - if (ReactCurrentActQueue$4.current !== null) { + if (ReactSharedInternals.actQueue !== null) { // Special case: Inside an `act` scope, we push microtasks to the fake `act` // callback queue. This is because we currently support calling `act` // without awaiting the result. The plan is to deprecate that, and require // that you always await the result so that the microtasks have a chance to // run. But it hasn't happened yet. - ReactCurrentActQueue$4.current.push(function () { + ReactSharedInternals.actQueue.push(function () { cb(); return null; }); @@ -8698,7 +8693,6 @@ to return true:wantsResponderID| | return true; } - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; var current = null; var isRendering = false; function getCurrentFiberOwnerNameInDevOrNull() { @@ -8709,8 +8703,8 @@ to return true:wantsResponderID| | var owner = current._debugOwner; - if (owner !== null && typeof owner !== "undefined") { - return getComponentNameFromFiber(owner); + if (owner != null) { + return getComponentNameFromOwner(owner); } } @@ -8730,14 +8724,14 @@ to return true:wantsResponderID| | function resetCurrentFiber() { { - ReactDebugCurrentFrame.getCurrentStack = null; + ReactSharedInternals.getCurrentStack = null; current = null; isRendering = false; } } function setCurrentFiber(fiber) { { - ReactDebugCurrentFrame.getCurrentStack = + ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; current = fiber; isRendering = false; @@ -9112,96 +9106,6 @@ to return true:wantsResponderID| | }; } - /* - * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol - * and Temporal.* types. See https://github.com/facebook/react/pull/22064. - * - * The functions in this module will throw an easier-to-understand, - * easier-to-debug exception with a clear errors message message explaining the - * problem. (Instead of a confusing exception thrown inside the implementation - * of the `value` object). - */ - // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. - function typeName(value) { - { - // toStringTag is needed for namespaced types like Temporal.Instant - var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; - var type = - (hasToStringTag && value[Symbol.toStringTag]) || - value.constructor.name || - "Object"; // $FlowFixMe[incompatible-return] - - return type; - } - } // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. - - function willCoercionThrow(value) { - { - try { - testStringCoercion(value); - return false; - } catch (e) { - return true; - } - } - } - - function testStringCoercion(value) { - // If you ended up here by following an exception call stack, here's what's - // happened: you supplied an object or symbol value to React (as a prop, key, - // DOM attribute, CSS property, string ref, etc.) and when React tried to - // coerce it to a string using `'' + value`, an exception was thrown. - // - // The most common types that will cause this exception are `Symbol` instances - // and Temporal objects like `Temporal.Instant`. But any object that has a - // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this - // exception. (Library authors do this to prevent users from using built-in - // numeric operators like `+` or comparison operators like `>=` because custom - // methods are needed to perform accurate arithmetic or comparison.) - // - // To fix the problem, coerce this object or symbol value to a string before - // passing it to React. The most reliable way is usually `String(value)`. - // - // To find which value is throwing, check the browser or debugger console. - // Before this exception was thrown, there should be `console.error` output - // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the - // problem and how that type was used: key, atrribute, input value prop, etc. - // In most cases, this console output also shows the component and its - // ancestor components where the exception happened. - // - // eslint-disable-next-line react-internal/safe-string-coercion - return "" + value; - } - function checkKeyStringCoercion(value) { - { - if (willCoercionThrow(value)) { - error( - "The provided key is an unsupported type %s." + - " This value must be coerced to a string before using it here.", - typeName(value) - ); - - return testStringCoercion(value); // throw (to help callers find troubleshooting comments) - } - } - } - function checkPropStringCoercion(value, propName) { - { - if (willCoercionThrow(value)) { - error( - "The provided `%s` prop is an unsupported type %s." + - " This value must be coerced to a string before using it here.", - propName, - typeName(value) - ); - - return testStringCoercion(value); // throw (to help callers find troubleshooting comments) - } - } - } - - var ReactCurrentActQueue$3 = ReactSharedInternals.ReactCurrentActQueue; - function getThenablesFromState(state) { { var devState = state; @@ -9255,8 +9159,8 @@ to return true:wantsResponderID| | function noop() {} function trackUsedThenable(thenableState, thenable, index) { - if (ReactCurrentActQueue$3.current !== null) { - ReactCurrentActQueue$3.didUsePromise = true; + if (ReactSharedInternals.actQueue !== null) { + ReactSharedInternals.didUsePromise = true; } var trackedThenables = getThenablesFromState(thenableState); @@ -9479,7 +9383,6 @@ to return true:wantsResponderID| | var didWarnAboutMaps; var didWarnAboutGenerators; - var didWarnAboutStringRefs; var ownerHasKeyUseWarning; var ownerHasFunctionTypeWarning; var ownerHasSymbolTypeWarning; @@ -9489,7 +9392,6 @@ to return true:wantsResponderID| | { didWarnAboutMaps = false; didWarnAboutGenerators = false; - didWarnAboutStringRefs = {}; /** * Warn if there's no key explicitly set on dynamic arrays of children or * object keys are not valid. This allows us to keep track of children between @@ -9534,10 +9436,6 @@ to return true:wantsResponderID| | }; } - function isReactClass(type) { - return type.prototype && type.prototype.isReactComponent; - } - function unwrapThenable(thenable) { var index = thenableIndexCounter$1; thenableIndexCounter$1 += 1; @@ -9549,128 +9447,16 @@ to return true:wantsResponderID| | return trackUsedThenable(thenableState$1, thenable, index); } - function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef - ) { - { - checkPropStringCoercion(mixedRef, "ref"); - } - - var stringRef = "" + mixedRef; - var owner = element._owner; - - if (!owner) { - throw new Error( - "Element ref was specified as a string (" + - stringRef + - ") but no owner was set. This could happen for one of" + - " the following reasons:\n" + - "1. You may be adding a ref to a function component\n" + - "2. You may be adding a ref to a component that was not created inside a component's render method\n" + - "3. You have multiple copies of React loaded\n" + - "See https://react.dev/link/refs-must-have-owner for more information." - ); - } - - if (owner.tag !== ClassComponent) { - throw new Error( - "Function components cannot have string refs. " + - "We recommend using useRef() instead. " + - "Learn more about using refs safely here: " + - "https://react.dev/link/strict-mode-string-ref" - ); - } - - { - if ( - // Will already warn with "Function components cannot be given refs" - !(typeof element.type === "function" && !isReactClass(element.type)) - ) { - var componentName = - getComponentNameFromFiber(returnFiber) || "Component"; - - if (!didWarnAboutStringRefs[componentName]) { - error( - 'Component "%s" contains the string ref "%s". Support for string refs ' + - "will be removed in a future major release. We recommend using " + - "useRef() or createRef() instead. " + - "Learn more about using refs safely here: " + - "https://react.dev/link/strict-mode-string-ref", - componentName, - stringRef - ); - - didWarnAboutStringRefs[componentName] = true; - } - } - } - - var inst = owner.stateNode; - - if (!inst) { - throw new Error( - "Missing owner for string ref " + - stringRef + - ". This error is likely caused by a " + - "bug in React. Please file an issue." - ); - } // Check if previous string ref matches new string ref - - if ( - current !== null && - current.ref !== null && - typeof current.ref === "function" && - current.ref._stringRef === stringRef - ) { - // Reuse the existing string ref - var currentRef = current.ref; - return currentRef; - } // Create a new string ref - - var ref = function (value) { - var refs = inst.refs; - - if (value === null) { - delete refs[stringRef]; - } else { - refs[stringRef] = value; - } - }; - - ref._stringRef = stringRef; - return ref; - } - function coerceRef(returnFiber, current, workInProgress, element) { - var mixedRef; + var ref; { // Old behavior. - mixedRef = element.ref; - } - - var coercedRef; - - if ( - typeof mixedRef === "string" || - typeof mixedRef === "number" || - typeof mixedRef === "boolean" - ) { - coercedRef = convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef - ); - } else { - coercedRef = mixedRef; + ref = element.ref; } // TODO: If enableRefAsProp is on, we shouldn't use the `ref` field. We // should always read the ref from the prop. - workInProgress.ref = coercedRef; + workInProgress.ref = ref; } function throwOnInvalidObjectType(returnFiber, newChild) { @@ -11464,8 +11250,6 @@ to return true:wantsResponderID| | /* */ 8; - var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig; var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; var didWarnAboutUseWrappedInTryCatch; @@ -11629,8 +11413,8 @@ to return true:wantsResponderID| | didWarnAboutUseFormState.add(componentName); error( - "ReactDOM.useFormState has been deprecated and replaced by " + - "React.useActionState. Please update %s to use React.useActionState.", + "ReactDOM.useFormState has been renamed to React.useActionState. " + + "Please update %s to use React.useActionState.", componentName ); } @@ -11766,17 +11550,16 @@ to return true:wantsResponderID| | { if (current !== null && current.memoizedState !== null) { - ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV; + ReactSharedInternals.H = HooksDispatcherOnUpdateInDEV; } else if (hookTypesDev !== null) { // This dispatcher handles an edge case where a component is updating, // but no stateful hooks have been used. // We want to match the production code behavior (which will use HooksDispatcherOnMount), // but with the extra DEV validation to ensure hooks ordering hasn't changed. // This dispatcher does that. - ReactCurrentDispatcher$1.current = - HooksDispatcherOnMountWithHookTypesInDEV; + ReactSharedInternals.H = HooksDispatcherOnMountWithHookTypesInDEV; } else { - ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV; + ReactSharedInternals.H = HooksDispatcherOnMountInDEV; } } // In Strict Mode, during development, user functions are double invoked to // help detect side effects. The logic for how this is implemented for in @@ -11848,7 +11631,7 @@ to return true:wantsResponderID| | } // We can assume the previous dispatcher is always this one, since we set it // at the beginning of the render phase and there's no re-entrance. - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; // This check uses currentHook so that it works the same in DEV and prod bundles. + ReactSharedInternals.H = ContextOnlyDispatcher; // This check uses currentHook so that it works the same in DEV and prod bundles. // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles. var didRenderTooFewHooks = @@ -11999,7 +11782,7 @@ to return true:wantsResponderID| | hookTypesUpdateIndexDev = -1; } - ReactCurrentDispatcher$1.current = HooksDispatcherOnRerenderInDEV; + ReactSharedInternals.H = HooksDispatcherOnRerenderInDEV; children = Component(props, secondArg); } while (didScheduleRenderPhaseUpdateDuringThisPass); @@ -12029,18 +11812,34 @@ to return true:wantsResponderID| | throw new Error("Not implemented."); } - var dispatcher = ReactCurrentDispatcher$1.current; + var dispatcher = ReactSharedInternals.H; var _dispatcher$useState = dispatcher.useState(), maybeThenable = _dispatcher$useState[0]; + var nextState; + if (typeof maybeThenable.then === "function") { var thenable = maybeThenable; - return useThenable(thenable); + nextState = useThenable(thenable); } else { var status = maybeThenable; - return status; + nextState = status; + } // The "reset state" is an object. If it changes, that means something + // requested that we reset the form. + + var _dispatcher$useState2 = dispatcher.useState(), + nextResetState = _dispatcher$useState2[0]; + + var prevResetState = + currentHook !== null ? currentHook.memoizedState : null; + + if (prevResetState !== nextResetState) { + // Schedule a form reset + currentlyRenderingFiber$1.flags |= FormReset; } + + return nextState; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; // TODO: Don't need to reset the flags here, because they're reset in the @@ -12069,7 +11868,7 @@ to return true:wantsResponderID| | currentlyRenderingFiber$1 = null; // We can assume the previous dispatcher is always this one, since we set it // at the beginning of the render phase and there's no re-entrance. - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + ReactSharedInternals.H = ContextOnlyDispatcher; } function resetHooksOnUnwind(workInProgress) { if (didScheduleRenderPhaseUpdate) { @@ -12242,7 +12041,7 @@ to return true:wantsResponderID| | // time (perhaps because it threw). Subsequent Hook calls should use the // mount dispatcher. { - ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV; + ReactSharedInternals.H = HooksDispatcherOnMountInDEV; } } @@ -13051,14 +12850,14 @@ to return true:wantsResponderID| | var action = actionQueue.action; var prevState = actionQueue.state; // This is a fork of startTransition - var prevTransition = ReactCurrentBatchConfig$2.transition; + var prevTransition = ReactSharedInternals.T; var currentTransition = { _callbacks: new Set() }; - ReactCurrentBatchConfig$2.transition = currentTransition; + ReactSharedInternals.T = currentTransition; { - ReactCurrentBatchConfig$2.transition._updatedFibers = new Set(); + ReactSharedInternals.T._updatedFibers = new Set(); } // Optimistically update the pending state, similar to useTransition. // This will be reverted automatically when all actions are finished. @@ -13116,7 +12915,7 @@ to return true:wantsResponderID| | setState(rejectedThenable); finishRunningActionStateAction(actionQueue, setPendingState, setState); } finally { - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactSharedInternals.T = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { @@ -13702,7 +13501,7 @@ to return true:wantsResponderID| | setCurrentUpdatePriority( higherEventPriority(previousPriority, ContinuousEventPriority) ); - var prevTransition = ReactCurrentBatchConfig$2.transition; + var prevTransition = ReactSharedInternals.T; var currentTransition = { _callbacks: new Set() }; @@ -13714,16 +13513,16 @@ to return true:wantsResponderID| | // optimistic update anyway to make it less likely the behavior accidentally // diverges; for example, both an optimistic update and this one should // share the same lane. - ReactCurrentBatchConfig$2.transition = currentTransition; + ReactSharedInternals.T = currentTransition; dispatchOptimisticSetState(fiber, false, queue, pendingState); } else { - ReactCurrentBatchConfig$2.transition = null; + ReactSharedInternals.T = null; dispatchSetState(fiber, queue, pendingState); - ReactCurrentBatchConfig$2.transition = currentTransition; + ReactSharedInternals.T = currentTransition; } { - ReactCurrentBatchConfig$2.transition._updatedFibers = new Set(); + currentTransition._updatedFibers = new Set(); } try { @@ -13777,7 +13576,7 @@ to return true:wantsResponderID| | } } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactSharedInternals.T = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { @@ -14005,11 +13804,11 @@ to return true:wantsResponderID| | var lastRenderedReducer = queue.lastRenderedReducer; if (lastRenderedReducer !== null) { - var prevDispatcher; + var prevDispatcher = null; { - prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = + prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; } @@ -14040,7 +13839,7 @@ to return true:wantsResponderID| | // Suppress the error. It will throw again in the render phase. } finally { { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } } } @@ -14301,27 +14100,25 @@ to return true:wantsResponderID| | currentHookNameInDev = "useMemo"; mountHookTypesDev(); checkDepsAreArrayDev(deps); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -14332,14 +14129,13 @@ to return true:wantsResponderID| | useState: function (initialState) { currentHookNameInDev = "useState"; mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -14460,27 +14256,25 @@ to return true:wantsResponderID| | useMemo: function (create, deps) { currentHookNameInDev = "useMemo"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -14491,14 +14285,13 @@ to return true:wantsResponderID| | useState: function (initialState) { currentHookNameInDev = "useState"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -14612,27 +14405,25 @@ to return true:wantsResponderID| | useMemo: function (create, deps) { currentHookNameInDev = "useMemo"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -14643,14 +14434,13 @@ to return true:wantsResponderID| | useState: function (initialState) { currentHookNameInDev = "useState"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -14772,27 +14562,25 @@ to return true:wantsResponderID| | useMemo: function (create, deps) { currentHookNameInDev = "useMemo"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnRerenderInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnRerenderInDEV; try { return updateMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnRerenderInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnRerenderInDEV; try { return rerenderReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -14803,14 +14591,13 @@ to return true:wantsResponderID| | useState: function (initialState) { currentHookNameInDev = "useState"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnRerenderInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnRerenderInDEV; try { return rerenderState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -14943,28 +14730,26 @@ to return true:wantsResponderID| | currentHookNameInDev = "useMemo"; warnInvalidHookAccess(); mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; warnInvalidHookAccess(); mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -14977,14 +14762,13 @@ to return true:wantsResponderID| | currentHookNameInDev = "useState"; warnInvalidHookAccess(); mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -15121,28 +14905,26 @@ to return true:wantsResponderID| | currentHookNameInDev = "useMemo"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -15155,14 +14937,13 @@ to return true:wantsResponderID| | currentHookNameInDev = "useState"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -15299,28 +15080,26 @@ to return true:wantsResponderID| | currentHookNameInDev = "useMemo"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return rerenderReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -15333,14 +15112,13 @@ to return true:wantsResponderID| | currentHookNameInDev = "useState"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return rerenderState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -16768,7 +16546,7 @@ to return true:wantsResponderID| | // remove this extra check. alreadyResolvedDefaultProps ) { - var newProps = baseProps; // Resolve default props. Taken from old JSX runtime, where this used to live. + var newProps = baseProps; var defaultProps = Component.defaultProps; @@ -16777,11 +16555,15 @@ to return true:wantsResponderID| | // default props here in the reconciler, rather than in the JSX runtime. (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps) ) { - newProps = assign({}, newProps, baseProps); + // We may have already copied the props object above to remove ref. If so, + // we can modify that. Otherwise, copy the props object with Object.assign. + if (newProps === baseProps) { + newProps = assign({}, newProps, baseProps); + } // Taken from old JSX runtime, where this used to live. - for (var propName in defaultProps) { - if (newProps[propName] === undefined) { - newProps[propName] = defaultProps[propName]; + for (var _propName in defaultProps) { + if (newProps[_propName] === undefined) { + newProps[_propName] = defaultProps[_propName]; } } } @@ -16852,8 +16634,6 @@ to return true:wantsResponderID| | console["error"](error); }; - var ReactCurrentActQueue$2 = ReactSharedInternals.ReactCurrentActQueue; // Side-channel since I'm not sure we want to make this part of the public API - var componentName = null; var errorBoundaryName = null; function defaultOnUncaughtError(error, errorInfo) { @@ -16918,10 +16698,10 @@ to return true:wantsResponderID| | var error = errorInfo.value; - if (true && ReactCurrentActQueue$2.current !== null) { + if (true && ReactSharedInternals.actQueue !== null) { // For uncaught errors inside act, we track them on the act and then // rethrow them into the test. - ReactCurrentActQueue$2.thrownErrors.push(error); + ReactSharedInternals.thrownErrors.push(error); return; } @@ -17463,7 +17243,6 @@ to return true:wantsResponderID| | return false; } - var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner; // A special exception that's used to unwind the stack when an update flows // into a dehydrated boundary. var SelectiveHydrationException = new Error( @@ -17582,7 +17361,7 @@ to return true:wantsResponderID| | } { - ReactCurrentOwner$2.current = workInProgress; + ReactSharedInternals.owner = workInProgress; setIsRendering(true); nextChildren = renderWithHooks( current, @@ -18094,7 +17873,27 @@ to return true:wantsResponderID| | } if (current === null || current.ref !== ref) { - // Schedule a Ref effect + if (current !== null) { + var oldRef = current.ref; + var newRef = ref; + + if ( + typeof oldRef === "function" && + typeof newRef === "function" && + typeof oldRef.__stringRef === "string" && + oldRef.__stringRef === newRef.__stringRef && + oldRef.__stringRefType === newRef.__stringRefType && + oldRef.__stringRefOwner === newRef.__stringRefOwner + ) { + // Although this is a different callback, it represents the same + // string ref. To avoid breaking old Meta code that relies on string + // refs only being attached once, reuse the old ref. This will + // prevent us from detaching and reattaching the ref on each update. + workInProgress.ref = oldRef; + return; + } + } // Schedule a Ref effect + workInProgress.flags |= Ref | RefStatic; } } @@ -18177,7 +17976,7 @@ to return true:wantsResponderID| | } { - ReactCurrentOwner$2.current = workInProgress; + ReactSharedInternals.owner = workInProgress; setIsRendering(true); nextChildren = renderWithHooks( current, @@ -18400,7 +18199,10 @@ to return true:wantsResponderID| | var instance = workInProgress.stateNode; // Rerender - ReactCurrentOwner$2.current = workInProgress; + { + ReactSharedInternals.owner = workInProgress; + } + var nextChildren; if ( @@ -20138,7 +19940,7 @@ to return true:wantsResponderID| | var newChildren; { - ReactCurrentOwner$2.current = workInProgress; + ReactSharedInternals.owner = workInProgress; setIsRendering(true); newChildren = render(newValue); setIsRendering(false); @@ -21218,10 +21020,8 @@ to return true:wantsResponderID| | popProvider(CacheContext, workInProgress); } - var ReactCurrentBatchConfig$1 = - ReactSharedInternals.ReactCurrentBatchConfig; function requestCurrentTransition() { - var transition = ReactCurrentBatchConfig$1.transition; + var transition = ReactSharedInternals.T; if (transition !== null) { // Whenever a transition update is scheduled, register a callback on the @@ -22874,7 +22674,7 @@ to return true:wantsResponderID| | // Allows us to avoid traversing the return path to find the nearest Offscreen ancestor. var offscreenSubtreeIsHidden = false; - var offscreenSubtreeWasHidden = false; + var offscreenSubtreeWasHidden = false; // Used to track if a form needs to be reset at the end of the mutation phase. var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set; var nextEffect = null; // Used for Profiling builds to track updaters. @@ -26034,7 +25834,6 @@ to return true:wantsResponderID| | symbolFor("selector.text"); } - var ReactCurrentActQueue$1 = ReactSharedInternals.ReactCurrentActQueue; function isLegacyActEnvironment(fiber) { { // Legacy mode. We preserve the behavior of React 17's act. It assumes an @@ -26057,7 +25856,7 @@ to return true:wantsResponderID| | if ( !isReactActEnvironmentGlobal && - ReactCurrentActQueue$1.current !== null + ReactSharedInternals.actQueue !== null ) { // TODO: Include link to relevant documentation page. error( @@ -26071,11 +25870,6 @@ to return true:wantsResponderID| | } var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, - ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, - ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; var NoContext = /* */ 0; @@ -26226,13 +26020,11 @@ to return true:wantsResponderID| | if (transition !== null) { { - var batchConfigTransition = ReactCurrentBatchConfig.transition; - - if (!batchConfigTransition._updatedFibers) { - batchConfigTransition._updatedFibers = new Set(); + if (!transition._updatedFibers) { + transition._updatedFibers = new Set(); } - batchConfigTransition._updatedFibers.add(fiber); + transition._updatedFibers.add(fiber); } var actionScopeLane = peekEntangledActionLane(); @@ -26241,26 +26033,9 @@ to return true:wantsResponderID| | : // is the first update in that scope. Either way, we need to get a // fresh transition lane. requestTransitionLane(); - } // Updates originating inside certain React methods, like flushSync, have - // their priority set by tracking it with a context variable. - // - // The opaque type returned by the host config is internally a lane, so we can - // use that directly. - // TODO: Move this type conversion to the event priority module. + } - var updateLane = getCurrentUpdatePriority(); - - if (updateLane !== NoLane) { - return updateLane; - } // This update originated outside React. Ask the host environment for an - // appropriate priority, based on the type of event. - // - // The opaque type returned by the host config is internally a lane, so we can - // use that directly. - // TODO: Move this type conversion to the event priority module. - - var eventLane = getCurrentEventPriority(); - return eventLane; + return eventPriorityToLane(resolveUpdatePriority()); } function requestRetryLane(fiber) { @@ -26403,7 +26178,7 @@ to return true:wantsResponderID| | !disableLegacyMode && (fiber.mode & ConcurrentMode) === NoMode ) { - if (ReactCurrentActQueue.isBatchingLegacy); + if (ReactSharedInternals.isBatchingLegacy); else { // Flush the synchronous work now, unless we're already working or inside // a batch. This is intentionally inside scheduleUpdateOnFiber instead of @@ -26505,20 +26280,31 @@ to return true:wantsResponderID| | } // Check if something threw if (exitStatus === RootErrored) { - var originallyAttemptedLanes = lanes; + var lanesThatJustErrored = lanes; var errorRetryLanes = getLanesToRetrySynchronouslyOnError( root, - originallyAttemptedLanes + lanesThatJustErrored ); if (errorRetryLanes !== NoLanes) { lanes = errorRetryLanes; exitStatus = recoverFromConcurrentError( root, - originallyAttemptedLanes, + lanesThatJustErrored, errorRetryLanes ); - renderWasConcurrent = false; + renderWasConcurrent = false; // Need to check the exit status again. + + if (exitStatus !== RootErrored) { + // The root did not error this time. Restart the exit algorithm + // from the beginning. + // TODO: Refactor the exit algorithm to be less confusing. Maybe + // more branches + recursion instead of a loop. I think the only + // thing that causes it to be a loop is the RootDidNotComplete + // check. If that's true, then we don't need a loop/recursion + // at all. + continue; + } } } @@ -26972,7 +26758,7 @@ to return true:wantsResponderID| | if ( executionContext === NoContext && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode. - !ReactCurrentActQueue.isBatchingLegacy + !ReactSharedInternals.isBatchingLegacy ) { resetRenderTimer(); flushSyncWorkOnLegacyRootsOnly(); @@ -26980,51 +26766,15 @@ to return true:wantsResponderID| | } } } - // Warning, this opts-out of checking the function body. - // eslint-disable-next-line no-unused-vars - // eslint-disable-next-line no-redeclare - // eslint-disable-next-line no-redeclare + // Returns whether the the call was during a render or not - function flushSync(fn) { - // In legacy mode, we flush pending passive effects at the beginning of the - // next event, not at the end of the previous one. - if ( - rootWithPendingPassiveEffects !== null && - !disableLegacyMode && - rootWithPendingPassiveEffects.tag === LegacyRoot && - (executionContext & (RenderContext | CommitContext)) === NoContext - ) { - flushPassiveEffects(); + function flushSyncWork() { + if ((executionContext & (RenderContext | CommitContext)) === NoContext) { + flushSyncWorkOnAllRoots(); + return false; } - var prevExecutionContext = executionContext; - executionContext |= BatchedContext; - var prevTransition = ReactCurrentBatchConfig.transition; - var previousPriority = getCurrentUpdatePriority(); - - try { - ReactCurrentBatchConfig.transition = null; - setCurrentUpdatePriority(DiscreteEventPriority); - - if (fn) { - return fn(); - } else { - return undefined; - } - } finally { - setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig.transition = prevTransition; - executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch. - // Note that this will happen even if batchedUpdates is higher up - // the stack. - - if ( - (executionContext & (RenderContext | CommitContext)) === - NoContext - ) { - flushSyncWorkOnAllRoots(); - } - } + return true; } // hidden subtree. The stack logic is managed there because that's the only // place that ever modifies it. Which module it lives in doesn't matter for @@ -27138,7 +26888,10 @@ to return true:wantsResponderID| | // when React is executing user code. resetHooksAfterThrow(); resetCurrentFiber(); - ReactCurrentOwner$1.current = null; + + { + ReactSharedInternals.owner = null; + } if (thrownValue === SuspenseException) { // This is a special type of exception used for Suspense. For historical @@ -27290,8 +27043,8 @@ to return true:wantsResponderID| | } function pushDispatcher(container) { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = ContextOnlyDispatcher; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = ContextOnlyDispatcher; if (prevDispatcher === null) { // The React isomorphic package does not include a default dispatcher. @@ -27304,20 +27057,20 @@ to return true:wantsResponderID| | } function popDispatcher(prevDispatcher) { - ReactCurrentDispatcher.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } function pushCacheDispatcher() { { - var prevCacheDispatcher = ReactCurrentCache.current; - ReactCurrentCache.current = DefaultCacheDispatcher; + var prevCacheDispatcher = ReactSharedInternals.C; + ReactSharedInternals.C = DefaultCacheDispatcher; return prevCacheDispatcher; } } function popCacheDispatcher(prevCacheDispatcher) { { - ReactCurrentCache.current = prevCacheDispatcher; + ReactSharedInternals.C = prevCacheDispatcher; } } @@ -27726,7 +27479,7 @@ to return true:wantsResponderID| | } } - if (true && ReactCurrentActQueue.current !== null) { + if (true && ReactSharedInternals.actQueue !== null) { // `act` special case: If we're inside an `act` scope, don't consult // `shouldYield`. Always keep working until the render is complete. // This is not just an optimization: in a unit test environment, we @@ -27805,7 +27558,9 @@ to return true:wantsResponderID| | workInProgress = next; } - ReactCurrentOwner$1.current = null; + { + ReactSharedInternals.owner = null; + } } function replaySuspendedUnitOfWork(unitOfWork) { @@ -27933,7 +27688,9 @@ to return true:wantsResponderID| | workInProgress = next; } - ReactCurrentOwner$1.current = null; + { + ReactSharedInternals.owner = null; + } } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { @@ -28143,12 +27900,12 @@ to return true:wantsResponderID| | ) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. + var prevTransition = ReactSharedInternals.T; var previousUpdateLanePriority = getCurrentUpdatePriority(); - var prevTransition = ReactCurrentBatchConfig.transition; try { - ReactCurrentBatchConfig.transition = null; setCurrentUpdatePriority(DiscreteEventPriority); + ReactSharedInternals.T = null; commitRootImpl( root, recoverableErrors, @@ -28158,7 +27915,7 @@ to return true:wantsResponderID| | spawnedLane ); } finally { - ReactCurrentBatchConfig.transition = prevTransition; + ReactSharedInternals.T = prevTransition; setCurrentUpdatePriority(previousUpdateLanePriority); } @@ -28290,14 +28047,16 @@ to return true:wantsResponderID| | NoFlags$1; if (subtreeHasEffects || rootHasEffect) { - var prevTransition = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = null; + var prevTransition = ReactSharedInternals.T; + ReactSharedInternals.T = null; var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(DiscreteEventPriority); var prevExecutionContext = executionContext; executionContext |= CommitContext; // Reset this to null before calling lifecycles - ReactCurrentOwner$1.current = null; // The commit phase is broken into several sub-phases. We do a separate pass + { + ReactSharedInternals.owner = null; + } // The commit phase is broken into several sub-phases. We do a separate pass // of the effect list for each phase: all mutation effects come before all // layout effects, and so on. // The first phase a "before mutation" phase. We use this phase to read the @@ -28334,7 +28093,7 @@ to return true:wantsResponderID| | executionContext = prevExecutionContext; // Reset the priority to the previous non-sync value. setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig.transition = prevTransition; + ReactSharedInternals.T = prevTransition; } else { // No effects. root.current = finishedWork; // Measure these anyway so the flamegraph explicitly shows that there were @@ -28518,16 +28277,16 @@ to return true:wantsResponderID| | pendingPassiveEffectsRemainingLanes = NoLanes; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes); var priority = lowerEventPriority(DefaultEventPriority, renderPriority); - var prevTransition = ReactCurrentBatchConfig.transition; + var prevTransition = ReactSharedInternals.T; var previousPriority = getCurrentUpdatePriority(); try { - ReactCurrentBatchConfig.transition = null; setCurrentUpdatePriority(priority); + ReactSharedInternals.T = null; return flushPassiveEffectsImpl(); } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig.transition = prevTransition; // Once passive effects have run for the tree - giving components a + ReactSharedInternals.T = prevTransition; // Once passive effects have run for the tree - giving components a // chance to retain cache instances they use - release the pooled // cache at the root (if there is one) @@ -29250,7 +29009,7 @@ to return true:wantsResponderID| | { // If we're currently inside an `act` scope, bypass Scheduler and push to // the `act` queue instead. - var actQueue = ReactCurrentActQueue.current; + var actQueue = ReactSharedInternals.actQueue; if (actQueue !== null) { actQueue.push(callback); @@ -29263,7 +29022,7 @@ to return true:wantsResponderID| | function shouldForceFlushFallbacksInDEV() { // Never force flush in production. This function should get stripped out. - return ReactCurrentActQueue.current !== null; + return ReactSharedInternals.actQueue !== null; } function warnIfUpdatesNotWrappedWithActDEV(fiber) { @@ -29297,7 +29056,7 @@ to return true:wantsResponderID| | } } - if (ReactCurrentActQueue.current === null) { + if (ReactSharedInternals.actQueue === null) { var previousFiber = current; try { @@ -29332,7 +29091,7 @@ to return true:wantsResponderID| | if ( root.tag !== LegacyRoot && isConcurrentActEnvironment() && - ReactCurrentActQueue.current === null + ReactSharedInternals.actQueue === null ) { error( "A suspended resource finished loading inside a test, but the event " + @@ -29541,13 +29300,12 @@ to return true:wantsResponderID| | var staleFamilies = update.staleFamilies, updatedFamilies = update.updatedFamilies; flushPassiveEffects(); - flushSync(function () { - scheduleFibersWithFamiliesRecursively( - root.current, - updatedFamilies, - staleFamilies - ); - }); + scheduleFibersWithFamiliesRecursively( + root.current, + updatedFamilies, + staleFamilies + ); + flushSyncWork(); } }; var scheduleRoot = function (root, element) { @@ -29559,10 +29317,8 @@ to return true:wantsResponderID| | return; } - flushPassiveEffects(); - flushSync(function () { - updateContainer(element, root, null, null); - }); + updateContainerSync(element, root, null, null); + flushSyncWork(); } }; @@ -30262,7 +30018,7 @@ to return true:wantsResponderID| | "named imports."; } - var ownerName = owner ? getComponentNameFromFiber(owner) : null; + var ownerName = owner ? getComponentNameFromOwner(owner) : null; if (ownerName) { info += "\n\nCheck the render method of `" + ownerName + "`."; @@ -30530,7 +30286,81 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "19.0.0-canary-966bda36"; + var ReactVersion = "19.0.0-canary-7ae6f53c"; + + /* + * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol + * and Temporal.* types. See https://github.com/facebook/react/pull/22064. + * + * The functions in this module will throw an easier-to-understand, + * easier-to-debug exception with a clear errors message message explaining the + * problem. (Instead of a confusing exception thrown inside the implementation + * of the `value` object). + */ + // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. + function typeName(value) { + { + // toStringTag is needed for namespaced types like Temporal.Instant + var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; + var type = + (hasToStringTag && value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; // $FlowFixMe[incompatible-return] + + return type; + } + } // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. + + function willCoercionThrow(value) { + { + try { + testStringCoercion(value); + return false; + } catch (e) { + return true; + } + } + } + + function testStringCoercion(value) { + // If you ended up here by following an exception call stack, here's what's + // happened: you supplied an object or symbol value to React (as a prop, key, + // DOM attribute, CSS property, string ref, etc.) and when React tried to + // coerce it to a string using `'' + value`, an exception was thrown. + // + // The most common types that will cause this exception are `Symbol` instances + // and Temporal objects like `Temporal.Instant`. But any object that has a + // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this + // exception. (Library authors do this to prevent users from using built-in + // numeric operators like `+` or comparison operators like `>=` because custom + // methods are needed to perform accurate arithmetic or comparison.) + // + // To fix the problem, coerce this object or symbol value to a string before + // passing it to React. The most reliable way is usually `String(value)`. + // + // To find which value is throwing, check the browser or debugger console. + // Before this exception was thrown, there should be `console.error` output + // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the + // problem and how that type was used: key, atrribute, input value prop, etc. + // In most cases, this console output also shows the component and its + // ancestor components where the exception happened. + // + // eslint-disable-next-line react-internal/safe-string-coercion + return "" + value; + } + function checkKeyStringCoercion(value) { + { + if (willCoercionThrow(value)) { + error( + "The provided key is an unsupported type %s." + + " This value must be coerced to a string before using it here.", + typeName(value) + ); + + return testStringCoercion(value); // throw (to help callers find troubleshooting comments) + } + } + } function createPortal$1( children, @@ -30686,13 +30516,52 @@ to return true:wantsResponderID| | ); } function updateContainer(element, container, parentComponent, callback) { + var current = container.current; + var lane = requestUpdateLane(current); + updateContainerImpl( + current, + lane, + element, + container, + parentComponent, + callback + ); + return lane; + } + function updateContainerSync( + element, + container, + parentComponent, + callback + ) { + if (container.tag === LegacyRoot) { + flushPassiveEffects(); + } + + var current = container.current; + updateContainerImpl( + current, + SyncLane, + element, + container, + parentComponent, + callback + ); + return SyncLane; + } + + function updateContainerImpl( + rootFiber, + lane, + element, + container, + parentComponent, + callback + ) { { onScheduleRoot(container, element); } - var current$1 = container.current; - var lane = requestUpdateLane(current$1); - { markRenderScheduled(lane); } @@ -30741,14 +30610,12 @@ to return true:wantsResponderID| | update.callback = callback; } - var root = enqueueUpdate(current$1, update, lane); + var root = enqueueUpdate(rootFiber, update, lane); if (root !== null) { - scheduleUpdateOnFiber(root, current$1, lane); - entangleTransitions(root, current$1, lane); + scheduleUpdateOnFiber(root, rootFiber, lane); + entangleTransitions(root, rootFiber, lane); } - - return lane; } function getPublicRootInstance(container) { var containerFiber = container.current; @@ -31038,7 +30905,6 @@ to return true:wantsResponderID| | function injectIntoDevTools(devToolsConfig) { var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; return injectInternals({ bundleType: devToolsConfig.bundleType, version: devToolsConfig.version, @@ -31053,7 +30919,7 @@ to return true:wantsResponderID| | setErrorHandler: setErrorHandler, setSuspenseHandler: setSuspenseHandler, scheduleUpdate: scheduleUpdate, - currentDispatcherRef: ReactCurrentDispatcher, + currentDispatcherRef: ReactSharedInternals, findHostInstanceByFiber: findHostInstanceByFiber, findFiberByHostInstance: findFiberByHostInstance || emptyFindFiberByHostInstance, @@ -31076,10 +30942,9 @@ to return true:wantsResponderID| | return instanceCache.get(tag) || null; } - var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; function findHostInstance_DEPRECATED(componentOrHandle) { { - var owner = ReactCurrentOwner.current; + var owner = ReactSharedInternals.owner; if (owner !== null && owner.stateNode !== null) { if (!owner.stateNode._warnedAboutRefsInRender) { @@ -31130,7 +30995,7 @@ to return true:wantsResponderID| | } function findNodeHandle(componentOrHandle) { { - var owner = ReactCurrentOwner.current; + var owner = ReactSharedInternals.owner; if (owner !== null && owner.stateNode !== null) { if (!owner.stateNode._warnedAboutRefsInRender) { @@ -31388,13 +31253,23 @@ to return true:wantsResponderID| | } var fiber = findCurrentFiberUsingSlowPath(closestInstance); + + if (fiber === null) { + // Might not be currently mounted. + return { + hierarchy: [], + props: emptyObject, + selectedIndex: null, + componentStack: "" + }; + } + var fiberHierarchy = getOwnerHierarchy(fiber); var instance = lastNonHostInstance(fiberHierarchy); var hierarchy = createHierarchy(fiberHierarchy); var props = getHostProps(instance); var selectedIndex = fiberHierarchy.indexOf(instance); - var componentStack = - fiber !== null ? getStackByFiberInDevAndProd(fiber) : ""; + var componentStack = getStackByFiberInDevAndProd(fiber); return { closestInstance: instance, hierarchy: hierarchy, @@ -31421,13 +31296,15 @@ to return true:wantsResponderID| | } return hierarchy[0]; - } // $FlowFixMe[missing-local-annot] + } function traverseOwnerTreeUp(hierarchy, instance) { { - if (instance) { - hierarchy.unshift(instance); - traverseOwnerTreeUp(hierarchy, instance._debugOwner); + hierarchy.unshift(instance); + var owner = instance._debugOwner; + + if (owner != null && typeof owner.tag === "number") { + traverseOwnerTreeUp(hierarchy, owner); } } } diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js index 4fd68709be..484f185e34 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<224bcce6fb232bb63170272f6821f359>> + * @generated SignedSource<<4ab04a84cd69ab2bd7c9b727f4fa1612>> */ "use strict"; @@ -893,7 +893,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_248 = { +var injectedNamesToPlugins$jscomp$inline_247 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -939,32 +939,32 @@ var injectedNamesToPlugins$jscomp$inline_248 = { } } }, - isOrderingDirty$jscomp$inline_249 = !1, - pluginName$jscomp$inline_250; -for (pluginName$jscomp$inline_250 in injectedNamesToPlugins$jscomp$inline_248) + isOrderingDirty$jscomp$inline_248 = !1, + pluginName$jscomp$inline_249; +for (pluginName$jscomp$inline_249 in injectedNamesToPlugins$jscomp$inline_247) if ( - injectedNamesToPlugins$jscomp$inline_248.hasOwnProperty( - pluginName$jscomp$inline_250 + injectedNamesToPlugins$jscomp$inline_247.hasOwnProperty( + pluginName$jscomp$inline_249 ) ) { - var pluginModule$jscomp$inline_251 = - injectedNamesToPlugins$jscomp$inline_248[pluginName$jscomp$inline_250]; + var pluginModule$jscomp$inline_250 = + injectedNamesToPlugins$jscomp$inline_247[pluginName$jscomp$inline_249]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_250) || - namesToPlugins[pluginName$jscomp$inline_250] !== - pluginModule$jscomp$inline_251 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_249) || + namesToPlugins[pluginName$jscomp$inline_249] !== + pluginModule$jscomp$inline_250 ) { - if (namesToPlugins[pluginName$jscomp$inline_250]) + if (namesToPlugins[pluginName$jscomp$inline_249]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_250 + "`.") + (pluginName$jscomp$inline_249 + "`.") ); - namesToPlugins[pluginName$jscomp$inline_250] = - pluginModule$jscomp$inline_251; - isOrderingDirty$jscomp$inline_249 = !0; + namesToPlugins[pluginName$jscomp$inline_249] = + pluginModule$jscomp$inline_250; + isOrderingDirty$jscomp$inline_248 = !0; } } -isOrderingDirty$jscomp$inline_249 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_248 && recomputePluginOrdering(); var emptyObject$1 = {}, removedKeys = null, removedKeyCount = 0, @@ -1292,7 +1292,7 @@ var alwaysThrottleRetries = dynamicFlagsUntyped.alwaysThrottleRetries, log$1 = Scheduler.log, unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue, ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererID = null, injectedHook = null; function onCommitRoot(root) { @@ -1527,7 +1527,6 @@ function markRootEntangled(root, entangledLanes) { rootEntangledLanes &= ~lane; } } -var currentUpdatePriority = 0; function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes @@ -1586,6 +1585,19 @@ function getPublicInstance(instance) { ? instance : null; } +var currentUpdatePriority = 0; +function resolveUpdatePriority() { + if (0 !== currentUpdatePriority) return currentUpdatePriority; + var currentEventPriority = fabricGetCurrentEventPriority + ? fabricGetCurrentEventPriority() + : null; + if (null != currentEventPriority) + switch (currentEventPriority) { + case FabricDiscretePriority: + return 2; + } + return 32; +} var scheduleTimeout = setTimeout, cancelTimeout = clearTimeout; function cloneHiddenInstance(instance) { @@ -2006,7 +2018,7 @@ function describeBuiltInComponentFrame(name) { } return "\n" + prefix + name; } - return describeComponentFrame(name, null); + return "\n in " + (name || "Unknown"); } var reentry = !1; function describeNativeComponentFrame(fn, construct) { @@ -2140,16 +2152,11 @@ function describeNativeComponentFrame(fn, construct) { ? describeBuiltInComponentFrame(previousPrepareStackTrace) : ""; } -function describeComponentFrame(name, ownerName) { - var sourceInfo = ""; - ownerName && (sourceInfo = " (created by " + ownerName + ")"); - return "\n in " + (name || "Unknown") + sourceInfo; -} function describeFunctionComponentFrame(fn) { return enableComponentStackLocations ? describeNativeComponentFrame(fn, !1) : fn - ? describeComponentFrame(fn.displayName || fn.name || null, null) + ? "\n in " + (fn.displayName || fn.name || "Unknown") : ""; } function describeFiber(fiber) { @@ -2900,55 +2907,6 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef -) { - function ref(value) { - var refs = inst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - } - var stringRef = "" + mixedRef; - returnFiber = element._owner; - if (!returnFiber) - throw Error( - "Element ref was specified as a string (" + - stringRef + - ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://react.dev/link/refs-must-have-owner for more information." - ); - if (1 !== returnFiber.tag) - throw Error( - "Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref" - ); - var inst = returnFiber.stateNode; - if (!inst) - throw Error( - "Missing owner for string ref " + - stringRef + - ". This error is likely caused by a bug in React. Please file an issue." - ); - if ( - null !== current && - null !== current.ref && - "function" === typeof current.ref && - current.ref._stringRef === stringRef - ) - return current.ref; - ref._stringRef = stringRef; - return ref; -} -function coerceRef(returnFiber, current, workInProgress, element) { - var mixedRef = element.ref; - returnFiber = - "string" === typeof mixedRef || - "number" === typeof mixedRef || - "boolean" === typeof mixedRef - ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) - : mixedRef; - workInProgress.ref = returnFiber; -} function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); throw Error( @@ -3044,12 +3002,12 @@ function createChildReconciler(shouldTrackSideEffects) { resolveLazy(elementType) === current.type)) ) return ( - (lanes = useFiber(current, element.props)), - coerceRef(returnFiber, current, lanes, element), - (lanes.return = returnFiber), - lanes + (current = useFiber(current, element.props)), + (current.ref = element.ref), + (current.return = returnFiber), + current ); - lanes = createFiberFromTypeAndProps( + current = createFiberFromTypeAndProps( element.type, element.key, element.props, @@ -3057,9 +3015,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - coerceRef(returnFiber, current, lanes, element); - lanes.return = returnFiber; - return lanes; + current.ref = element.ref; + current.return = returnFiber; + return current; } function updatePortal(returnFiber, current, portal, lanes) { if ( @@ -3120,7 +3078,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, null, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), lanes ); @@ -3460,52 +3418,54 @@ function createChildReconciler(shouldTrackSideEffects) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: a: { - for ( - var key = newChild.key, child = currentFirstChild; - null !== child; - - ) { - if (child.key === key) { + for (var key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) { key = newChild.type; if (key === REACT_FRAGMENT_TYPE) { - if (7 === child.tag) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber( - child, + if (7 === currentFirstChild.tag) { + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber( + currentFirstChild, newChild.props.children ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes.return = returnFiber; + returnFiber = lanes; break a; } } else if ( - child.elementType === key || + currentFirstChild.elementType === key || ("object" === typeof key && null !== key && key.$$typeof === REACT_LAZY_TYPE && - resolveLazy(key) === child.type) + resolveLazy(key) === currentFirstChild.type) ) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber(child, newChild.props); - coerceRef(returnFiber, child, currentFirstChild, newChild); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber(currentFirstChild, newChild.props); + lanes.ref = newChild.ref; + lanes.return = returnFiber; + returnFiber = lanes; break a; } - deleteRemainingChildren(returnFiber, child); + deleteRemainingChildren(returnFiber, currentFirstChild); break; - } else deleteChild(returnFiber, child); - child = child.sibling; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; } newChild.type === REACT_FRAGMENT_TYPE - ? ((currentFirstChild = createFiberFromFragment( + ? ((lanes = createFiberFromFragment( newChild.props.children, returnFiber.mode, lanes, newChild.key )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes.return = returnFiber), + (returnFiber = lanes)) : ((lanes = createFiberFromTypeAndProps( newChild.type, newChild.key, @@ -3514,15 +3474,15 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, currentFirstChild, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), (returnFiber = lanes)); } return placeSingleChild(returnFiber); case REACT_PORTAL_TYPE: a: { - for (child = newChild.key; null !== currentFirstChild; ) { - if (currentFirstChild.key === child) + for (key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) if ( 4 === currentFirstChild.tag && currentFirstChild.stateNode.containerInfo === @@ -3534,12 +3494,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber, currentFirstChild.sibling ); - currentFirstChild = useFiber( - currentFirstChild, - newChild.children || [] - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = useFiber(currentFirstChild, newChild.children || []); + lanes.return = returnFiber; + returnFiber = lanes; break a; } else { deleteRemainingChildren(returnFiber, currentFirstChild); @@ -3548,22 +3505,18 @@ function createChildReconciler(shouldTrackSideEffects) { else deleteChild(returnFiber, currentFirstChild); currentFirstChild = currentFirstChild.sibling; } - currentFirstChild = createFiberFromPortal( - newChild, - returnFiber.mode, - lanes - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = createFiberFromPortal(newChild, returnFiber.mode, lanes); + lanes.return = returnFiber; + returnFiber = lanes; } return placeSingleChild(returnFiber); case REACT_LAZY_TYPE: return ( - (child = newChild._init), + (key = newChild._init), reconcileChildFibersImpl( returnFiber, currentFirstChild, - child(newChild._payload), + key(newChild._payload), lanes ) ); @@ -3604,17 +3557,13 @@ function createChildReconciler(shouldTrackSideEffects) { ? ((newChild = "" + newChild), null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), - (currentFirstChild = useFiber(currentFirstChild, newChild)), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes = useFiber(currentFirstChild, newChild)), + (lanes.return = returnFiber), + (returnFiber = lanes)) : (deleteRemainingChildren(returnFiber, currentFirstChild), - (currentFirstChild = createFiberFromText( - newChild, - returnFiber.mode, - lanes - )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)), + (lanes = createFiberFromText(newChild, returnFiber.mode, lanes)), + (lanes.return = returnFiber), + (returnFiber = lanes)), placeSingleChild(returnFiber)) : deleteRemainingChildren(returnFiber, currentFirstChild); } @@ -3707,9 +3656,7 @@ function findFirstSuspended(row) { } return null; } -var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, - renderLanes = 0, +var renderLanes = 0, currentlyRenderingFiber$1 = null, currentHook = null, workInProgressHook = null, @@ -3743,7 +3690,7 @@ function renderWithHooks( workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; - ReactCurrentDispatcher$1.current = + ReactSharedInternals.H = null === current || null === current.memoizedState ? HooksDispatcherOnMount : HooksDispatcherOnUpdate; @@ -3761,7 +3708,7 @@ function renderWithHooks( return current; } function finishRenderingHooks() { - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + ReactSharedInternals.H = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; @@ -3787,17 +3734,23 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { numberOfReRenders += 1; workInProgressHook = currentHook = null; workInProgress.updateQueue = null; - ReactCurrentDispatcher$1.current = HooksDispatcherOnRerender; + ReactSharedInternals.H = HooksDispatcherOnRerender; var children = Component(props, secondArg); } while (didScheduleRenderPhaseUpdateDuringThisPass); return children; } function TransitionAwareHostComponent() { if (!enableAsyncActions) throw Error("Not implemented."); - var maybeThenable = ReactCurrentDispatcher$1.current.useState()[0]; - return "function" === typeof maybeThenable.then - ? useThenable(maybeThenable) - : maybeThenable; + var dispatcher = ReactSharedInternals.H, + maybeThenable = dispatcher.useState()[0]; + maybeThenable = + "function" === typeof maybeThenable.then + ? useThenable(maybeThenable) + : maybeThenable; + dispatcher = dispatcher.useState()[0]; + (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher && + (currentlyRenderingFiber$1.flags |= 1024); + return maybeThenable; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; @@ -3885,7 +3838,7 @@ function useThenable(thenable) { (null === workInProgressHook ? null === currentlyRenderingFiber$1.memoizedState : null === workInProgressHook.next) && - (ReactCurrentDispatcher$1.current = HooksDispatcherOnMount); + (ReactSharedInternals.H = HooksDispatcherOnMount); return thenable; } function use(usable) { @@ -4219,9 +4172,9 @@ function dispatchActionState( function runActionStateAction(actionQueue, setPendingState, setState, payload) { var action = actionQueue.action, prevState = actionQueue.state, - prevTransition = ReactCurrentBatchConfig$2.transition, + prevTransition = ReactSharedInternals.T, currentTransition = { _callbacks: new Set() }; - ReactCurrentBatchConfig$2.transition = currentTransition; + ReactSharedInternals.T = currentTransition; setPendingState(!0); try { var returnValue = action(prevState, payload); @@ -4254,7 +4207,7 @@ function runActionStateAction(actionQueue, setPendingState, setState, payload) { setState({ then: function () {}, status: "rejected", reason: error }), finishRunningActionStateAction(actionQueue, setPendingState, setState); } finally { - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactSharedInternals.T = prevTransition; } } function finishRunningActionStateAction( @@ -4494,14 +4447,14 @@ function startTransition(fiber, queue, pendingState, finishedState, callback) { var previousPriority = currentUpdatePriority; currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; - var prevTransition = ReactCurrentBatchConfig$2.transition, + var prevTransition = ReactSharedInternals.T, currentTransition = { _callbacks: new Set() }; enableAsyncActions - ? ((ReactCurrentBatchConfig$2.transition = currentTransition), + ? ((ReactSharedInternals.T = currentTransition), dispatchOptimisticSetState(fiber, !1, queue, pendingState)) - : ((ReactCurrentBatchConfig$2.transition = null), + : ((ReactSharedInternals.T = null), dispatchSetState(fiber, queue, pendingState), - (ReactCurrentBatchConfig$2.transition = currentTransition)); + (ReactSharedInternals.T = currentTransition)); try { if (enableAsyncActions) { var returnValue = callback(); @@ -4528,7 +4481,7 @@ function startTransition(fiber, queue, pendingState, finishedState, callback) { else throw error; } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$2.transition = prevTransition); + (ReactSharedInternals.T = prevTransition); } } function useHostTransitionStatus() { @@ -5081,7 +5034,7 @@ function resolveClassComponentProps( (Component = Component.defaultProps) && (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps) ) { - newProps = assign({}, newProps, baseProps); + newProps === baseProps && (newProps = assign({}, newProps, baseProps)); for (var propName in Component) void 0 === newProps[propName] && (newProps[propName] = Component[propName]); @@ -5348,8 +5301,7 @@ function throwException( } while (null !== returnFiber); return !1; } -var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner, - SelectiveHydrationException = Error( +var SelectiveHydrationException = Error( "This is not a real error. It's an implementation detail of React's selective hydration feature. If this leaks into userspace, it's a bug in React. Please file an issue." ), didReceiveUpdate = !1; @@ -5564,8 +5516,22 @@ function markRef(current, workInProgress) { throw Error( "Expected ref to be a function, an object returned by React.createRef(), or undefined/null." ); - if (null === current || current.ref !== ref) + if (null === current || current.ref !== ref) { + if ( + null !== current && + ((current = current.ref), + "function" === typeof current && + "function" === typeof ref && + "string" === typeof current.__stringRef && + current.__stringRef === ref.__stringRef && + current.__stringRefType === ref.__stringRefType && + current.__stringRefOwner === ref.__stringRefOwner) + ) { + workInProgress.ref = current; + return; + } workInProgress.flags |= 2097664; + } } } function updateFunctionComponent( @@ -5846,7 +5812,7 @@ function finishClassComponent( bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) ); shouldUpdate = workInProgress.stateNode; - ReactCurrentOwner$1.current = workInProgress; + ReactSharedInternals.owner = workInProgress; var nextChildren = didCaptureError && "function" !== typeof Component.getDerivedStateFromError ? null @@ -7058,9 +7024,8 @@ function releaseCache(cache) { cache.controller.abort(); }); } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; function requestCurrentTransition() { - var transition = ReactCurrentBatchConfig$1.transition; + var transition = ReactSharedInternals.T; null !== transition && transition._callbacks.add(handleAsyncAction); return transition; } @@ -7094,7 +7059,7 @@ function doesRequireClone(current, completedWork) { if (null !== current && current.child === completedWork.child) return !1; if (0 !== (completedWork.flags & 16)) return !0; for (current = completedWork.child; null !== current; ) { - if (0 !== (current.flags & 12854) || 0 !== (current.subtreeFlags & 12854)) + if (0 !== (current.flags & 13878) || 0 !== (current.subtreeFlags & 13878)) return !0; current = current.sibling; } @@ -8257,7 +8222,7 @@ function recursivelyTraverseMutationEffects(root, parentFiber) { captureCommitPhaseError(childToDelete, parentFiber, error); } } - if (parentFiber.subtreeFlags & 12854) + if (parentFiber.subtreeFlags & 13878) for (parentFiber = parentFiber.child; null !== parentFiber; ) commitMutationEffectsOnFiber(parentFiber, root), (parentFiber = parentFiber.sibling); @@ -8998,10 +8963,6 @@ var DefaultCacheDispatcher = { } }, PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, - ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, executionContext = 0, workInProgressRoot = null, workInProgress = null, @@ -9031,29 +8992,14 @@ var DefaultCacheDispatcher = { nestedUpdateCount = 0, rootWithNestedUpdates = null; function requestUpdateLane(fiber) { - if (0 === (fiber.mode & 1)) return 2; - if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) - return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== requestCurrentTransition()) - return ( - (fiber = currentEntangledLane), - 0 !== fiber ? fiber : requestTransitionLane() - ); - fiber = currentUpdatePriority; - if (0 === fiber) - a: { - fiber = fabricGetCurrentEventPriority - ? fabricGetCurrentEventPriority() - : null; - if (null != fiber) - switch (fiber) { - case FabricDiscretePriority: - fiber = 2; - break a; - } - fiber = 32; - } - return fiber; + return 0 === (fiber.mode & 1) + ? 2 + : 0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes + ? workInProgressRootRenderLanes & -workInProgressRootRenderLanes + : null !== requestCurrentTransition() + ? ((fiber = currentEntangledLane), + 0 !== fiber ? fiber : requestTransitionLane()) + : resolveUpdatePriority(); } function requestDeferredLane() { 0 === workInProgressDeferredLane && @@ -9129,13 +9075,18 @@ function performConcurrentWorkOnRoot(root, didTimeout) { root, renderWasConcurrent ); - 0 !== errorRetryLanes && + if ( + 0 !== errorRetryLanes && ((lanes = errorRetryLanes), (exitStatus = recoverFromConcurrentError( root, renderWasConcurrent, errorRetryLanes - ))); + )), + (renderWasConcurrent = !1), + 2 !== exitStatus) + ) + continue; } if (1 === exitStatus) { prepareFreshStack(root, 0); @@ -9431,8 +9382,8 @@ function prepareFreshStack(root, lanes) { } function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - ReactCurrentOwner.current = null; + ReactSharedInternals.H = ContextOnlyDispatcher; + ReactSharedInternals.owner = null; if (thrownValue === SuspenseException) { thrownValue = getSuspendedThenable(); var handler = suspenseHandlerStackCursor.current; @@ -9470,13 +9421,13 @@ function handleThrow(root, thrownValue) { )); } function pushDispatcher() { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = ContextOnlyDispatcher; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = ContextOnlyDispatcher; return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; } function pushCacheDispatcher() { - var prevCacheDispatcher = ReactCurrentCache.current; - ReactCurrentCache.current = DefaultCacheDispatcher; + var prevCacheDispatcher = ReactSharedInternals.C; + ReactSharedInternals.C = DefaultCacheDispatcher; return prevCacheDispatcher; } function renderDidSuspendDelayIfPossible() { @@ -9528,8 +9479,8 @@ function renderRootSync(root, lanes) { lanes && root.shellSuspendCounter++; resetContextDependencies(); executionContext = prevExecutionContext; - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; + ReactSharedInternals.H = prevDispatcher; + ReactSharedInternals.C = prevCacheDispatcher; if (null !== workInProgress) throw Error( "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." @@ -9635,8 +9586,8 @@ function renderRootConcurrent(root, lanes) { } while (1); resetContextDependencies(); - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; + ReactSharedInternals.H = prevDispatcher; + ReactSharedInternals.C = prevCacheDispatcher; executionContext = prevExecutionContext; if (null !== workInProgress) return 0; workInProgressRoot = null; @@ -9652,7 +9603,7 @@ function performUnitOfWork(unitOfWork) { var next = beginWork(unitOfWork.alternate, unitOfWork, entangledRenderLanes); unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; } function replaySuspendedUnitOfWork(unitOfWork) { var current = unitOfWork.alternate; @@ -9708,7 +9659,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { null === current ? completeUnitOfWork(unitOfWork) : (workInProgress = current); - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -9795,11 +9746,11 @@ function commitRoot( didIncludeRenderPhaseUpdate, spawnedLane ) { - var previousUpdateLanePriority = currentUpdatePriority, - prevTransition = ReactCurrentBatchConfig.transition; + var prevTransition = ReactSharedInternals.T, + previousUpdateLanePriority = currentUpdatePriority; try { - (ReactCurrentBatchConfig.transition = null), - (currentUpdatePriority = 2), + (currentUpdatePriority = 2), + (ReactSharedInternals.T = null), commitRootImpl( root, recoverableErrors, @@ -9809,7 +9760,7 @@ function commitRoot( spawnedLane ); } finally { - (ReactCurrentBatchConfig.transition = prevTransition), + (ReactSharedInternals.T = prevTransition), (currentUpdatePriority = previousUpdateLanePriority); } return null; @@ -9857,13 +9808,13 @@ function commitRootImpl( })); transitions = 0 !== (finishedWork.flags & 15990); if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = null; + transitions = ReactSharedInternals.T; + ReactSharedInternals.T = null; spawnedLane = currentUpdatePriority; currentUpdatePriority = 2; var prevExecutionContext = executionContext; executionContext |= 4; - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; commitBeforeMutationEffects(root, finishedWork); commitMutationEffectsOnFiber(finishedWork, root); root.current = finishedWork; @@ -9871,7 +9822,7 @@ function commitRootImpl( requestPaint(); executionContext = prevExecutionContext; currentUpdatePriority = spawnedLane; - ReactCurrentBatchConfig.transition = transitions; + ReactSharedInternals.T = transitions; } else root.current = finishedWork; rootDoesHavePassiveEffects ? ((rootDoesHavePassiveEffects = !1), @@ -9918,16 +9869,15 @@ function flushPassiveEffects() { remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), - priority = 32 > renderPriority ? 32 : renderPriority; - renderPriority = ReactCurrentBatchConfig.transition; - var previousPriority = currentUpdatePriority; + prevTransition = ReactSharedInternals.T, + previousPriority = currentUpdatePriority; try { - ReactCurrentBatchConfig.transition = null; - currentUpdatePriority = priority; + currentUpdatePriority = 32 > renderPriority ? 32 : renderPriority; + ReactSharedInternals.T = null; if (null === rootWithPendingPassiveEffects) var JSCompiler_inline_result = !1; else { - priority = pendingPassiveTransitions; + renderPriority = pendingPassiveTransitions; pendingPassiveTransitions = null; var root$jscomp$0 = rootWithPendingPassiveEffects, lanes = pendingPassiveEffectsLanes; @@ -9942,7 +9892,7 @@ function flushPassiveEffects() { root$jscomp$0, root$jscomp$0.current, lanes, - priority + renderPriority ); executionContext = prevExecutionContext; flushSyncWorkAcrossRoots_impl(!1); @@ -9958,7 +9908,7 @@ function flushPassiveEffects() { return JSCompiler_inline_result; } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig.transition = renderPriority), + (ReactSharedInternals.T = prevTransition), releaseRootPooledCache(root, remainingLanes); } } @@ -10563,6 +10513,13 @@ function getInspectorDataForInstance(closestInstance) { componentStack: "" }; closestInstance = findCurrentFiberUsingSlowPath(closestInstance); + if (null === closestInstance) + return { + hierarchy: [], + props: emptyObject, + selectedIndex: null, + componentStack: "" + }; var hierarchy = []; traverseOwnerTreeUp(hierarchy, closestInstance); var JSCompiler_inline_result; @@ -10583,10 +10540,7 @@ function getInspectorDataForInstance(closestInstance) { instance = createHierarchy(hierarchy); var props = getHostProps(JSCompiler_inline_result); hierarchy = hierarchy.indexOf(JSCompiler_inline_result); - closestInstance = - null !== closestInstance - ? getStackByFiberInDevAndProd(closestInstance) - : ""; + closestInstance = getStackByFiberInDevAndProd(closestInstance); return { closestInstance: JSCompiler_inline_result, hierarchy: instance, @@ -10596,9 +10550,11 @@ function getInspectorDataForInstance(closestInstance) { }; } function traverseOwnerTreeUp(hierarchy, instance) { - instance && - (hierarchy.unshift(instance), - traverseOwnerTreeUp(hierarchy, instance._debugOwner)); + hierarchy.unshift(instance); + instance = instance._debugOwner; + null != instance && + "number" === typeof instance.tag && + traverseOwnerTreeUp(hierarchy, instance); } if ( "function" !== @@ -10638,10 +10594,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1096 = { + devToolsConfig$jscomp$inline_1099 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "19.0.0-canary-e9ef48bd", + version: "19.0.0-canary-58256eec", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10657,11 +10613,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1335 = { - bundleType: devToolsConfig$jscomp$inline_1096.bundleType, - version: devToolsConfig$jscomp$inline_1096.version, - rendererPackageName: devToolsConfig$jscomp$inline_1096.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1096.rendererConfig, +var internals$jscomp$inline_1366 = { + bundleType: devToolsConfig$jscomp$inline_1099.bundleType, + version: devToolsConfig$jscomp$inline_1099.version, + rendererPackageName: devToolsConfig$jscomp$inline_1099.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1099.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10671,32 +10627,32 @@ var internals$jscomp$inline_1335 = { setErrorHandler: null, setSuspenseHandler: null, scheduleUpdate: null, - currentDispatcherRef: ReactSharedInternals.ReactCurrentDispatcher, + currentDispatcherRef: ReactSharedInternals, findHostInstanceByFiber: function (fiber) { fiber = findCurrentHostFiber(fiber); return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1096.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1099.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-e9ef48bd" + reconcilerVersion: "19.0.0-canary-58256eec" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1336 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1367 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1336.isDisabled && - hook$jscomp$inline_1336.supportsFiber + !hook$jscomp$inline_1367.isDisabled && + hook$jscomp$inline_1367.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1336.inject( - internals$jscomp$inline_1335 + (rendererID = hook$jscomp$inline_1367.inject( + internals$jscomp$inline_1366 )), - (injectedHook = hook$jscomp$inline_1336); + (injectedHook = hook$jscomp$inline_1367); } catch (err) {} } exports.createPortal = function (children, containerTag) { diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js index 31beee3508..d788a47aa6 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<73c6c2752bbd85d9ac37604b580550af>> + * @generated SignedSource<<813f6dc65831980928080bda767b77e1>> */ "use strict"; @@ -897,7 +897,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_264 = { +var injectedNamesToPlugins$jscomp$inline_263 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -943,32 +943,32 @@ var injectedNamesToPlugins$jscomp$inline_264 = { } } }, - isOrderingDirty$jscomp$inline_265 = !1, - pluginName$jscomp$inline_266; -for (pluginName$jscomp$inline_266 in injectedNamesToPlugins$jscomp$inline_264) + isOrderingDirty$jscomp$inline_264 = !1, + pluginName$jscomp$inline_265; +for (pluginName$jscomp$inline_265 in injectedNamesToPlugins$jscomp$inline_263) if ( - injectedNamesToPlugins$jscomp$inline_264.hasOwnProperty( - pluginName$jscomp$inline_266 + injectedNamesToPlugins$jscomp$inline_263.hasOwnProperty( + pluginName$jscomp$inline_265 ) ) { - var pluginModule$jscomp$inline_267 = - injectedNamesToPlugins$jscomp$inline_264[pluginName$jscomp$inline_266]; + var pluginModule$jscomp$inline_266 = + injectedNamesToPlugins$jscomp$inline_263[pluginName$jscomp$inline_265]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_266) || - namesToPlugins[pluginName$jscomp$inline_266] !== - pluginModule$jscomp$inline_267 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_265) || + namesToPlugins[pluginName$jscomp$inline_265] !== + pluginModule$jscomp$inline_266 ) { - if (namesToPlugins[pluginName$jscomp$inline_266]) + if (namesToPlugins[pluginName$jscomp$inline_265]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_266 + "`.") + (pluginName$jscomp$inline_265 + "`.") ); - namesToPlugins[pluginName$jscomp$inline_266] = - pluginModule$jscomp$inline_267; - isOrderingDirty$jscomp$inline_265 = !0; + namesToPlugins[pluginName$jscomp$inline_265] = + pluginModule$jscomp$inline_266; + isOrderingDirty$jscomp$inline_264 = !0; } } -isOrderingDirty$jscomp$inline_265 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_264 && recomputePluginOrdering(); var emptyObject$1 = {}, removedKeys = null, removedKeyCount = 0, @@ -1296,7 +1296,7 @@ var alwaysThrottleRetries = dynamicFlagsUntyped.alwaysThrottleRetries, log$1 = Scheduler.log, unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue, ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererID = null, injectedHook = null, injectedProfilingHooks = null, @@ -1649,7 +1649,6 @@ function movePendingFibersToMemoized(root, lanes) { lanes &= ~root; } } -var currentUpdatePriority = 0; function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes @@ -1708,6 +1707,19 @@ function getPublicInstance(instance) { ? instance : null; } +var currentUpdatePriority = 0; +function resolveUpdatePriority() { + if (0 !== currentUpdatePriority) return currentUpdatePriority; + var currentEventPriority = fabricGetCurrentEventPriority + ? fabricGetCurrentEventPriority() + : null; + if (null != currentEventPriority) + switch (currentEventPriority) { + case FabricDiscretePriority: + return 2; + } + return 32; +} var scheduleTimeout = setTimeout, cancelTimeout = clearTimeout; function cloneHiddenInstance(instance) { @@ -2128,7 +2140,7 @@ function describeBuiltInComponentFrame(name) { } return "\n" + prefix + name; } - return describeComponentFrame(name, null); + return "\n in " + (name || "Unknown"); } var reentry = !1; function describeNativeComponentFrame(fn, construct) { @@ -2262,16 +2274,11 @@ function describeNativeComponentFrame(fn, construct) { ? describeBuiltInComponentFrame(previousPrepareStackTrace) : ""; } -function describeComponentFrame(name, ownerName) { - var sourceInfo = ""; - ownerName && (sourceInfo = " (created by " + ownerName + ")"); - return "\n in " + (name || "Unknown") + sourceInfo; -} function describeFunctionComponentFrame(fn) { return enableComponentStackLocations ? describeNativeComponentFrame(fn, !1) : fn - ? describeComponentFrame(fn.displayName || fn.name || null, null) + ? "\n in " + (fn.displayName || fn.name || "Unknown") : ""; } function describeFiber(fiber) { @@ -3022,55 +3029,6 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef -) { - function ref(value) { - var refs = inst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - } - var stringRef = "" + mixedRef; - returnFiber = element._owner; - if (!returnFiber) - throw Error( - "Element ref was specified as a string (" + - stringRef + - ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://react.dev/link/refs-must-have-owner for more information." - ); - if (1 !== returnFiber.tag) - throw Error( - "Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref" - ); - var inst = returnFiber.stateNode; - if (!inst) - throw Error( - "Missing owner for string ref " + - stringRef + - ". This error is likely caused by a bug in React. Please file an issue." - ); - if ( - null !== current && - null !== current.ref && - "function" === typeof current.ref && - current.ref._stringRef === stringRef - ) - return current.ref; - ref._stringRef = stringRef; - return ref; -} -function coerceRef(returnFiber, current, workInProgress, element) { - var mixedRef = element.ref; - returnFiber = - "string" === typeof mixedRef || - "number" === typeof mixedRef || - "boolean" === typeof mixedRef - ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) - : mixedRef; - workInProgress.ref = returnFiber; -} function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); throw Error( @@ -3166,12 +3124,12 @@ function createChildReconciler(shouldTrackSideEffects) { resolveLazy(elementType) === current.type)) ) return ( - (lanes = useFiber(current, element.props)), - coerceRef(returnFiber, current, lanes, element), - (lanes.return = returnFiber), - lanes + (current = useFiber(current, element.props)), + (current.ref = element.ref), + (current.return = returnFiber), + current ); - lanes = createFiberFromTypeAndProps( + current = createFiberFromTypeAndProps( element.type, element.key, element.props, @@ -3179,9 +3137,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - coerceRef(returnFiber, current, lanes, element); - lanes.return = returnFiber; - return lanes; + current.ref = element.ref; + current.return = returnFiber; + return current; } function updatePortal(returnFiber, current, portal, lanes) { if ( @@ -3242,7 +3200,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, null, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), lanes ); @@ -3582,52 +3540,54 @@ function createChildReconciler(shouldTrackSideEffects) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: a: { - for ( - var key = newChild.key, child = currentFirstChild; - null !== child; - - ) { - if (child.key === key) { + for (var key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) { key = newChild.type; if (key === REACT_FRAGMENT_TYPE) { - if (7 === child.tag) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber( - child, + if (7 === currentFirstChild.tag) { + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber( + currentFirstChild, newChild.props.children ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes.return = returnFiber; + returnFiber = lanes; break a; } } else if ( - child.elementType === key || + currentFirstChild.elementType === key || ("object" === typeof key && null !== key && key.$$typeof === REACT_LAZY_TYPE && - resolveLazy(key) === child.type) + resolveLazy(key) === currentFirstChild.type) ) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber(child, newChild.props); - coerceRef(returnFiber, child, currentFirstChild, newChild); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber(currentFirstChild, newChild.props); + lanes.ref = newChild.ref; + lanes.return = returnFiber; + returnFiber = lanes; break a; } - deleteRemainingChildren(returnFiber, child); + deleteRemainingChildren(returnFiber, currentFirstChild); break; - } else deleteChild(returnFiber, child); - child = child.sibling; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; } newChild.type === REACT_FRAGMENT_TYPE - ? ((currentFirstChild = createFiberFromFragment( + ? ((lanes = createFiberFromFragment( newChild.props.children, returnFiber.mode, lanes, newChild.key )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes.return = returnFiber), + (returnFiber = lanes)) : ((lanes = createFiberFromTypeAndProps( newChild.type, newChild.key, @@ -3636,15 +3596,15 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, currentFirstChild, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), (returnFiber = lanes)); } return placeSingleChild(returnFiber); case REACT_PORTAL_TYPE: a: { - for (child = newChild.key; null !== currentFirstChild; ) { - if (currentFirstChild.key === child) + for (key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) if ( 4 === currentFirstChild.tag && currentFirstChild.stateNode.containerInfo === @@ -3656,12 +3616,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber, currentFirstChild.sibling ); - currentFirstChild = useFiber( - currentFirstChild, - newChild.children || [] - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = useFiber(currentFirstChild, newChild.children || []); + lanes.return = returnFiber; + returnFiber = lanes; break a; } else { deleteRemainingChildren(returnFiber, currentFirstChild); @@ -3670,22 +3627,18 @@ function createChildReconciler(shouldTrackSideEffects) { else deleteChild(returnFiber, currentFirstChild); currentFirstChild = currentFirstChild.sibling; } - currentFirstChild = createFiberFromPortal( - newChild, - returnFiber.mode, - lanes - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = createFiberFromPortal(newChild, returnFiber.mode, lanes); + lanes.return = returnFiber; + returnFiber = lanes; } return placeSingleChild(returnFiber); case REACT_LAZY_TYPE: return ( - (child = newChild._init), + (key = newChild._init), reconcileChildFibersImpl( returnFiber, currentFirstChild, - child(newChild._payload), + key(newChild._payload), lanes ) ); @@ -3726,17 +3679,13 @@ function createChildReconciler(shouldTrackSideEffects) { ? ((newChild = "" + newChild), null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), - (currentFirstChild = useFiber(currentFirstChild, newChild)), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes = useFiber(currentFirstChild, newChild)), + (lanes.return = returnFiber), + (returnFiber = lanes)) : (deleteRemainingChildren(returnFiber, currentFirstChild), - (currentFirstChild = createFiberFromText( - newChild, - returnFiber.mode, - lanes - )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)), + (lanes = createFiberFromText(newChild, returnFiber.mode, lanes)), + (lanes.return = returnFiber), + (returnFiber = lanes)), placeSingleChild(returnFiber)) : deleteRemainingChildren(returnFiber, currentFirstChild); } @@ -3829,9 +3778,7 @@ function findFirstSuspended(row) { } return null; } -var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, - renderLanes = 0, +var renderLanes = 0, currentlyRenderingFiber$1 = null, currentHook = null, workInProgressHook = null, @@ -3865,7 +3812,7 @@ function renderWithHooks( workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; - ReactCurrentDispatcher$1.current = + ReactSharedInternals.H = null === current || null === current.memoizedState ? HooksDispatcherOnMount : HooksDispatcherOnUpdate; @@ -3883,7 +3830,7 @@ function renderWithHooks( return current; } function finishRenderingHooks() { - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + ReactSharedInternals.H = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; @@ -3909,17 +3856,23 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { numberOfReRenders += 1; workInProgressHook = currentHook = null; workInProgress.updateQueue = null; - ReactCurrentDispatcher$1.current = HooksDispatcherOnRerender; + ReactSharedInternals.H = HooksDispatcherOnRerender; var children = Component(props, secondArg); } while (didScheduleRenderPhaseUpdateDuringThisPass); return children; } function TransitionAwareHostComponent() { if (!enableAsyncActions) throw Error("Not implemented."); - var maybeThenable = ReactCurrentDispatcher$1.current.useState()[0]; - return "function" === typeof maybeThenable.then - ? useThenable(maybeThenable) - : maybeThenable; + var dispatcher = ReactSharedInternals.H, + maybeThenable = dispatcher.useState()[0]; + maybeThenable = + "function" === typeof maybeThenable.then + ? useThenable(maybeThenable) + : maybeThenable; + dispatcher = dispatcher.useState()[0]; + (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher && + (currentlyRenderingFiber$1.flags |= 1024); + return maybeThenable; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; @@ -4007,7 +3960,7 @@ function useThenable(thenable) { (null === workInProgressHook ? null === currentlyRenderingFiber$1.memoizedState : null === workInProgressHook.next) && - (ReactCurrentDispatcher$1.current = HooksDispatcherOnMount); + (ReactSharedInternals.H = HooksDispatcherOnMount); return thenable; } function use(usable) { @@ -4341,9 +4294,9 @@ function dispatchActionState( function runActionStateAction(actionQueue, setPendingState, setState, payload) { var action = actionQueue.action, prevState = actionQueue.state, - prevTransition = ReactCurrentBatchConfig$2.transition, + prevTransition = ReactSharedInternals.T, currentTransition = { _callbacks: new Set() }; - ReactCurrentBatchConfig$2.transition = currentTransition; + ReactSharedInternals.T = currentTransition; setPendingState(!0); try { var returnValue = action(prevState, payload); @@ -4376,7 +4329,7 @@ function runActionStateAction(actionQueue, setPendingState, setState, payload) { setState({ then: function () {}, status: "rejected", reason: error }), finishRunningActionStateAction(actionQueue, setPendingState, setState); } finally { - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactSharedInternals.T = prevTransition; } } function finishRunningActionStateAction( @@ -4616,14 +4569,14 @@ function startTransition(fiber, queue, pendingState, finishedState, callback) { var previousPriority = currentUpdatePriority; currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; - var prevTransition = ReactCurrentBatchConfig$2.transition, + var prevTransition = ReactSharedInternals.T, currentTransition = { _callbacks: new Set() }; enableAsyncActions - ? ((ReactCurrentBatchConfig$2.transition = currentTransition), + ? ((ReactSharedInternals.T = currentTransition), dispatchOptimisticSetState(fiber, !1, queue, pendingState)) - : ((ReactCurrentBatchConfig$2.transition = null), + : ((ReactSharedInternals.T = null), dispatchSetState(fiber, queue, pendingState), - (ReactCurrentBatchConfig$2.transition = currentTransition)); + (ReactSharedInternals.T = currentTransition)); try { if (enableAsyncActions) { var returnValue = callback(); @@ -4650,7 +4603,7 @@ function startTransition(fiber, queue, pendingState, finishedState, callback) { else throw error; } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$2.transition = prevTransition); + (ReactSharedInternals.T = prevTransition); } } function useHostTransitionStatus() { @@ -5273,7 +5226,7 @@ function resolveClassComponentProps( (Component = Component.defaultProps) && (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps) ) { - newProps = assign({}, newProps, baseProps); + newProps === baseProps && (newProps = assign({}, newProps, baseProps)); for (var propName in Component) void 0 === newProps[propName] && (newProps[propName] = Component[propName]); @@ -5541,8 +5494,7 @@ function throwException( } while (null !== returnFiber); return !1; } -var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner, - SelectiveHydrationException = Error( +var SelectiveHydrationException = Error( "This is not a real error. It's an implementation detail of React's selective hydration feature. If this leaks into userspace, it's a bug in React. Please file an issue." ), didReceiveUpdate = !1; @@ -5759,8 +5711,22 @@ function markRef(current, workInProgress) { throw Error( "Expected ref to be a function, an object returned by React.createRef(), or undefined/null." ); - if (null === current || current.ref !== ref) + if (null === current || current.ref !== ref) { + if ( + null !== current && + ((current = current.ref), + "function" === typeof current && + "function" === typeof ref && + "string" === typeof current.__stringRef && + current.__stringRef === ref.__stringRef && + current.__stringRefType === ref.__stringRefType && + current.__stringRefOwner === ref.__stringRefOwner) + ) { + workInProgress.ref = current; + return; + } workInProgress.flags |= 2097664; + } } } function updateFunctionComponent( @@ -6045,7 +6011,7 @@ function finishClassComponent( bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) ); shouldUpdate = workInProgress.stateNode; - ReactCurrentOwner$1.current = workInProgress; + ReactSharedInternals.owner = workInProgress; if ( didCaptureError && "function" !== typeof Component.getDerivedStateFromError @@ -7288,9 +7254,8 @@ function releaseCache(cache) { cache.controller.abort(); }); } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; function requestCurrentTransition() { - var transition = ReactCurrentBatchConfig$1.transition; + var transition = ReactSharedInternals.T; null !== transition && transition._callbacks.add(handleAsyncAction); return transition; } @@ -7324,7 +7289,7 @@ function doesRequireClone(current, completedWork) { if (null !== current && current.child === completedWork.child) return !1; if (0 !== (completedWork.flags & 16)) return !0; for (current = completedWork.child; null !== current; ) { - if (0 !== (current.flags & 12854) || 0 !== (current.subtreeFlags & 12854)) + if (0 !== (current.flags & 13878) || 0 !== (current.subtreeFlags & 13878)) return !0; current = current.sibling; } @@ -8723,7 +8688,7 @@ function recursivelyTraverseMutationEffects(root, parentFiber) { captureCommitPhaseError(childToDelete, parentFiber, error); } } - if (parentFiber.subtreeFlags & 12854) + if (parentFiber.subtreeFlags & 13878) for (parentFiber = parentFiber.child; null !== parentFiber; ) commitMutationEffectsOnFiber(parentFiber, root), (parentFiber = parentFiber.sibling); @@ -9525,10 +9490,6 @@ var DefaultCacheDispatcher = { } }, PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, - ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, executionContext = 0, workInProgressRoot = null, workInProgress = null, @@ -9559,29 +9520,14 @@ var DefaultCacheDispatcher = { nestedUpdateCount = 0, rootWithNestedUpdates = null; function requestUpdateLane(fiber) { - if (0 === (fiber.mode & 1)) return 2; - if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes) - return workInProgressRootRenderLanes & -workInProgressRootRenderLanes; - if (null !== requestCurrentTransition()) - return ( - (fiber = currentEntangledLane), - 0 !== fiber ? fiber : requestTransitionLane() - ); - fiber = currentUpdatePriority; - if (0 === fiber) - a: { - fiber = fabricGetCurrentEventPriority - ? fabricGetCurrentEventPriority() - : null; - if (null != fiber) - switch (fiber) { - case FabricDiscretePriority: - fiber = 2; - break a; - } - fiber = 32; - } - return fiber; + return 0 === (fiber.mode & 1) + ? 2 + : 0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes + ? workInProgressRootRenderLanes & -workInProgressRootRenderLanes + : null !== requestCurrentTransition() + ? ((fiber = currentEntangledLane), + 0 !== fiber ? fiber : requestTransitionLane()) + : resolveUpdatePriority(); } function requestDeferredLane() { 0 === workInProgressDeferredLane && @@ -9659,13 +9605,18 @@ function performConcurrentWorkOnRoot(root, didTimeout) { root, renderWasConcurrent ); - 0 !== errorRetryLanes && + if ( + 0 !== errorRetryLanes && ((lanes = errorRetryLanes), (exitStatus = recoverFromConcurrentError( root, renderWasConcurrent, errorRetryLanes - ))); + )), + (renderWasConcurrent = !1), + 2 !== exitStatus) + ) + continue; } if (1 === exitStatus) { prepareFreshStack(root, 0); @@ -9963,8 +9914,8 @@ function prepareFreshStack(root, lanes) { } function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - ReactCurrentOwner.current = null; + ReactSharedInternals.H = ContextOnlyDispatcher; + ReactSharedInternals.owner = null; if (thrownValue === SuspenseException) { thrownValue = getSuspendedThenable(); var handler = suspenseHandlerStackCursor.current; @@ -10031,13 +9982,13 @@ function handleThrow(root, thrownValue) { } } function pushDispatcher() { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = ContextOnlyDispatcher; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = ContextOnlyDispatcher; return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; } function pushCacheDispatcher() { - var prevCacheDispatcher = ReactCurrentCache.current; - ReactCurrentCache.current = DefaultCacheDispatcher; + var prevCacheDispatcher = ReactSharedInternals.C; + ReactSharedInternals.C = DefaultCacheDispatcher; return prevCacheDispatcher; } function renderDidSuspendDelayIfPossible() { @@ -10099,8 +10050,8 @@ function renderRootSync(root, lanes) { lanes && root.shellSuspendCounter++; resetContextDependencies(); executionContext = prevExecutionContext; - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; + ReactSharedInternals.H = prevDispatcher; + ReactSharedInternals.C = prevCacheDispatcher; if (null !== workInProgress) throw Error( "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." @@ -10217,8 +10168,8 @@ function renderRootConcurrent(root, lanes) { } while (1); resetContextDependencies(); - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; + ReactSharedInternals.H = prevDispatcher; + ReactSharedInternals.C = prevCacheDispatcher; executionContext = prevExecutionContext; if (null !== workInProgress) return ( @@ -10248,7 +10199,7 @@ function performUnitOfWork(unitOfWork) { null === current ? completeUnitOfWork(unitOfWork) : (workInProgress = current); - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; } function replaySuspendedUnitOfWork(unitOfWork) { var current = unitOfWork.alternate, @@ -10307,7 +10258,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { null === current ? completeUnitOfWork(unitOfWork) : (workInProgress = current); - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -10403,11 +10354,11 @@ function commitRoot( didIncludeRenderPhaseUpdate, spawnedLane ) { - var previousUpdateLanePriority = currentUpdatePriority, - prevTransition = ReactCurrentBatchConfig.transition; + var prevTransition = ReactSharedInternals.T, + previousUpdateLanePriority = currentUpdatePriority; try { - (ReactCurrentBatchConfig.transition = null), - (currentUpdatePriority = 2), + (currentUpdatePriority = 2), + (ReactSharedInternals.T = null), commitRootImpl( root, recoverableErrors, @@ -10417,7 +10368,7 @@ function commitRoot( spawnedLane ); } finally { - (ReactCurrentBatchConfig.transition = prevTransition), + (ReactSharedInternals.T = prevTransition), (currentUpdatePriority = previousUpdateLanePriority); } return null; @@ -10468,13 +10419,13 @@ function commitRootImpl( })); transitions = 0 !== (finishedWork.flags & 15990); if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = null; + transitions = ReactSharedInternals.T; + ReactSharedInternals.T = null; spawnedLane = currentUpdatePriority; currentUpdatePriority = 2; var prevExecutionContext = executionContext; executionContext |= 4; - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; commitBeforeMutationEffects(root, finishedWork); commitTime = now(); commitMutationEffects(root, finishedWork, lanes); @@ -10489,7 +10440,7 @@ function commitRootImpl( requestPaint(); executionContext = prevExecutionContext; currentUpdatePriority = spawnedLane; - ReactCurrentBatchConfig.transition = transitions; + ReactSharedInternals.T = transitions; } else (root.current = finishedWork), (commitTime = now()); rootDoesHavePassiveEffects ? ((rootDoesHavePassiveEffects = !1), @@ -10539,18 +10490,17 @@ function flushPassiveEffects() { remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), - priority = 32 > renderPriority ? 32 : renderPriority; - renderPriority = ReactCurrentBatchConfig.transition; - var previousPriority = currentUpdatePriority; + prevTransition = ReactSharedInternals.T, + previousPriority = currentUpdatePriority; try { - ReactCurrentBatchConfig.transition = null; - currentUpdatePriority = priority; + currentUpdatePriority = 32 > renderPriority ? 32 : renderPriority; + ReactSharedInternals.T = null; if (null === rootWithPendingPassiveEffects) var JSCompiler_inline_result = !1; else { var transitions = pendingPassiveTransitions; pendingPassiveTransitions = null; - priority = rootWithPendingPassiveEffects; + renderPriority = rootWithPendingPassiveEffects; var lanes = pendingPassiveEffectsLanes; rootWithPendingPassiveEffects = null; pendingPassiveEffectsLanes = 0; @@ -10562,10 +10512,10 @@ function flushPassiveEffects() { injectedProfilingHooks.markPassiveEffectsStarted(lanes); var prevExecutionContext = executionContext; executionContext |= 4; - commitPassiveUnmountOnFiber(priority.current); + commitPassiveUnmountOnFiber(renderPriority.current); commitPassiveMountOnFiber( - priority, - priority.current, + renderPriority, + renderPriority.current, lanes, transitions ); @@ -10618,9 +10568,9 @@ function flushPassiveEffects() { "function" === typeof injectedHook.onPostCommitFiberRoot ) try { - injectedHook.onPostCommitFiberRoot(rendererID, priority); + injectedHook.onPostCommitFiberRoot(rendererID, renderPriority); } catch (err) {} - var stateNode = priority.current.stateNode; + var stateNode = renderPriority.current.stateNode; stateNode.effectDuration = 0; stateNode.passiveEffectDuration = 0; JSCompiler_inline_result = !0; @@ -10628,7 +10578,7 @@ function flushPassiveEffects() { return JSCompiler_inline_result; } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig.transition = renderPriority), + (ReactSharedInternals.T = prevTransition), releaseRootPooledCache(root, remainingLanes); } } @@ -11268,6 +11218,13 @@ function getInspectorDataForInstance(closestInstance) { componentStack: "" }; closestInstance = findCurrentFiberUsingSlowPath(closestInstance); + if (null === closestInstance) + return { + hierarchy: [], + props: emptyObject, + selectedIndex: null, + componentStack: "" + }; var hierarchy = []; traverseOwnerTreeUp(hierarchy, closestInstance); var JSCompiler_inline_result; @@ -11288,10 +11245,7 @@ function getInspectorDataForInstance(closestInstance) { instance = createHierarchy(hierarchy); var props = getHostProps(JSCompiler_inline_result); hierarchy = hierarchy.indexOf(JSCompiler_inline_result); - closestInstance = - null !== closestInstance - ? getStackByFiberInDevAndProd(closestInstance) - : ""; + closestInstance = getStackByFiberInDevAndProd(closestInstance); return { closestInstance: JSCompiler_inline_result, hierarchy: instance, @@ -11301,9 +11255,11 @@ function getInspectorDataForInstance(closestInstance) { }; } function traverseOwnerTreeUp(hierarchy, instance) { - instance && - (hierarchy.unshift(instance), - traverseOwnerTreeUp(hierarchy, instance._debugOwner)); + hierarchy.unshift(instance); + instance = instance._debugOwner; + null != instance && + "number" === typeof instance.tag && + traverseOwnerTreeUp(hierarchy, instance); } if ( "function" !== @@ -11343,10 +11299,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1178 = { + devToolsConfig$jscomp$inline_1179 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "19.0.0-canary-9599a17c", + version: "19.0.0-canary-348a26f7", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -11376,10 +11332,10 @@ var roots = new Map(), } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1178.bundleType, - version: devToolsConfig$jscomp$inline_1178.version, - rendererPackageName: devToolsConfig$jscomp$inline_1178.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1178.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1179.bundleType, + version: devToolsConfig$jscomp$inline_1179.version, + rendererPackageName: devToolsConfig$jscomp$inline_1179.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1179.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -11389,20 +11345,20 @@ var roots = new Map(), setErrorHandler: null, setSuspenseHandler: null, scheduleUpdate: null, - currentDispatcherRef: ReactSharedInternals.ReactCurrentDispatcher, + currentDispatcherRef: ReactSharedInternals, findHostInstanceByFiber: function (fiber) { fiber = findCurrentHostFiber(fiber); return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1178.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1179.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-9599a17c" + reconcilerVersion: "19.0.0-canary-348a26f7" }); exports.createPortal = function (children, containerTag) { return createPortal$1( diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index 3bc2b2f2d9..c4f941fa6b 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<184a9633ac8a1c29149afaca75347242>> */ "use strict"; @@ -31,7 +31,7 @@ if (__DEV__) { var Scheduler = require("scheduler"); var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; var suppressWarning = false; function setSuppressWarning(newSuppressWarning) { @@ -83,9 +83,7 @@ if (__DEV__) { // When changing this logic, you might want to also // update consoleWithStackDev.www.js as well. { - var ReactDebugCurrentFrame = - ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); + var stack = ReactSharedInternals.getStackAddendum(); if (stack !== "") { format += "%s"; @@ -2663,6 +2661,9 @@ to return true:wantsResponderID| | ReactNativeGlobalResponderHandler ); + var LegacyRoot = 0; + var ConcurrentRoot = 1; + /** * `ReactInstanceMap` maintains a mapping from a public facing stateful * instance (key) and the internal representation (value). This allows public @@ -2887,6 +2888,17 @@ to return true:wantsResponderID| | return type.displayName || "Context"; } + function getComponentNameFromOwner(owner) { + if (typeof owner.tag === "number") { + return getComponentNameFromFiber(owner); + } + + if (typeof owner.name === "string") { + return owner.name; + } + + return null; + } function getComponentNameFromFiber(fiber) { var tag = fiber.tag, type = fiber.type; @@ -3049,6 +3061,7 @@ to return true:wantsResponderID| | var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; var DidDefer = ContentReset; + var FormReset = Snapshot; var LifecycleEffectMask = Passive$1 | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) @@ -3107,7 +3120,8 @@ to return true:wantsResponderID| | ContentReset | Ref | Hydrating | - Visibility; + Visibility | + FormReset; var LayoutMask = Update | Callback | Ref | Visibility; // TODO: Split into PassiveMountMask and PassiveUnmountMask var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that don't get reset on clones. @@ -3117,7 +3131,6 @@ to return true:wantsResponderID| | var StaticMask = LayoutStatic | PassiveStatic | RefStatic | MaySuspendCommit; - var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner; function getNearestMountedFiber(fiber) { var node = fiber; var nearestMounted = fiber; @@ -3159,7 +3172,7 @@ to return true:wantsResponderID| | } function isMounted(component) { { - var owner = ReactCurrentOwner$3.current; + var owner = ReactSharedInternals.owner; if (owner !== null && owner.tag === ClassComponent) { var ownerFiber = owner; @@ -5554,17 +5567,11 @@ to return true:wantsResponderID| | } } + var NoEventPriority = NoLane; var DiscreteEventPriority = SyncLane; var ContinuousEventPriority = InputContinuousLane; var DefaultEventPriority = DefaultLane; var IdleEventPriority = IdleLane; - var currentUpdatePriority = NoLane; - function getCurrentUpdatePriority() { - return currentUpdatePriority; - } - function setCurrentUpdatePriority(newPriority) { - currentUpdatePriority = newPriority; - } function higherEventPriority(a, b) { return a !== 0 && a < b ? a : b; } @@ -5574,6 +5581,9 @@ to return true:wantsResponderID| | function isHigherEventPriority(a, b) { return a !== 0 && a < b; } + function eventPriorityToLane(updatePriority) { + return updatePriority; + } function lanesToEventPriority(lanes) { var lane = getHighestPriorityLane(lanes); @@ -5781,7 +5791,18 @@ to return true:wantsResponderID| | // More context @ github.com/facebook/react/pull/8560#discussion_r92111303 return false; } - function getCurrentEventPriority() { + var currentUpdatePriority = NoEventPriority; + function setCurrentUpdatePriority(newPriority) { + currentUpdatePriority = newPriority; + } + function getCurrentUpdatePriority() { + return currentUpdatePriority; + } + function resolveUpdatePriority() { + if (currentUpdatePriority !== NoEventPriority) { + return currentUpdatePriority; + } + return DefaultEventPriority; } function shouldAttemptEagerTransition() { @@ -6288,9 +6309,6 @@ to return true:wantsResponderID| | } } - var LegacyRoot = 0; - var ConcurrentRoot = 1; - // We use the existence of the state object as an indicator that the component // is hidden. var OffscreenVisible = @@ -6321,9 +6339,8 @@ to return true:wantsResponderID| | var objectIs = typeof Object.is === "function" ? Object.is : is; // $FlowFixMe[method-unbinding] - var ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher; var prefix; - function describeBuiltInComponentFrame(name, ownerFn) { + function describeBuiltInComponentFrame(name) { if (enableComponentStackLocations) { if (prefix === undefined) { // Extract the VM specific prefix used by each line. @@ -6337,19 +6354,12 @@ to return true:wantsResponderID| | return "\n" + prefix + name; } else { - var ownerName = null; - - if (ownerFn) { - ownerName = ownerFn.displayName || ownerFn.name || null; - } - - return describeComponentFrame(name, ownerName); + return describeComponentFrame(name); } } function describeDebugInfoFrame(name, env) { return describeBuiltInComponentFrame( - name + (env ? " (" + env + ")" : ""), - null + name + (env ? " (" + env + ")" : "") ); } var reentry = false; @@ -6389,13 +6399,13 @@ to return true:wantsResponderID| | var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. Error.prepareStackTrace = undefined; - var previousDispatcher; + var previousDispatcher = null; { - previousDispatcher = ReactCurrentDispatcher$2.current; // Set the dispatcher in DEV because this might be call in the render function + previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function // for warnings. - ReactCurrentDispatcher$2.current = null; + ReactSharedInternals.H = null; disableLogs(); } /** @@ -6588,7 +6598,7 @@ to return true:wantsResponderID| | reentry = false; { - ReactCurrentDispatcher$2.current = previousDispatcher; + ReactSharedInternals.H = previousDispatcher; reenableLogs(); } @@ -6607,24 +6617,18 @@ to return true:wantsResponderID| | return syntheticFrame; } - function describeComponentFrame(name, ownerName) { - var sourceInfo = ""; - - if (ownerName) { - sourceInfo = " (created by " + ownerName + ")"; - } - - return "\n in " + (name || "Unknown") + sourceInfo; + function describeComponentFrame(name) { + return "\n in " + (name || "Unknown"); } - function describeClassComponentFrame(ctor, ownerFn) { + function describeClassComponentFrame(ctor) { if (enableComponentStackLocations) { return describeNativeComponentFrame(ctor, true); } else { - return describeFunctionComponentFrame(ctor, ownerFn); + return describeFunctionComponentFrame(ctor); } } - function describeFunctionComponentFrame(fn, ownerFn) { + function describeFunctionComponentFrame(fn) { if (enableComponentStackLocations) { return describeNativeComponentFrame(fn, false); } else { @@ -6633,43 +6637,35 @@ to return true:wantsResponderID| | } var name = fn.displayName || fn.name || null; - var ownerName = null; - - if (ownerFn) { - ownerName = ownerFn.displayName || ownerFn.name || null; - } - - return describeComponentFrame(name, ownerName); + return describeComponentFrame(name); } } function describeFiber(fiber) { - var owner = fiber._debugOwner ? fiber._debugOwner.type : null; - switch (fiber.tag) { case HostHoistable: case HostSingleton: case HostComponent: - return describeBuiltInComponentFrame(fiber.type, owner); + return describeBuiltInComponentFrame(fiber.type); case LazyComponent: - return describeBuiltInComponentFrame("Lazy", owner); + return describeBuiltInComponentFrame("Lazy"); case SuspenseComponent: - return describeBuiltInComponentFrame("Suspense", owner); + return describeBuiltInComponentFrame("Suspense"); case SuspenseListComponent: - return describeBuiltInComponentFrame("SuspenseList", owner); + return describeBuiltInComponentFrame("SuspenseList"); case FunctionComponent: case SimpleMemoComponent: - return describeFunctionComponentFrame(fiber.type, owner); + return describeFunctionComponentFrame(fiber.type); case ForwardRef: - return describeFunctionComponentFrame(fiber.type.render, owner); + return describeFunctionComponentFrame(fiber.type.render); case ClassComponent: - return describeClassComponentFrame(fiber.type, owner); + return describeClassComponentFrame(fiber.type); default: return ""; @@ -7832,7 +7828,6 @@ to return true:wantsResponderID| | } } - var ReactCurrentActQueue$4 = ReactSharedInternals.ReactCurrentActQueue; // A linked list of all the roots with pending work. In an idiomatic app, // there's only a single root, but we do support multi root apps, hence this // extra complexity. But this module is optimized for the single root case. @@ -7871,7 +7866,7 @@ to return true:wantsResponderID| | mightHavePendingSyncWork = true; // At the end of the current event, go through each of the roots and ensure // there's a task scheduled for each one at the correct priority. - if (ReactCurrentActQueue$4.current !== null) { + if (ReactSharedInternals.actQueue !== null) { // We're inside an `act` scope. if (!didScheduleMicrotask_act) { didScheduleMicrotask_act = true; @@ -7892,9 +7887,9 @@ to return true:wantsResponderID| | scheduleTaskForRootDuringMicrotask(root, now$1()); } - if (ReactCurrentActQueue$4.isBatchingLegacy && root.tag === LegacyRoot) { + if (ReactSharedInternals.isBatchingLegacy && root.tag === LegacyRoot) { // Special `act` case: Record whenever a legacy update is scheduled. - ReactCurrentActQueue$4.didScheduleLegacyUpdate = true; + ReactSharedInternals.didScheduleLegacyUpdate = true; } } function flushSyncWorkOnAllRoots() { @@ -8085,7 +8080,7 @@ to return true:wantsResponderID| | // Scheduler task, rather than an `act` task, cancel it and re-schedule // on the `act` queue. !( - ReactCurrentActQueue$4.current !== null && + ReactSharedInternals.actQueue !== null && existingCallbackNode !== fakeActCallbackNode$1 ) ) { @@ -8152,11 +8147,11 @@ to return true:wantsResponderID| | var fakeActCallbackNode$1 = {}; function scheduleCallback$2(priorityLevel, callback) { - if (ReactCurrentActQueue$4.current !== null) { + if (ReactSharedInternals.actQueue !== null) { // Special case: We're inside an `act` scope (a testing utility). // Instead of scheduling work in the host environment, add it to a // fake internal queue that's managed by the `act` implementation. - ReactCurrentActQueue$4.current.push(callback); + ReactSharedInternals.actQueue.push(callback); return fakeActCallbackNode$1; } else { return scheduleCallback$3(priorityLevel, callback); @@ -8171,13 +8166,13 @@ to return true:wantsResponderID| | } function scheduleImmediateTask(cb) { - if (ReactCurrentActQueue$4.current !== null) { + if (ReactSharedInternals.actQueue !== null) { // Special case: Inside an `act` scope, we push microtasks to the fake `act` // callback queue. This is because we currently support calling `act` // without awaiting the result. The plan is to deprecate that, and require // that you always await the result so that the microtasks have a chance to // run. But it hasn't happened yet. - ReactCurrentActQueue$4.current.push(function () { + ReactSharedInternals.actQueue.push(function () { cb(); return null; }); @@ -8969,7 +8964,6 @@ to return true:wantsResponderID| | return true; } - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; var current = null; var isRendering = false; function getCurrentFiberOwnerNameInDevOrNull() { @@ -8980,8 +8974,8 @@ to return true:wantsResponderID| | var owner = current._debugOwner; - if (owner !== null && typeof owner !== "undefined") { - return getComponentNameFromFiber(owner); + if (owner != null) { + return getComponentNameFromOwner(owner); } } @@ -9001,14 +8995,14 @@ to return true:wantsResponderID| | function resetCurrentFiber() { { - ReactDebugCurrentFrame.getCurrentStack = null; + ReactSharedInternals.getCurrentStack = null; current = null; isRendering = false; } } function setCurrentFiber(fiber) { { - ReactDebugCurrentFrame.getCurrentStack = + ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; current = fiber; isRendering = false; @@ -9383,96 +9377,6 @@ to return true:wantsResponderID| | }; } - /* - * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol - * and Temporal.* types. See https://github.com/facebook/react/pull/22064. - * - * The functions in this module will throw an easier-to-understand, - * easier-to-debug exception with a clear errors message message explaining the - * problem. (Instead of a confusing exception thrown inside the implementation - * of the `value` object). - */ - // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. - function typeName(value) { - { - // toStringTag is needed for namespaced types like Temporal.Instant - var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; - var type = - (hasToStringTag && value[Symbol.toStringTag]) || - value.constructor.name || - "Object"; // $FlowFixMe[incompatible-return] - - return type; - } - } // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. - - function willCoercionThrow(value) { - { - try { - testStringCoercion(value); - return false; - } catch (e) { - return true; - } - } - } - - function testStringCoercion(value) { - // If you ended up here by following an exception call stack, here's what's - // happened: you supplied an object or symbol value to React (as a prop, key, - // DOM attribute, CSS property, string ref, etc.) and when React tried to - // coerce it to a string using `'' + value`, an exception was thrown. - // - // The most common types that will cause this exception are `Symbol` instances - // and Temporal objects like `Temporal.Instant`. But any object that has a - // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this - // exception. (Library authors do this to prevent users from using built-in - // numeric operators like `+` or comparison operators like `>=` because custom - // methods are needed to perform accurate arithmetic or comparison.) - // - // To fix the problem, coerce this object or symbol value to a string before - // passing it to React. The most reliable way is usually `String(value)`. - // - // To find which value is throwing, check the browser or debugger console. - // Before this exception was thrown, there should be `console.error` output - // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the - // problem and how that type was used: key, atrribute, input value prop, etc. - // In most cases, this console output also shows the component and its - // ancestor components where the exception happened. - // - // eslint-disable-next-line react-internal/safe-string-coercion - return "" + value; - } - function checkKeyStringCoercion(value) { - { - if (willCoercionThrow(value)) { - error( - "The provided key is an unsupported type %s." + - " This value must be coerced to a string before using it here.", - typeName(value) - ); - - return testStringCoercion(value); // throw (to help callers find troubleshooting comments) - } - } - } - function checkPropStringCoercion(value, propName) { - { - if (willCoercionThrow(value)) { - error( - "The provided `%s` prop is an unsupported type %s." + - " This value must be coerced to a string before using it here.", - propName, - typeName(value) - ); - - return testStringCoercion(value); // throw (to help callers find troubleshooting comments) - } - } - } - - var ReactCurrentActQueue$3 = ReactSharedInternals.ReactCurrentActQueue; - function getThenablesFromState(state) { { var devState = state; @@ -9526,8 +9430,8 @@ to return true:wantsResponderID| | function noop() {} function trackUsedThenable(thenableState, thenable, index) { - if (ReactCurrentActQueue$3.current !== null) { - ReactCurrentActQueue$3.didUsePromise = true; + if (ReactSharedInternals.actQueue !== null) { + ReactSharedInternals.didUsePromise = true; } var trackedThenables = getThenablesFromState(thenableState); @@ -9750,7 +9654,6 @@ to return true:wantsResponderID| | var didWarnAboutMaps; var didWarnAboutGenerators; - var didWarnAboutStringRefs; var ownerHasKeyUseWarning; var ownerHasFunctionTypeWarning; var ownerHasSymbolTypeWarning; @@ -9760,7 +9663,6 @@ to return true:wantsResponderID| | { didWarnAboutMaps = false; didWarnAboutGenerators = false; - didWarnAboutStringRefs = {}; /** * Warn if there's no key explicitly set on dynamic arrays of children or * object keys are not valid. This allows us to keep track of children between @@ -9805,10 +9707,6 @@ to return true:wantsResponderID| | }; } - function isReactClass(type) { - return type.prototype && type.prototype.isReactComponent; - } - function unwrapThenable(thenable) { var index = thenableIndexCounter$1; thenableIndexCounter$1 += 1; @@ -9820,128 +9718,16 @@ to return true:wantsResponderID| | return trackUsedThenable(thenableState$1, thenable, index); } - function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef - ) { - { - checkPropStringCoercion(mixedRef, "ref"); - } - - var stringRef = "" + mixedRef; - var owner = element._owner; - - if (!owner) { - throw new Error( - "Element ref was specified as a string (" + - stringRef + - ") but no owner was set. This could happen for one of" + - " the following reasons:\n" + - "1. You may be adding a ref to a function component\n" + - "2. You may be adding a ref to a component that was not created inside a component's render method\n" + - "3. You have multiple copies of React loaded\n" + - "See https://react.dev/link/refs-must-have-owner for more information." - ); - } - - if (owner.tag !== ClassComponent) { - throw new Error( - "Function components cannot have string refs. " + - "We recommend using useRef() instead. " + - "Learn more about using refs safely here: " + - "https://react.dev/link/strict-mode-string-ref" - ); - } - - { - if ( - // Will already warn with "Function components cannot be given refs" - !(typeof element.type === "function" && !isReactClass(element.type)) - ) { - var componentName = - getComponentNameFromFiber(returnFiber) || "Component"; - - if (!didWarnAboutStringRefs[componentName]) { - error( - 'Component "%s" contains the string ref "%s". Support for string refs ' + - "will be removed in a future major release. We recommend using " + - "useRef() or createRef() instead. " + - "Learn more about using refs safely here: " + - "https://react.dev/link/strict-mode-string-ref", - componentName, - stringRef - ); - - didWarnAboutStringRefs[componentName] = true; - } - } - } - - var inst = owner.stateNode; - - if (!inst) { - throw new Error( - "Missing owner for string ref " + - stringRef + - ". This error is likely caused by a " + - "bug in React. Please file an issue." - ); - } // Check if previous string ref matches new string ref - - if ( - current !== null && - current.ref !== null && - typeof current.ref === "function" && - current.ref._stringRef === stringRef - ) { - // Reuse the existing string ref - var currentRef = current.ref; - return currentRef; - } // Create a new string ref - - var ref = function (value) { - var refs = inst.refs; - - if (value === null) { - delete refs[stringRef]; - } else { - refs[stringRef] = value; - } - }; - - ref._stringRef = stringRef; - return ref; - } - function coerceRef(returnFiber, current, workInProgress, element) { - var mixedRef; + var ref; { // Old behavior. - mixedRef = element.ref; - } - - var coercedRef; - - if ( - typeof mixedRef === "string" || - typeof mixedRef === "number" || - typeof mixedRef === "boolean" - ) { - coercedRef = convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef - ); - } else { - coercedRef = mixedRef; + ref = element.ref; } // TODO: If enableRefAsProp is on, we shouldn't use the `ref` field. We // should always read the ref from the prop. - workInProgress.ref = coercedRef; + workInProgress.ref = ref; } function throwOnInvalidObjectType(returnFiber, newChild) { @@ -11735,8 +11521,6 @@ to return true:wantsResponderID| | /* */ 8; - var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig; var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; var didWarnAboutUseWrappedInTryCatch; @@ -11900,8 +11684,8 @@ to return true:wantsResponderID| | didWarnAboutUseFormState.add(componentName); error( - "ReactDOM.useFormState has been deprecated and replaced by " + - "React.useActionState. Please update %s to use React.useActionState.", + "ReactDOM.useFormState has been renamed to React.useActionState. " + + "Please update %s to use React.useActionState.", componentName ); } @@ -12037,17 +11821,16 @@ to return true:wantsResponderID| | { if (current !== null && current.memoizedState !== null) { - ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV; + ReactSharedInternals.H = HooksDispatcherOnUpdateInDEV; } else if (hookTypesDev !== null) { // This dispatcher handles an edge case where a component is updating, // but no stateful hooks have been used. // We want to match the production code behavior (which will use HooksDispatcherOnMount), // but with the extra DEV validation to ensure hooks ordering hasn't changed. // This dispatcher does that. - ReactCurrentDispatcher$1.current = - HooksDispatcherOnMountWithHookTypesInDEV; + ReactSharedInternals.H = HooksDispatcherOnMountWithHookTypesInDEV; } else { - ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV; + ReactSharedInternals.H = HooksDispatcherOnMountInDEV; } } // In Strict Mode, during development, user functions are double invoked to // help detect side effects. The logic for how this is implemented for in @@ -12119,7 +11902,7 @@ to return true:wantsResponderID| | } // We can assume the previous dispatcher is always this one, since we set it // at the beginning of the render phase and there's no re-entrance. - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; // This check uses currentHook so that it works the same in DEV and prod bundles. + ReactSharedInternals.H = ContextOnlyDispatcher; // This check uses currentHook so that it works the same in DEV and prod bundles. // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles. var didRenderTooFewHooks = @@ -12270,7 +12053,7 @@ to return true:wantsResponderID| | hookTypesUpdateIndexDev = -1; } - ReactCurrentDispatcher$1.current = HooksDispatcherOnRerenderInDEV; + ReactSharedInternals.H = HooksDispatcherOnRerenderInDEV; children = Component(props, secondArg); } while (didScheduleRenderPhaseUpdateDuringThisPass); @@ -12300,18 +12083,34 @@ to return true:wantsResponderID| | throw new Error("Not implemented."); } - var dispatcher = ReactCurrentDispatcher$1.current; + var dispatcher = ReactSharedInternals.H; var _dispatcher$useState = dispatcher.useState(), maybeThenable = _dispatcher$useState[0]; + var nextState; + if (typeof maybeThenable.then === "function") { var thenable = maybeThenable; - return useThenable(thenable); + nextState = useThenable(thenable); } else { var status = maybeThenable; - return status; + nextState = status; + } // The "reset state" is an object. If it changes, that means something + // requested that we reset the form. + + var _dispatcher$useState2 = dispatcher.useState(), + nextResetState = _dispatcher$useState2[0]; + + var prevResetState = + currentHook !== null ? currentHook.memoizedState : null; + + if (prevResetState !== nextResetState) { + // Schedule a form reset + currentlyRenderingFiber$1.flags |= FormReset; } + + return nextState; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; // TODO: Don't need to reset the flags here, because they're reset in the @@ -12340,7 +12139,7 @@ to return true:wantsResponderID| | currentlyRenderingFiber$1 = null; // We can assume the previous dispatcher is always this one, since we set it // at the beginning of the render phase and there's no re-entrance. - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + ReactSharedInternals.H = ContextOnlyDispatcher; } function resetHooksOnUnwind(workInProgress) { if (didScheduleRenderPhaseUpdate) { @@ -12513,7 +12312,7 @@ to return true:wantsResponderID| | // time (perhaps because it threw). Subsequent Hook calls should use the // mount dispatcher. { - ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV; + ReactSharedInternals.H = HooksDispatcherOnMountInDEV; } } @@ -13322,14 +13121,14 @@ to return true:wantsResponderID| | var action = actionQueue.action; var prevState = actionQueue.state; // This is a fork of startTransition - var prevTransition = ReactCurrentBatchConfig$2.transition; + var prevTransition = ReactSharedInternals.T; var currentTransition = { _callbacks: new Set() }; - ReactCurrentBatchConfig$2.transition = currentTransition; + ReactSharedInternals.T = currentTransition; { - ReactCurrentBatchConfig$2.transition._updatedFibers = new Set(); + ReactSharedInternals.T._updatedFibers = new Set(); } // Optimistically update the pending state, similar to useTransition. // This will be reverted automatically when all actions are finished. @@ -13387,7 +13186,7 @@ to return true:wantsResponderID| | setState(rejectedThenable); finishRunningActionStateAction(actionQueue, setPendingState, setState); } finally { - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactSharedInternals.T = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { @@ -13973,7 +13772,7 @@ to return true:wantsResponderID| | setCurrentUpdatePriority( higherEventPriority(previousPriority, ContinuousEventPriority) ); - var prevTransition = ReactCurrentBatchConfig$2.transition; + var prevTransition = ReactSharedInternals.T; var currentTransition = { _callbacks: new Set() }; @@ -13985,16 +13784,16 @@ to return true:wantsResponderID| | // optimistic update anyway to make it less likely the behavior accidentally // diverges; for example, both an optimistic update and this one should // share the same lane. - ReactCurrentBatchConfig$2.transition = currentTransition; + ReactSharedInternals.T = currentTransition; dispatchOptimisticSetState(fiber, false, queue, pendingState); } else { - ReactCurrentBatchConfig$2.transition = null; + ReactSharedInternals.T = null; dispatchSetState(fiber, queue, pendingState); - ReactCurrentBatchConfig$2.transition = currentTransition; + ReactSharedInternals.T = currentTransition; } { - ReactCurrentBatchConfig$2.transition._updatedFibers = new Set(); + currentTransition._updatedFibers = new Set(); } try { @@ -14048,7 +13847,7 @@ to return true:wantsResponderID| | } } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactSharedInternals.T = prevTransition; { if (prevTransition === null && currentTransition._updatedFibers) { @@ -14276,11 +14075,11 @@ to return true:wantsResponderID| | var lastRenderedReducer = queue.lastRenderedReducer; if (lastRenderedReducer !== null) { - var prevDispatcher; + var prevDispatcher = null; { - prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = + prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; } @@ -14311,7 +14110,7 @@ to return true:wantsResponderID| | // Suppress the error. It will throw again in the render phase. } finally { { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } } } @@ -14572,27 +14371,25 @@ to return true:wantsResponderID| | currentHookNameInDev = "useMemo"; mountHookTypesDev(); checkDepsAreArrayDev(deps); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -14603,14 +14400,13 @@ to return true:wantsResponderID| | useState: function (initialState) { currentHookNameInDev = "useState"; mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -14731,27 +14527,25 @@ to return true:wantsResponderID| | useMemo: function (create, deps) { currentHookNameInDev = "useMemo"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -14762,14 +14556,13 @@ to return true:wantsResponderID| | useState: function (initialState) { currentHookNameInDev = "useState"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -14883,27 +14676,25 @@ to return true:wantsResponderID| | useMemo: function (create, deps) { currentHookNameInDev = "useMemo"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -14914,14 +14705,13 @@ to return true:wantsResponderID| | useState: function (initialState) { currentHookNameInDev = "useState"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -15043,27 +14833,25 @@ to return true:wantsResponderID| | useMemo: function (create, deps) { currentHookNameInDev = "useMemo"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnRerenderInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnRerenderInDEV; try { return updateMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnRerenderInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnRerenderInDEV; try { return rerenderReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -15074,14 +14862,13 @@ to return true:wantsResponderID| | useState: function (initialState) { currentHookNameInDev = "useState"; updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnRerenderInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnRerenderInDEV; try { return rerenderState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -15214,28 +15001,26 @@ to return true:wantsResponderID| | currentHookNameInDev = "useMemo"; warnInvalidHookAccess(); mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; warnInvalidHookAccess(); mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -15248,14 +15033,13 @@ to return true:wantsResponderID| | currentHookNameInDev = "useState"; warnInvalidHookAccess(); mountHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnMountInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnMountInDEV; try { return mountState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -15392,28 +15176,26 @@ to return true:wantsResponderID| | currentHookNameInDev = "useMemo"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -15426,14 +15208,13 @@ to return true:wantsResponderID| | currentHookNameInDev = "useState"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -15570,28 +15351,26 @@ to return true:wantsResponderID| | currentHookNameInDev = "useMemo"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return updateMemo(create, deps); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useReducer: function (reducer, initialArg, init) { currentHookNameInDev = "useReducer"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return rerenderReducer(reducer, initialArg, init); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useRef: function (initialValue) { @@ -15604,14 +15383,13 @@ to return true:wantsResponderID| | currentHookNameInDev = "useState"; warnInvalidHookAccess(); updateHookTypesDev(); - var prevDispatcher = ReactCurrentDispatcher$1.current; - ReactCurrentDispatcher$1.current = - InvalidNestedHooksDispatcherOnUpdateInDEV; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = InvalidNestedHooksDispatcherOnUpdateInDEV; try { return rerenderState(initialState); } finally { - ReactCurrentDispatcher$1.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } }, useDebugValue: function (value, formatterFn) { @@ -17039,7 +16817,7 @@ to return true:wantsResponderID| | // remove this extra check. alreadyResolvedDefaultProps ) { - var newProps = baseProps; // Resolve default props. Taken from old JSX runtime, where this used to live. + var newProps = baseProps; var defaultProps = Component.defaultProps; @@ -17048,11 +16826,15 @@ to return true:wantsResponderID| | // default props here in the reconciler, rather than in the JSX runtime. (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps) ) { - newProps = assign({}, newProps, baseProps); + // We may have already copied the props object above to remove ref. If so, + // we can modify that. Otherwise, copy the props object with Object.assign. + if (newProps === baseProps) { + newProps = assign({}, newProps, baseProps); + } // Taken from old JSX runtime, where this used to live. - for (var propName in defaultProps) { - if (newProps[propName] === undefined) { - newProps[propName] = defaultProps[propName]; + for (var _propName in defaultProps) { + if (newProps[_propName] === undefined) { + newProps[_propName] = defaultProps[_propName]; } } } @@ -17123,8 +16905,6 @@ to return true:wantsResponderID| | console["error"](error); }; - var ReactCurrentActQueue$2 = ReactSharedInternals.ReactCurrentActQueue; // Side-channel since I'm not sure we want to make this part of the public API - var componentName = null; var errorBoundaryName = null; function defaultOnUncaughtError(error, errorInfo) { @@ -17189,10 +16969,10 @@ to return true:wantsResponderID| | var error = errorInfo.value; - if (true && ReactCurrentActQueue$2.current !== null) { + if (true && ReactSharedInternals.actQueue !== null) { // For uncaught errors inside act, we track them on the act and then // rethrow them into the test. - ReactCurrentActQueue$2.thrownErrors.push(error); + ReactSharedInternals.thrownErrors.push(error); return; } @@ -17734,7 +17514,6 @@ to return true:wantsResponderID| | return false; } - var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner; // A special exception that's used to unwind the stack when an update flows // into a dehydrated boundary. var SelectiveHydrationException = new Error( @@ -17853,7 +17632,7 @@ to return true:wantsResponderID| | } { - ReactCurrentOwner$2.current = workInProgress; + ReactSharedInternals.owner = workInProgress; setIsRendering(true); nextChildren = renderWithHooks( current, @@ -18365,7 +18144,27 @@ to return true:wantsResponderID| | } if (current === null || current.ref !== ref) { - // Schedule a Ref effect + if (current !== null) { + var oldRef = current.ref; + var newRef = ref; + + if ( + typeof oldRef === "function" && + typeof newRef === "function" && + typeof oldRef.__stringRef === "string" && + oldRef.__stringRef === newRef.__stringRef && + oldRef.__stringRefType === newRef.__stringRefType && + oldRef.__stringRefOwner === newRef.__stringRefOwner + ) { + // Although this is a different callback, it represents the same + // string ref. To avoid breaking old Meta code that relies on string + // refs only being attached once, reuse the old ref. This will + // prevent us from detaching and reattaching the ref on each update. + workInProgress.ref = oldRef; + return; + } + } // Schedule a Ref effect + workInProgress.flags |= Ref | RefStatic; } } @@ -18448,7 +18247,7 @@ to return true:wantsResponderID| | } { - ReactCurrentOwner$2.current = workInProgress; + ReactSharedInternals.owner = workInProgress; setIsRendering(true); nextChildren = renderWithHooks( current, @@ -18671,7 +18470,10 @@ to return true:wantsResponderID| | var instance = workInProgress.stateNode; // Rerender - ReactCurrentOwner$2.current = workInProgress; + { + ReactSharedInternals.owner = workInProgress; + } + var nextChildren; if ( @@ -20409,7 +20211,7 @@ to return true:wantsResponderID| | var newChildren; { - ReactCurrentOwner$2.current = workInProgress; + ReactSharedInternals.owner = workInProgress; setIsRendering(true); newChildren = render(newValue); setIsRendering(false); @@ -21488,10 +21290,8 @@ to return true:wantsResponderID| | popProvider(CacheContext, workInProgress); } - var ReactCurrentBatchConfig$1 = - ReactSharedInternals.ReactCurrentBatchConfig; function requestCurrentTransition() { - var transition = ReactCurrentBatchConfig$1.transition; + var transition = ReactSharedInternals.T; if (transition !== null) { // Whenever a transition update is scheduled, register a callback on the @@ -22915,7 +22715,7 @@ to return true:wantsResponderID| | // Allows us to avoid traversing the return path to find the nearest Offscreen ancestor. var offscreenSubtreeIsHidden = false; - var offscreenSubtreeWasHidden = false; + var offscreenSubtreeWasHidden = false; // Used to track if a form needs to be reset at the end of the mutation phase. var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set; var nextEffect = null; // Used for Profiling builds to track updaters. @@ -24861,6 +24661,19 @@ to return true:wantsResponderID| | } } } + + if (flags & FormReset) { + { + if (finishedWork.type !== "form") { + // Paranoid coding. In case we accidentally start using the + // FormReset bit for something else. + error( + "Unexpected host component type. Expected a form. This is a " + + "bug in React." + ); + } + } + } } return; @@ -26472,7 +26285,6 @@ to return true:wantsResponderID| | symbolFor("selector.text"); } - var ReactCurrentActQueue$1 = ReactSharedInternals.ReactCurrentActQueue; function isLegacyActEnvironment(fiber) { { // Legacy mode. We preserve the behavior of React 17's act. It assumes an @@ -26497,7 +26309,7 @@ to return true:wantsResponderID| | if ( !isReactActEnvironmentGlobal && - ReactCurrentActQueue$1.current !== null + ReactSharedInternals.actQueue !== null ) { // TODO: Include link to relevant documentation page. error( @@ -26511,11 +26323,6 @@ to return true:wantsResponderID| | } var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map; - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, - ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, - ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; var NoContext = /* */ 0; @@ -26666,13 +26473,11 @@ to return true:wantsResponderID| | if (transition !== null) { { - var batchConfigTransition = ReactCurrentBatchConfig.transition; - - if (!batchConfigTransition._updatedFibers) { - batchConfigTransition._updatedFibers = new Set(); + if (!transition._updatedFibers) { + transition._updatedFibers = new Set(); } - batchConfigTransition._updatedFibers.add(fiber); + transition._updatedFibers.add(fiber); } var actionScopeLane = peekEntangledActionLane(); @@ -26681,26 +26486,9 @@ to return true:wantsResponderID| | : // is the first update in that scope. Either way, we need to get a // fresh transition lane. requestTransitionLane(); - } // Updates originating inside certain React methods, like flushSync, have - // their priority set by tracking it with a context variable. - // - // The opaque type returned by the host config is internally a lane, so we can - // use that directly. - // TODO: Move this type conversion to the event priority module. + } - var updateLane = getCurrentUpdatePriority(); - - if (updateLane !== NoLane) { - return updateLane; - } // This update originated outside React. Ask the host environment for an - // appropriate priority, based on the type of event. - // - // The opaque type returned by the host config is internally a lane, so we can - // use that directly. - // TODO: Move this type conversion to the event priority module. - - var eventLane = getCurrentEventPriority(); - return eventLane; + return eventPriorityToLane(resolveUpdatePriority()); } function requestRetryLane(fiber) { @@ -26843,7 +26631,7 @@ to return true:wantsResponderID| | !disableLegacyMode && (fiber.mode & ConcurrentMode) === NoMode ) { - if (ReactCurrentActQueue.isBatchingLegacy); + if (ReactSharedInternals.isBatchingLegacy); else { // Flush the synchronous work now, unless we're already working or inside // a batch. This is intentionally inside scheduleUpdateOnFiber instead of @@ -26945,20 +26733,31 @@ to return true:wantsResponderID| | } // Check if something threw if (exitStatus === RootErrored) { - var originallyAttemptedLanes = lanes; + var lanesThatJustErrored = lanes; var errorRetryLanes = getLanesToRetrySynchronouslyOnError( root, - originallyAttemptedLanes + lanesThatJustErrored ); if (errorRetryLanes !== NoLanes) { lanes = errorRetryLanes; exitStatus = recoverFromConcurrentError( root, - originallyAttemptedLanes, + lanesThatJustErrored, errorRetryLanes ); - renderWasConcurrent = false; + renderWasConcurrent = false; // Need to check the exit status again. + + if (exitStatus !== RootErrored) { + // The root did not error this time. Restart the exit algorithm + // from the beginning. + // TODO: Refactor the exit algorithm to be less confusing. Maybe + // more branches + recursion instead of a loop. I think the only + // thing that causes it to be a loop is the RootDidNotComplete + // check. If that's true, then we don't need a loop/recursion + // at all. + continue; + } } } @@ -27412,7 +27211,7 @@ to return true:wantsResponderID| | if ( executionContext === NoContext && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode. - !ReactCurrentActQueue.isBatchingLegacy + !ReactSharedInternals.isBatchingLegacy ) { resetRenderTimer(); flushSyncWorkOnLegacyRootsOnly(); @@ -27420,51 +27219,15 @@ to return true:wantsResponderID| | } } } - // Warning, this opts-out of checking the function body. - // eslint-disable-next-line no-unused-vars - // eslint-disable-next-line no-redeclare - // eslint-disable-next-line no-redeclare + // Returns whether the the call was during a render or not - function flushSync(fn) { - // In legacy mode, we flush pending passive effects at the beginning of the - // next event, not at the end of the previous one. - if ( - rootWithPendingPassiveEffects !== null && - !disableLegacyMode && - rootWithPendingPassiveEffects.tag === LegacyRoot && - (executionContext & (RenderContext | CommitContext)) === NoContext - ) { - flushPassiveEffects(); + function flushSyncWork() { + if ((executionContext & (RenderContext | CommitContext)) === NoContext) { + flushSyncWorkOnAllRoots(); + return false; } - var prevExecutionContext = executionContext; - executionContext |= BatchedContext; - var prevTransition = ReactCurrentBatchConfig.transition; - var previousPriority = getCurrentUpdatePriority(); - - try { - ReactCurrentBatchConfig.transition = null; - setCurrentUpdatePriority(DiscreteEventPriority); - - if (fn) { - return fn(); - } else { - return undefined; - } - } finally { - setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig.transition = prevTransition; - executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch. - // Note that this will happen even if batchedUpdates is higher up - // the stack. - - if ( - (executionContext & (RenderContext | CommitContext)) === - NoContext - ) { - flushSyncWorkOnAllRoots(); - } - } + return true; } // hidden subtree. The stack logic is managed there because that's the only // place that ever modifies it. Which module it lives in doesn't matter for @@ -27578,7 +27341,10 @@ to return true:wantsResponderID| | // when React is executing user code. resetHooksAfterThrow(); resetCurrentFiber(); - ReactCurrentOwner$1.current = null; + + { + ReactSharedInternals.owner = null; + } if (thrownValue === SuspenseException) { // This is a special type of exception used for Suspense. For historical @@ -27730,8 +27496,8 @@ to return true:wantsResponderID| | } function pushDispatcher(container) { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = ContextOnlyDispatcher; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = ContextOnlyDispatcher; if (prevDispatcher === null) { // The React isomorphic package does not include a default dispatcher. @@ -27744,20 +27510,20 @@ to return true:wantsResponderID| | } function popDispatcher(prevDispatcher) { - ReactCurrentDispatcher.current = prevDispatcher; + ReactSharedInternals.H = prevDispatcher; } function pushCacheDispatcher() { { - var prevCacheDispatcher = ReactCurrentCache.current; - ReactCurrentCache.current = DefaultCacheDispatcher; + var prevCacheDispatcher = ReactSharedInternals.C; + ReactSharedInternals.C = DefaultCacheDispatcher; return prevCacheDispatcher; } } function popCacheDispatcher(prevCacheDispatcher) { { - ReactCurrentCache.current = prevCacheDispatcher; + ReactSharedInternals.C = prevCacheDispatcher; } } @@ -28166,7 +27932,7 @@ to return true:wantsResponderID| | } } - if (true && ReactCurrentActQueue.current !== null) { + if (true && ReactSharedInternals.actQueue !== null) { // `act` special case: If we're inside an `act` scope, don't consult // `shouldYield`. Always keep working until the render is complete. // This is not just an optimization: in a unit test environment, we @@ -28245,7 +28011,9 @@ to return true:wantsResponderID| | workInProgress = next; } - ReactCurrentOwner$1.current = null; + { + ReactSharedInternals.owner = null; + } } function replaySuspendedUnitOfWork(unitOfWork) { @@ -28373,7 +28141,9 @@ to return true:wantsResponderID| | workInProgress = next; } - ReactCurrentOwner$1.current = null; + { + ReactSharedInternals.owner = null; + } } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { @@ -28583,12 +28353,12 @@ to return true:wantsResponderID| | ) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. + var prevTransition = ReactSharedInternals.T; var previousUpdateLanePriority = getCurrentUpdatePriority(); - var prevTransition = ReactCurrentBatchConfig.transition; try { - ReactCurrentBatchConfig.transition = null; setCurrentUpdatePriority(DiscreteEventPriority); + ReactSharedInternals.T = null; commitRootImpl( root, recoverableErrors, @@ -28598,7 +28368,7 @@ to return true:wantsResponderID| | spawnedLane ); } finally { - ReactCurrentBatchConfig.transition = prevTransition; + ReactSharedInternals.T = prevTransition; setCurrentUpdatePriority(previousUpdateLanePriority); } @@ -28730,14 +28500,16 @@ to return true:wantsResponderID| | NoFlags$1; if (subtreeHasEffects || rootHasEffect) { - var prevTransition = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = null; + var prevTransition = ReactSharedInternals.T; + ReactSharedInternals.T = null; var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(DiscreteEventPriority); var prevExecutionContext = executionContext; executionContext |= CommitContext; // Reset this to null before calling lifecycles - ReactCurrentOwner$1.current = null; // The commit phase is broken into several sub-phases. We do a separate pass + { + ReactSharedInternals.owner = null; + } // The commit phase is broken into several sub-phases. We do a separate pass // of the effect list for each phase: all mutation effects come before all // layout effects, and so on. // The first phase a "before mutation" phase. We use this phase to read the @@ -28774,7 +28546,7 @@ to return true:wantsResponderID| | executionContext = prevExecutionContext; // Reset the priority to the previous non-sync value. setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig.transition = prevTransition; + ReactSharedInternals.T = prevTransition; } else { // No effects. root.current = finishedWork; // Measure these anyway so the flamegraph explicitly shows that there were @@ -28958,16 +28730,16 @@ to return true:wantsResponderID| | pendingPassiveEffectsRemainingLanes = NoLanes; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes); var priority = lowerEventPriority(DefaultEventPriority, renderPriority); - var prevTransition = ReactCurrentBatchConfig.transition; + var prevTransition = ReactSharedInternals.T; var previousPriority = getCurrentUpdatePriority(); try { - ReactCurrentBatchConfig.transition = null; setCurrentUpdatePriority(priority); + ReactSharedInternals.T = null; return flushPassiveEffectsImpl(); } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig.transition = prevTransition; // Once passive effects have run for the tree - giving components a + ReactSharedInternals.T = prevTransition; // Once passive effects have run for the tree - giving components a // chance to retain cache instances they use - release the pooled // cache at the root (if there is one) @@ -29690,7 +29462,7 @@ to return true:wantsResponderID| | { // If we're currently inside an `act` scope, bypass Scheduler and push to // the `act` queue instead. - var actQueue = ReactCurrentActQueue.current; + var actQueue = ReactSharedInternals.actQueue; if (actQueue !== null) { actQueue.push(callback); @@ -29703,7 +29475,7 @@ to return true:wantsResponderID| | function shouldForceFlushFallbacksInDEV() { // Never force flush in production. This function should get stripped out. - return ReactCurrentActQueue.current !== null; + return ReactSharedInternals.actQueue !== null; } function warnIfUpdatesNotWrappedWithActDEV(fiber) { @@ -29737,7 +29509,7 @@ to return true:wantsResponderID| | } } - if (ReactCurrentActQueue.current === null) { + if (ReactSharedInternals.actQueue === null) { var previousFiber = current; try { @@ -29772,7 +29544,7 @@ to return true:wantsResponderID| | if ( root.tag !== LegacyRoot && isConcurrentActEnvironment() && - ReactCurrentActQueue.current === null + ReactSharedInternals.actQueue === null ) { error( "A suspended resource finished loading inside a test, but the event " + @@ -29981,13 +29753,12 @@ to return true:wantsResponderID| | var staleFamilies = update.staleFamilies, updatedFamilies = update.updatedFamilies; flushPassiveEffects(); - flushSync(function () { - scheduleFibersWithFamiliesRecursively( - root.current, - updatedFamilies, - staleFamilies - ); - }); + scheduleFibersWithFamiliesRecursively( + root.current, + updatedFamilies, + staleFamilies + ); + flushSyncWork(); } }; var scheduleRoot = function (root, element) { @@ -29999,10 +29770,8 @@ to return true:wantsResponderID| | return; } - flushPassiveEffects(); - flushSync(function () { - updateContainer(element, root, null, null); - }); + updateContainerSync(element, root, null, null); + flushSyncWork(); } }; @@ -30702,7 +30471,7 @@ to return true:wantsResponderID| | "named imports."; } - var ownerName = owner ? getComponentNameFromFiber(owner) : null; + var ownerName = owner ? getComponentNameFromOwner(owner) : null; if (ownerName) { info += "\n\nCheck the render method of `" + ownerName + "`."; @@ -30970,7 +30739,81 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "19.0.0-canary-997c5634"; + var ReactVersion = "19.0.0-canary-a41df4ab"; + + /* + * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol + * and Temporal.* types. See https://github.com/facebook/react/pull/22064. + * + * The functions in this module will throw an easier-to-understand, + * easier-to-debug exception with a clear errors message message explaining the + * problem. (Instead of a confusing exception thrown inside the implementation + * of the `value` object). + */ + // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. + function typeName(value) { + { + // toStringTag is needed for namespaced types like Temporal.Instant + var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag; + var type = + (hasToStringTag && value[Symbol.toStringTag]) || + value.constructor.name || + "Object"; // $FlowFixMe[incompatible-return] + + return type; + } + } // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible. + + function willCoercionThrow(value) { + { + try { + testStringCoercion(value); + return false; + } catch (e) { + return true; + } + } + } + + function testStringCoercion(value) { + // If you ended up here by following an exception call stack, here's what's + // happened: you supplied an object or symbol value to React (as a prop, key, + // DOM attribute, CSS property, string ref, etc.) and when React tried to + // coerce it to a string using `'' + value`, an exception was thrown. + // + // The most common types that will cause this exception are `Symbol` instances + // and Temporal objects like `Temporal.Instant`. But any object that has a + // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this + // exception. (Library authors do this to prevent users from using built-in + // numeric operators like `+` or comparison operators like `>=` because custom + // methods are needed to perform accurate arithmetic or comparison.) + // + // To fix the problem, coerce this object or symbol value to a string before + // passing it to React. The most reliable way is usually `String(value)`. + // + // To find which value is throwing, check the browser or debugger console. + // Before this exception was thrown, there should be `console.error` output + // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the + // problem and how that type was used: key, atrribute, input value prop, etc. + // In most cases, this console output also shows the component and its + // ancestor components where the exception happened. + // + // eslint-disable-next-line react-internal/safe-string-coercion + return "" + value; + } + function checkKeyStringCoercion(value) { + { + if (willCoercionThrow(value)) { + error( + "The provided key is an unsupported type %s." + + " This value must be coerced to a string before using it here.", + typeName(value) + ); + + return testStringCoercion(value); // throw (to help callers find troubleshooting comments) + } + } + } function createPortal$1( children, @@ -31126,13 +30969,52 @@ to return true:wantsResponderID| | ); } function updateContainer(element, container, parentComponent, callback) { + var current = container.current; + var lane = requestUpdateLane(current); + updateContainerImpl( + current, + lane, + element, + container, + parentComponent, + callback + ); + return lane; + } + function updateContainerSync( + element, + container, + parentComponent, + callback + ) { + if (container.tag === LegacyRoot) { + flushPassiveEffects(); + } + + var current = container.current; + updateContainerImpl( + current, + SyncLane, + element, + container, + parentComponent, + callback + ); + return SyncLane; + } + + function updateContainerImpl( + rootFiber, + lane, + element, + container, + parentComponent, + callback + ) { { onScheduleRoot(container, element); } - var current$1 = container.current; - var lane = requestUpdateLane(current$1); - { markRenderScheduled(lane); } @@ -31181,14 +31063,12 @@ to return true:wantsResponderID| | update.callback = callback; } - var root = enqueueUpdate(current$1, update, lane); + var root = enqueueUpdate(rootFiber, update, lane); if (root !== null) { - scheduleUpdateOnFiber(root, current$1, lane); - entangleTransitions(root, current$1, lane); + scheduleUpdateOnFiber(root, rootFiber, lane); + entangleTransitions(root, rootFiber, lane); } - - return lane; } function getPublicRootInstance(container) { var containerFiber = container.current; @@ -31478,7 +31358,6 @@ to return true:wantsResponderID| | function injectIntoDevTools(devToolsConfig) { var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; return injectInternals({ bundleType: devToolsConfig.bundleType, version: devToolsConfig.version, @@ -31493,7 +31372,7 @@ to return true:wantsResponderID| | setErrorHandler: setErrorHandler, setSuspenseHandler: setSuspenseHandler, scheduleUpdate: scheduleUpdate, - currentDispatcherRef: ReactCurrentDispatcher, + currentDispatcherRef: ReactSharedInternals, findHostInstanceByFiber: findHostInstanceByFiber, findFiberByHostInstance: findFiberByHostInstance || emptyFindFiberByHostInstance, @@ -31510,10 +31389,9 @@ to return true:wantsResponderID| | }); } - var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; function findHostInstance_DEPRECATED(componentOrHandle) { { - var owner = ReactCurrentOwner.current; + var owner = ReactSharedInternals.owner; if (owner !== null && owner.stateNode !== null) { if (!owner.stateNode._warnedAboutRefsInRender) { @@ -31564,7 +31442,7 @@ to return true:wantsResponderID| | } function findNodeHandle(componentOrHandle) { { - var owner = ReactCurrentOwner.current; + var owner = ReactSharedInternals.owner; if (owner !== null && owner.stateNode !== null) { if (!owner.stateNode._warnedAboutRefsInRender) { @@ -31822,13 +31700,23 @@ to return true:wantsResponderID| | } var fiber = findCurrentFiberUsingSlowPath(closestInstance); + + if (fiber === null) { + // Might not be currently mounted. + return { + hierarchy: [], + props: emptyObject, + selectedIndex: null, + componentStack: "" + }; + } + var fiberHierarchy = getOwnerHierarchy(fiber); var instance = lastNonHostInstance(fiberHierarchy); var hierarchy = createHierarchy(fiberHierarchy); var props = getHostProps(instance); var selectedIndex = fiberHierarchy.indexOf(instance); - var componentStack = - fiber !== null ? getStackByFiberInDevAndProd(fiber) : ""; + var componentStack = getStackByFiberInDevAndProd(fiber); return { closestInstance: instance, hierarchy: hierarchy, @@ -31855,13 +31743,15 @@ to return true:wantsResponderID| | } return hierarchy[0]; - } // $FlowFixMe[missing-local-annot] + } function traverseOwnerTreeUp(hierarchy, instance) { { - if (instance) { - hierarchy.unshift(instance); - traverseOwnerTreeUp(hierarchy, instance._debugOwner); + hierarchy.unshift(instance); + var owner = instance._debugOwner; + + if (owner != null && typeof owner.tag === "number") { + traverseOwnerTreeUp(hierarchy, owner); } } } diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js index 3cdbc6e2ec..baf91c53bf 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<00af43e020c169c2dff69684d08d5d7a>> */ "use strict"; @@ -1111,7 +1111,7 @@ ResponderEventPlugin.injection.injectGlobalResponderHandler({ } }); var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, alwaysThrottleRetries = dynamicFlagsUntyped.alwaysThrottleRetries, consoleManagedByDevToolsDuringStrictMode = dynamicFlagsUntyped.consoleManagedByDevToolsDuringStrictMode, @@ -1914,7 +1914,6 @@ function markRootEntangled(root, entangledLanes) { rootEntangledLanes &= ~lane; } } -var currentUpdatePriority = 0; function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes @@ -1967,6 +1966,7 @@ function getPublicInstance(instance) { } var scheduleTimeout = setTimeout, cancelTimeout = clearTimeout, + currentUpdatePriority = 0, valueStack = [], index = -1; function createCursor(defaultValue) { @@ -2080,7 +2080,7 @@ function describeBuiltInComponentFrame(name) { } return "\n" + prefix + name; } - return describeComponentFrame(name, null); + return "\n in " + (name || "Unknown"); } var reentry = !1; function describeNativeComponentFrame(fn, construct) { @@ -2214,16 +2214,11 @@ function describeNativeComponentFrame(fn, construct) { ? describeBuiltInComponentFrame(previousPrepareStackTrace) : ""; } -function describeComponentFrame(name, ownerName) { - var sourceInfo = ""; - ownerName && (sourceInfo = " (created by " + ownerName + ")"); - return "\n in " + (name || "Unknown") + sourceInfo; -} function describeFunctionComponentFrame(fn) { return enableComponentStackLocations ? describeNativeComponentFrame(fn, !1) : fn - ? describeComponentFrame(fn.displayName || fn.name || null, null) + ? "\n in " + (fn.displayName || fn.name || "Unknown") : ""; } function describeFiber(fiber) { @@ -2965,55 +2960,6 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef -) { - function ref(value) { - var refs = inst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - } - var stringRef = "" + mixedRef; - returnFiber = element._owner; - if (!returnFiber) - throw Error( - "Element ref was specified as a string (" + - stringRef + - ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://react.dev/link/refs-must-have-owner for more information." - ); - if (1 !== returnFiber.tag) - throw Error( - "Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref" - ); - var inst = returnFiber.stateNode; - if (!inst) - throw Error( - "Missing owner for string ref " + - stringRef + - ". This error is likely caused by a bug in React. Please file an issue." - ); - if ( - null !== current && - null !== current.ref && - "function" === typeof current.ref && - current.ref._stringRef === stringRef - ) - return current.ref; - ref._stringRef = stringRef; - return ref; -} -function coerceRef(returnFiber, current, workInProgress, element) { - var mixedRef = element.ref; - returnFiber = - "string" === typeof mixedRef || - "number" === typeof mixedRef || - "boolean" === typeof mixedRef - ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) - : mixedRef; - workInProgress.ref = returnFiber; -} function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); throw Error( @@ -3109,12 +3055,12 @@ function createChildReconciler(shouldTrackSideEffects) { resolveLazy(elementType) === current.type)) ) return ( - (lanes = useFiber(current, element.props)), - coerceRef(returnFiber, current, lanes, element), - (lanes.return = returnFiber), - lanes + (current = useFiber(current, element.props)), + (current.ref = element.ref), + (current.return = returnFiber), + current ); - lanes = createFiberFromTypeAndProps( + current = createFiberFromTypeAndProps( element.type, element.key, element.props, @@ -3122,9 +3068,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - coerceRef(returnFiber, current, lanes, element); - lanes.return = returnFiber; - return lanes; + current.ref = element.ref; + current.return = returnFiber; + return current; } function updatePortal(returnFiber, current, portal, lanes) { if ( @@ -3185,7 +3131,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, null, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), lanes ); @@ -3525,52 +3471,54 @@ function createChildReconciler(shouldTrackSideEffects) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: a: { - for ( - var key = newChild.key, child = currentFirstChild; - null !== child; - - ) { - if (child.key === key) { + for (var key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) { key = newChild.type; if (key === REACT_FRAGMENT_TYPE) { - if (7 === child.tag) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber( - child, + if (7 === currentFirstChild.tag) { + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber( + currentFirstChild, newChild.props.children ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes.return = returnFiber; + returnFiber = lanes; break a; } } else if ( - child.elementType === key || + currentFirstChild.elementType === key || ("object" === typeof key && null !== key && key.$$typeof === REACT_LAZY_TYPE && - resolveLazy(key) === child.type) + resolveLazy(key) === currentFirstChild.type) ) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber(child, newChild.props); - coerceRef(returnFiber, child, currentFirstChild, newChild); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber(currentFirstChild, newChild.props); + lanes.ref = newChild.ref; + lanes.return = returnFiber; + returnFiber = lanes; break a; } - deleteRemainingChildren(returnFiber, child); + deleteRemainingChildren(returnFiber, currentFirstChild); break; - } else deleteChild(returnFiber, child); - child = child.sibling; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; } newChild.type === REACT_FRAGMENT_TYPE - ? ((currentFirstChild = createFiberFromFragment( + ? ((lanes = createFiberFromFragment( newChild.props.children, returnFiber.mode, lanes, newChild.key )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes.return = returnFiber), + (returnFiber = lanes)) : ((lanes = createFiberFromTypeAndProps( newChild.type, newChild.key, @@ -3579,15 +3527,15 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, currentFirstChild, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), (returnFiber = lanes)); } return placeSingleChild(returnFiber); case REACT_PORTAL_TYPE: a: { - for (child = newChild.key; null !== currentFirstChild; ) { - if (currentFirstChild.key === child) + for (key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) if ( 4 === currentFirstChild.tag && currentFirstChild.stateNode.containerInfo === @@ -3599,12 +3547,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber, currentFirstChild.sibling ); - currentFirstChild = useFiber( - currentFirstChild, - newChild.children || [] - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = useFiber(currentFirstChild, newChild.children || []); + lanes.return = returnFiber; + returnFiber = lanes; break a; } else { deleteRemainingChildren(returnFiber, currentFirstChild); @@ -3613,22 +3558,18 @@ function createChildReconciler(shouldTrackSideEffects) { else deleteChild(returnFiber, currentFirstChild); currentFirstChild = currentFirstChild.sibling; } - currentFirstChild = createFiberFromPortal( - newChild, - returnFiber.mode, - lanes - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = createFiberFromPortal(newChild, returnFiber.mode, lanes); + lanes.return = returnFiber; + returnFiber = lanes; } return placeSingleChild(returnFiber); case REACT_LAZY_TYPE: return ( - (child = newChild._init), + (key = newChild._init), reconcileChildFibersImpl( returnFiber, currentFirstChild, - child(newChild._payload), + key(newChild._payload), lanes ) ); @@ -3669,17 +3610,13 @@ function createChildReconciler(shouldTrackSideEffects) { ? ((newChild = "" + newChild), null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), - (currentFirstChild = useFiber(currentFirstChild, newChild)), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes = useFiber(currentFirstChild, newChild)), + (lanes.return = returnFiber), + (returnFiber = lanes)) : (deleteRemainingChildren(returnFiber, currentFirstChild), - (currentFirstChild = createFiberFromText( - newChild, - returnFiber.mode, - lanes - )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)), + (lanes = createFiberFromText(newChild, returnFiber.mode, lanes)), + (lanes.return = returnFiber), + (returnFiber = lanes)), placeSingleChild(returnFiber)) : deleteRemainingChildren(returnFiber, currentFirstChild); } @@ -3772,9 +3709,7 @@ function findFirstSuspended(row) { } return null; } -var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, - renderLanes = 0, +var renderLanes = 0, currentlyRenderingFiber$1 = null, currentHook = null, workInProgressHook = null, @@ -3808,7 +3743,7 @@ function renderWithHooks( workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; - ReactCurrentDispatcher$1.current = + ReactSharedInternals.H = null === current || null === current.memoizedState ? HooksDispatcherOnMount : HooksDispatcherOnUpdate; @@ -3826,7 +3761,7 @@ function renderWithHooks( return current; } function finishRenderingHooks() { - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + ReactSharedInternals.H = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; @@ -3852,17 +3787,23 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { numberOfReRenders += 1; workInProgressHook = currentHook = null; workInProgress.updateQueue = null; - ReactCurrentDispatcher$1.current = HooksDispatcherOnRerender; + ReactSharedInternals.H = HooksDispatcherOnRerender; var children = Component(props, secondArg); } while (didScheduleRenderPhaseUpdateDuringThisPass); return children; } function TransitionAwareHostComponent() { if (!enableAsyncActions) throw Error("Not implemented."); - var maybeThenable = ReactCurrentDispatcher$1.current.useState()[0]; - return "function" === typeof maybeThenable.then - ? useThenable(maybeThenable) - : maybeThenable; + var dispatcher = ReactSharedInternals.H, + maybeThenable = dispatcher.useState()[0]; + maybeThenable = + "function" === typeof maybeThenable.then + ? useThenable(maybeThenable) + : maybeThenable; + dispatcher = dispatcher.useState()[0]; + (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher && + (currentlyRenderingFiber$1.flags |= 1024); + return maybeThenable; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; @@ -3950,7 +3891,7 @@ function useThenable(thenable) { (null === workInProgressHook ? null === currentlyRenderingFiber$1.memoizedState : null === workInProgressHook.next) && - (ReactCurrentDispatcher$1.current = HooksDispatcherOnMount); + (ReactSharedInternals.H = HooksDispatcherOnMount); return thenable; } function use(usable) { @@ -4284,9 +4225,9 @@ function dispatchActionState( function runActionStateAction(actionQueue, setPendingState, setState, payload) { var action = actionQueue.action, prevState = actionQueue.state, - prevTransition = ReactCurrentBatchConfig$2.transition, + prevTransition = ReactSharedInternals.T, currentTransition = { _callbacks: new Set() }; - ReactCurrentBatchConfig$2.transition = currentTransition; + ReactSharedInternals.T = currentTransition; setPendingState(!0); try { var returnValue = action(prevState, payload); @@ -4319,7 +4260,7 @@ function runActionStateAction(actionQueue, setPendingState, setState, payload) { setState({ then: function () {}, status: "rejected", reason: error }), finishRunningActionStateAction(actionQueue, setPendingState, setState); } finally { - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactSharedInternals.T = prevTransition; } } function finishRunningActionStateAction( @@ -4559,14 +4500,14 @@ function startTransition(fiber, queue, pendingState, finishedState, callback) { var previousPriority = currentUpdatePriority; currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; - var prevTransition = ReactCurrentBatchConfig$2.transition, + var prevTransition = ReactSharedInternals.T, currentTransition = { _callbacks: new Set() }; enableAsyncActions - ? ((ReactCurrentBatchConfig$2.transition = currentTransition), + ? ((ReactSharedInternals.T = currentTransition), dispatchOptimisticSetState(fiber, !1, queue, pendingState)) - : ((ReactCurrentBatchConfig$2.transition = null), + : ((ReactSharedInternals.T = null), dispatchSetState(fiber, queue, pendingState), - (ReactCurrentBatchConfig$2.transition = currentTransition)); + (ReactSharedInternals.T = currentTransition)); try { if (enableAsyncActions) { var returnValue = callback(); @@ -4593,7 +4534,7 @@ function startTransition(fiber, queue, pendingState, finishedState, callback) { else throw error; } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$2.transition = prevTransition); + (ReactSharedInternals.T = prevTransition); } } function useHostTransitionStatus() { @@ -5146,7 +5087,7 @@ function resolveClassComponentProps( (Component = Component.defaultProps) && (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps) ) { - newProps = assign({}, newProps, baseProps); + newProps === baseProps && (newProps = assign({}, newProps, baseProps)); for (var propName in Component) void 0 === newProps[propName] && (newProps[propName] = Component[propName]); @@ -5413,8 +5354,7 @@ function throwException( } while (null !== returnFiber); return !1; } -var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner, - SelectiveHydrationException = Error( +var SelectiveHydrationException = Error( "This is not a real error. It's an implementation detail of React's selective hydration feature. If this leaks into userspace, it's a bug in React. Please file an issue." ), didReceiveUpdate = !1; @@ -5629,8 +5569,22 @@ function markRef(current, workInProgress) { throw Error( "Expected ref to be a function, an object returned by React.createRef(), or undefined/null." ); - if (null === current || current.ref !== ref) + if (null === current || current.ref !== ref) { + if ( + null !== current && + ((current = current.ref), + "function" === typeof current && + "function" === typeof ref && + "string" === typeof current.__stringRef && + current.__stringRef === ref.__stringRef && + current.__stringRefType === ref.__stringRefType && + current.__stringRefOwner === ref.__stringRefOwner) + ) { + workInProgress.ref = current; + return; + } workInProgress.flags |= 2097664; + } } } function updateFunctionComponent( @@ -5911,7 +5865,7 @@ function finishClassComponent( bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) ); shouldUpdate = workInProgress.stateNode; - ReactCurrentOwner$1.current = workInProgress; + ReactSharedInternals.owner = workInProgress; var nextChildren = didCaptureError && "function" !== typeof Component.getDerivedStateFromError ? null @@ -7123,9 +7077,8 @@ function releaseCache(cache) { cache.controller.abort(); }); } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; function requestCurrentTransition() { - var transition = ReactCurrentBatchConfig$1.transition; + var transition = ReactSharedInternals.T; null !== transition && transition._callbacks.add(handleAsyncAction); return transition; } @@ -8326,7 +8279,7 @@ function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { captureCommitPhaseError(childToDelete, parentFiber, error); } } - if (parentFiber.subtreeFlags & 12854) + if (parentFiber.subtreeFlags & 13878) for (parentFiber = parentFiber.child; null !== parentFiber; ) commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), (parentFiber = parentFiber.sibling); @@ -9220,10 +9173,6 @@ var DefaultCacheDispatcher = { } }, PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, - ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, executionContext = 0, workInProgressRoot = null, workInProgress = null, @@ -9261,8 +9210,8 @@ function requestUpdateLane(fiber) { (fiber = currentEntangledLane), 0 !== fiber ? fiber : requestTransitionLane() ); - fiber = currentUpdatePriority; - return 0 !== fiber ? fiber : 32; + fiber = 0 !== currentUpdatePriority ? currentUpdatePriority : 32; + return fiber; } function requestDeferredLane() { 0 === workInProgressDeferredLane && @@ -9338,13 +9287,18 @@ function performConcurrentWorkOnRoot(root, didTimeout) { root, renderWasConcurrent ); - 0 !== errorRetryLanes && + if ( + 0 !== errorRetryLanes && ((lanes = errorRetryLanes), (exitStatus = recoverFromConcurrentError( root, renderWasConcurrent, errorRetryLanes - ))); + )), + (renderWasConcurrent = !1), + 2 !== exitStatus) + ) + continue; } if (1 === exitStatus) { prepareFreshStack(root, 0); @@ -9640,8 +9594,8 @@ function prepareFreshStack(root, lanes) { } function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - ReactCurrentOwner.current = null; + ReactSharedInternals.H = ContextOnlyDispatcher; + ReactSharedInternals.owner = null; if (thrownValue === SuspenseException) { thrownValue = getSuspendedThenable(); var handler = suspenseHandlerStackCursor.current; @@ -9679,13 +9633,13 @@ function handleThrow(root, thrownValue) { )); } function pushDispatcher() { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = ContextOnlyDispatcher; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = ContextOnlyDispatcher; return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; } function pushCacheDispatcher() { - var prevCacheDispatcher = ReactCurrentCache.current; - ReactCurrentCache.current = DefaultCacheDispatcher; + var prevCacheDispatcher = ReactSharedInternals.C; + ReactSharedInternals.C = DefaultCacheDispatcher; return prevCacheDispatcher; } function renderDidSuspendDelayIfPossible() { @@ -9737,8 +9691,8 @@ function renderRootSync(root, lanes) { lanes && root.shellSuspendCounter++; resetContextDependencies(); executionContext = prevExecutionContext; - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; + ReactSharedInternals.H = prevDispatcher; + ReactSharedInternals.C = prevCacheDispatcher; if (null !== workInProgress) throw Error( "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." @@ -9844,8 +9798,8 @@ function renderRootConcurrent(root, lanes) { } while (1); resetContextDependencies(); - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; + ReactSharedInternals.H = prevDispatcher; + ReactSharedInternals.C = prevCacheDispatcher; executionContext = prevExecutionContext; if (null !== workInProgress) return 0; workInProgressRoot = null; @@ -9861,7 +9815,7 @@ function performUnitOfWork(unitOfWork) { var next = beginWork(unitOfWork.alternate, unitOfWork, entangledRenderLanes); unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; } function replaySuspendedUnitOfWork(unitOfWork) { var current = unitOfWork.alternate; @@ -9917,7 +9871,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { null === current ? completeUnitOfWork(unitOfWork) : (workInProgress = current); - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -10004,11 +9958,11 @@ function commitRoot( didIncludeRenderPhaseUpdate, spawnedLane ) { - var previousUpdateLanePriority = currentUpdatePriority, - prevTransition = ReactCurrentBatchConfig.transition; + var prevTransition = ReactSharedInternals.T, + previousUpdateLanePriority = currentUpdatePriority; try { - (ReactCurrentBatchConfig.transition = null), - (currentUpdatePriority = 2), + (currentUpdatePriority = 2), + (ReactSharedInternals.T = null), commitRootImpl( root, recoverableErrors, @@ -10018,7 +9972,7 @@ function commitRoot( spawnedLane ); } finally { - (ReactCurrentBatchConfig.transition = prevTransition), + (ReactSharedInternals.T = prevTransition), (currentUpdatePriority = previousUpdateLanePriority); } return null; @@ -10066,13 +10020,13 @@ function commitRootImpl( })); transitions = 0 !== (finishedWork.flags & 15990); if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = null; + transitions = ReactSharedInternals.T; + ReactSharedInternals.T = null; spawnedLane = currentUpdatePriority; currentUpdatePriority = 2; var prevExecutionContext = executionContext; executionContext |= 4; - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; commitBeforeMutationEffects(root, finishedWork); commitMutationEffectsOnFiber(finishedWork, root); root.current = finishedWork; @@ -10080,7 +10034,7 @@ function commitRootImpl( requestPaint(); executionContext = prevExecutionContext; currentUpdatePriority = spawnedLane; - ReactCurrentBatchConfig.transition = transitions; + ReactSharedInternals.T = transitions; } else root.current = finishedWork; rootDoesHavePassiveEffects ? ((rootDoesHavePassiveEffects = !1), @@ -10127,16 +10081,15 @@ function flushPassiveEffects() { remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), - priority = 32 > renderPriority ? 32 : renderPriority; - renderPriority = ReactCurrentBatchConfig.transition; - var previousPriority = currentUpdatePriority; + prevTransition = ReactSharedInternals.T, + previousPriority = currentUpdatePriority; try { - ReactCurrentBatchConfig.transition = null; - currentUpdatePriority = priority; + currentUpdatePriority = 32 > renderPriority ? 32 : renderPriority; + ReactSharedInternals.T = null; if (null === rootWithPendingPassiveEffects) var JSCompiler_inline_result = !1; else { - priority = pendingPassiveTransitions; + renderPriority = pendingPassiveTransitions; pendingPassiveTransitions = null; var root$jscomp$0 = rootWithPendingPassiveEffects, lanes = pendingPassiveEffectsLanes; @@ -10151,7 +10104,7 @@ function flushPassiveEffects() { root$jscomp$0, root$jscomp$0.current, lanes, - priority + renderPriority ); executionContext = prevExecutionContext; flushSyncWorkAcrossRoots_impl(!1); @@ -10167,7 +10120,7 @@ function flushPassiveEffects() { return JSCompiler_inline_result; } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig.transition = renderPriority), + (ReactSharedInternals.T = prevTransition), releaseRootPooledCache(root, remainingLanes); } } @@ -10772,6 +10725,13 @@ function getInspectorDataForInstance(closestInstance) { componentStack: "" }; closestInstance = findCurrentFiberUsingSlowPath(closestInstance); + if (null === closestInstance) + return { + hierarchy: [], + props: emptyObject, + selectedIndex: null, + componentStack: "" + }; var hierarchy = []; traverseOwnerTreeUp(hierarchy, closestInstance); var JSCompiler_inline_result; @@ -10792,10 +10752,7 @@ function getInspectorDataForInstance(closestInstance) { instance = createHierarchy(hierarchy); var props = getHostProps(JSCompiler_inline_result); hierarchy = hierarchy.indexOf(JSCompiler_inline_result); - closestInstance = - null !== closestInstance - ? getStackByFiberInDevAndProd(closestInstance) - : ""; + closestInstance = getStackByFiberInDevAndProd(closestInstance); return { closestInstance: JSCompiler_inline_result, hierarchy: instance, @@ -10805,9 +10762,11 @@ function getInspectorDataForInstance(closestInstance) { }; } function traverseOwnerTreeUp(hierarchy, instance) { - instance && - (hierarchy.unshift(instance), - traverseOwnerTreeUp(hierarchy, instance._debugOwner)); + hierarchy.unshift(instance); + instance = instance._debugOwner; + null != instance && + "number" === typeof instance.tag && + traverseOwnerTreeUp(hierarchy, instance); } if ( "function" !== @@ -10854,10 +10813,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1163 = { + devToolsConfig$jscomp$inline_1168 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "19.0.0-canary-495cb589", + version: "19.0.0-canary-69bc894f", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10873,11 +10832,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1416 = { - bundleType: devToolsConfig$jscomp$inline_1163.bundleType, - version: devToolsConfig$jscomp$inline_1163.version, - rendererPackageName: devToolsConfig$jscomp$inline_1163.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1163.rendererConfig, +var internals$jscomp$inline_1452 = { + bundleType: devToolsConfig$jscomp$inline_1168.bundleType, + version: devToolsConfig$jscomp$inline_1168.version, + rendererPackageName: devToolsConfig$jscomp$inline_1168.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1168.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10887,32 +10846,32 @@ var internals$jscomp$inline_1416 = { setErrorHandler: null, setSuspenseHandler: null, scheduleUpdate: null, - currentDispatcherRef: ReactSharedInternals.ReactCurrentDispatcher, + currentDispatcherRef: ReactSharedInternals, findHostInstanceByFiber: function (fiber) { fiber = findCurrentHostFiber(fiber); return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1163.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1168.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-495cb589" + reconcilerVersion: "19.0.0-canary-69bc894f" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1417 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1453 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1417.isDisabled && - hook$jscomp$inline_1417.supportsFiber + !hook$jscomp$inline_1453.isDisabled && + hook$jscomp$inline_1453.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1417.inject( - internals$jscomp$inline_1416 + (rendererID = hook$jscomp$inline_1453.inject( + internals$jscomp$inline_1452 )), - (injectedHook = hook$jscomp$inline_1417); + (injectedHook = hook$jscomp$inline_1453); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js index 5bbaedc84c..a7fc845507 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<434690ae3c6bd7083e119ab852376c3e>> */ "use strict"; @@ -1115,7 +1115,7 @@ ResponderEventPlugin.injection.injectGlobalResponderHandler({ } }); var ReactSharedInternals = - React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, alwaysThrottleRetries = dynamicFlagsUntyped.alwaysThrottleRetries, consoleManagedByDevToolsDuringStrictMode = dynamicFlagsUntyped.consoleManagedByDevToolsDuringStrictMode, @@ -2036,7 +2036,6 @@ function movePendingFibersToMemoized(root, lanes) { lanes &= ~root; } } -var currentUpdatePriority = 0; function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes @@ -2089,6 +2088,7 @@ function getPublicInstance(instance) { } var scheduleTimeout = setTimeout, cancelTimeout = clearTimeout, + currentUpdatePriority = 0, valueStack = [], index = -1; function createCursor(defaultValue) { @@ -2202,7 +2202,7 @@ function describeBuiltInComponentFrame(name) { } return "\n" + prefix + name; } - return describeComponentFrame(name, null); + return "\n in " + (name || "Unknown"); } var reentry = !1; function describeNativeComponentFrame(fn, construct) { @@ -2336,16 +2336,11 @@ function describeNativeComponentFrame(fn, construct) { ? describeBuiltInComponentFrame(previousPrepareStackTrace) : ""; } -function describeComponentFrame(name, ownerName) { - var sourceInfo = ""; - ownerName && (sourceInfo = " (created by " + ownerName + ")"); - return "\n in " + (name || "Unknown") + sourceInfo; -} function describeFunctionComponentFrame(fn) { return enableComponentStackLocations ? describeNativeComponentFrame(fn, !1) : fn - ? describeComponentFrame(fn.displayName || fn.name || null, null) + ? "\n in " + (fn.displayName || fn.name || "Unknown") : ""; } function describeFiber(fiber) { @@ -3087,55 +3082,6 @@ function unwrapThenable(thenable) { null === thenableState$1 && (thenableState$1 = []); return trackUsedThenable(thenableState$1, thenable, index); } -function convertStringRefToCallbackRef( - returnFiber, - current, - element, - mixedRef -) { - function ref(value) { - var refs = inst.refs; - null === value ? delete refs[stringRef] : (refs[stringRef] = value); - } - var stringRef = "" + mixedRef; - returnFiber = element._owner; - if (!returnFiber) - throw Error( - "Element ref was specified as a string (" + - stringRef + - ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://react.dev/link/refs-must-have-owner for more information." - ); - if (1 !== returnFiber.tag) - throw Error( - "Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref" - ); - var inst = returnFiber.stateNode; - if (!inst) - throw Error( - "Missing owner for string ref " + - stringRef + - ". This error is likely caused by a bug in React. Please file an issue." - ); - if ( - null !== current && - null !== current.ref && - "function" === typeof current.ref && - current.ref._stringRef === stringRef - ) - return current.ref; - ref._stringRef = stringRef; - return ref; -} -function coerceRef(returnFiber, current, workInProgress, element) { - var mixedRef = element.ref; - returnFiber = - "string" === typeof mixedRef || - "number" === typeof mixedRef || - "boolean" === typeof mixedRef - ? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef) - : mixedRef; - workInProgress.ref = returnFiber; -} function throwOnInvalidObjectType(returnFiber, newChild) { returnFiber = Object.prototype.toString.call(newChild); throw Error( @@ -3231,12 +3177,12 @@ function createChildReconciler(shouldTrackSideEffects) { resolveLazy(elementType) === current.type)) ) return ( - (lanes = useFiber(current, element.props)), - coerceRef(returnFiber, current, lanes, element), - (lanes.return = returnFiber), - lanes + (current = useFiber(current, element.props)), + (current.ref = element.ref), + (current.return = returnFiber), + current ); - lanes = createFiberFromTypeAndProps( + current = createFiberFromTypeAndProps( element.type, element.key, element.props, @@ -3244,9 +3190,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes ); - coerceRef(returnFiber, current, lanes, element); - lanes.return = returnFiber; - return lanes; + current.ref = element.ref; + current.return = returnFiber; + return current; } function updatePortal(returnFiber, current, portal, lanes) { if ( @@ -3307,7 +3253,7 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, null, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), lanes ); @@ -3647,52 +3593,54 @@ function createChildReconciler(shouldTrackSideEffects) { switch (newChild.$$typeof) { case REACT_ELEMENT_TYPE: a: { - for ( - var key = newChild.key, child = currentFirstChild; - null !== child; - - ) { - if (child.key === key) { + for (var key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) { key = newChild.type; if (key === REACT_FRAGMENT_TYPE) { - if (7 === child.tag) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber( - child, + if (7 === currentFirstChild.tag) { + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber( + currentFirstChild, newChild.props.children ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes.return = returnFiber; + returnFiber = lanes; break a; } } else if ( - child.elementType === key || + currentFirstChild.elementType === key || ("object" === typeof key && null !== key && key.$$typeof === REACT_LAZY_TYPE && - resolveLazy(key) === child.type) + resolveLazy(key) === currentFirstChild.type) ) { - deleteRemainingChildren(returnFiber, child.sibling); - currentFirstChild = useFiber(child, newChild.props); - coerceRef(returnFiber, child, currentFirstChild, newChild); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + deleteRemainingChildren( + returnFiber, + currentFirstChild.sibling + ); + lanes = useFiber(currentFirstChild, newChild.props); + lanes.ref = newChild.ref; + lanes.return = returnFiber; + returnFiber = lanes; break a; } - deleteRemainingChildren(returnFiber, child); + deleteRemainingChildren(returnFiber, currentFirstChild); break; - } else deleteChild(returnFiber, child); - child = child.sibling; + } else deleteChild(returnFiber, currentFirstChild); + currentFirstChild = currentFirstChild.sibling; } newChild.type === REACT_FRAGMENT_TYPE - ? ((currentFirstChild = createFiberFromFragment( + ? ((lanes = createFiberFromFragment( newChild.props.children, returnFiber.mode, lanes, newChild.key )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes.return = returnFiber), + (returnFiber = lanes)) : ((lanes = createFiberFromTypeAndProps( newChild.type, newChild.key, @@ -3701,15 +3649,15 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber.mode, lanes )), - coerceRef(returnFiber, currentFirstChild, lanes, newChild), + (lanes.ref = newChild.ref), (lanes.return = returnFiber), (returnFiber = lanes)); } return placeSingleChild(returnFiber); case REACT_PORTAL_TYPE: a: { - for (child = newChild.key; null !== currentFirstChild; ) { - if (currentFirstChild.key === child) + for (key = newChild.key; null !== currentFirstChild; ) { + if (currentFirstChild.key === key) if ( 4 === currentFirstChild.tag && currentFirstChild.stateNode.containerInfo === @@ -3721,12 +3669,9 @@ function createChildReconciler(shouldTrackSideEffects) { returnFiber, currentFirstChild.sibling ); - currentFirstChild = useFiber( - currentFirstChild, - newChild.children || [] - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = useFiber(currentFirstChild, newChild.children || []); + lanes.return = returnFiber; + returnFiber = lanes; break a; } else { deleteRemainingChildren(returnFiber, currentFirstChild); @@ -3735,22 +3680,18 @@ function createChildReconciler(shouldTrackSideEffects) { else deleteChild(returnFiber, currentFirstChild); currentFirstChild = currentFirstChild.sibling; } - currentFirstChild = createFiberFromPortal( - newChild, - returnFiber.mode, - lanes - ); - currentFirstChild.return = returnFiber; - returnFiber = currentFirstChild; + lanes = createFiberFromPortal(newChild, returnFiber.mode, lanes); + lanes.return = returnFiber; + returnFiber = lanes; } return placeSingleChild(returnFiber); case REACT_LAZY_TYPE: return ( - (child = newChild._init), + (key = newChild._init), reconcileChildFibersImpl( returnFiber, currentFirstChild, - child(newChild._payload), + key(newChild._payload), lanes ) ); @@ -3791,17 +3732,13 @@ function createChildReconciler(shouldTrackSideEffects) { ? ((newChild = "" + newChild), null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), - (currentFirstChild = useFiber(currentFirstChild, newChild)), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)) + (lanes = useFiber(currentFirstChild, newChild)), + (lanes.return = returnFiber), + (returnFiber = lanes)) : (deleteRemainingChildren(returnFiber, currentFirstChild), - (currentFirstChild = createFiberFromText( - newChild, - returnFiber.mode, - lanes - )), - (currentFirstChild.return = returnFiber), - (returnFiber = currentFirstChild)), + (lanes = createFiberFromText(newChild, returnFiber.mode, lanes)), + (lanes.return = returnFiber), + (returnFiber = lanes)), placeSingleChild(returnFiber)) : deleteRemainingChildren(returnFiber, currentFirstChild); } @@ -3894,9 +3831,7 @@ function findFirstSuspended(row) { } return null; } -var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, - renderLanes = 0, +var renderLanes = 0, currentlyRenderingFiber$1 = null, currentHook = null, workInProgressHook = null, @@ -3930,7 +3865,7 @@ function renderWithHooks( workInProgress.memoizedState = null; workInProgress.updateQueue = null; workInProgress.lanes = 0; - ReactCurrentDispatcher$1.current = + ReactSharedInternals.H = null === current || null === current.memoizedState ? HooksDispatcherOnMount : HooksDispatcherOnUpdate; @@ -3948,7 +3883,7 @@ function renderWithHooks( return current; } function finishRenderingHooks() { - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + ReactSharedInternals.H = ContextOnlyDispatcher; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; renderLanes = 0; workInProgressHook = currentHook = currentlyRenderingFiber$1 = null; @@ -3974,17 +3909,23 @@ function renderWithHooksAgain(workInProgress, Component, props, secondArg) { numberOfReRenders += 1; workInProgressHook = currentHook = null; workInProgress.updateQueue = null; - ReactCurrentDispatcher$1.current = HooksDispatcherOnRerender; + ReactSharedInternals.H = HooksDispatcherOnRerender; var children = Component(props, secondArg); } while (didScheduleRenderPhaseUpdateDuringThisPass); return children; } function TransitionAwareHostComponent() { if (!enableAsyncActions) throw Error("Not implemented."); - var maybeThenable = ReactCurrentDispatcher$1.current.useState()[0]; - return "function" === typeof maybeThenable.then - ? useThenable(maybeThenable) - : maybeThenable; + var dispatcher = ReactSharedInternals.H, + maybeThenable = dispatcher.useState()[0]; + maybeThenable = + "function" === typeof maybeThenable.then + ? useThenable(maybeThenable) + : maybeThenable; + dispatcher = dispatcher.useState()[0]; + (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher && + (currentlyRenderingFiber$1.flags |= 1024); + return maybeThenable; } function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; @@ -4072,7 +4013,7 @@ function useThenable(thenable) { (null === workInProgressHook ? null === currentlyRenderingFiber$1.memoizedState : null === workInProgressHook.next) && - (ReactCurrentDispatcher$1.current = HooksDispatcherOnMount); + (ReactSharedInternals.H = HooksDispatcherOnMount); return thenable; } function use(usable) { @@ -4406,9 +4347,9 @@ function dispatchActionState( function runActionStateAction(actionQueue, setPendingState, setState, payload) { var action = actionQueue.action, prevState = actionQueue.state, - prevTransition = ReactCurrentBatchConfig$2.transition, + prevTransition = ReactSharedInternals.T, currentTransition = { _callbacks: new Set() }; - ReactCurrentBatchConfig$2.transition = currentTransition; + ReactSharedInternals.T = currentTransition; setPendingState(!0); try { var returnValue = action(prevState, payload); @@ -4441,7 +4382,7 @@ function runActionStateAction(actionQueue, setPendingState, setState, payload) { setState({ then: function () {}, status: "rejected", reason: error }), finishRunningActionStateAction(actionQueue, setPendingState, setState); } finally { - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactSharedInternals.T = prevTransition; } } function finishRunningActionStateAction( @@ -4681,14 +4622,14 @@ function startTransition(fiber, queue, pendingState, finishedState, callback) { var previousPriority = currentUpdatePriority; currentUpdatePriority = 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8; - var prevTransition = ReactCurrentBatchConfig$2.transition, + var prevTransition = ReactSharedInternals.T, currentTransition = { _callbacks: new Set() }; enableAsyncActions - ? ((ReactCurrentBatchConfig$2.transition = currentTransition), + ? ((ReactSharedInternals.T = currentTransition), dispatchOptimisticSetState(fiber, !1, queue, pendingState)) - : ((ReactCurrentBatchConfig$2.transition = null), + : ((ReactSharedInternals.T = null), dispatchSetState(fiber, queue, pendingState), - (ReactCurrentBatchConfig$2.transition = currentTransition)); + (ReactSharedInternals.T = currentTransition)); try { if (enableAsyncActions) { var returnValue = callback(); @@ -4715,7 +4656,7 @@ function startTransition(fiber, queue, pendingState, finishedState, callback) { else throw error; } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig$2.transition = prevTransition); + (ReactSharedInternals.T = prevTransition); } } function useHostTransitionStatus() { @@ -5338,7 +5279,7 @@ function resolveClassComponentProps( (Component = Component.defaultProps) && (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps) ) { - newProps = assign({}, newProps, baseProps); + newProps === baseProps && (newProps = assign({}, newProps, baseProps)); for (var propName in Component) void 0 === newProps[propName] && (newProps[propName] = Component[propName]); @@ -5606,8 +5547,7 @@ function throwException( } while (null !== returnFiber); return !1; } -var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner, - SelectiveHydrationException = Error( +var SelectiveHydrationException = Error( "This is not a real error. It's an implementation detail of React's selective hydration feature. If this leaks into userspace, it's a bug in React. Please file an issue." ), didReceiveUpdate = !1; @@ -5824,8 +5764,22 @@ function markRef(current, workInProgress) { throw Error( "Expected ref to be a function, an object returned by React.createRef(), or undefined/null." ); - if (null === current || current.ref !== ref) + if (null === current || current.ref !== ref) { + if ( + null !== current && + ((current = current.ref), + "function" === typeof current && + "function" === typeof ref && + "string" === typeof current.__stringRef && + current.__stringRef === ref.__stringRef && + current.__stringRefType === ref.__stringRefType && + current.__stringRefOwner === ref.__stringRefOwner) + ) { + workInProgress.ref = current; + return; + } workInProgress.flags |= 2097664; + } } } function updateFunctionComponent( @@ -6110,7 +6064,7 @@ function finishClassComponent( bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) ); shouldUpdate = workInProgress.stateNode; - ReactCurrentOwner$1.current = workInProgress; + ReactSharedInternals.owner = workInProgress; if ( didCaptureError && "function" !== typeof Component.getDerivedStateFromError @@ -7353,9 +7307,8 @@ function releaseCache(cache) { cache.controller.abort(); }); } -var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; function requestCurrentTransition() { - var transition = ReactCurrentBatchConfig$1.transition; + var transition = ReactSharedInternals.T; null !== transition && transition._callbacks.add(handleAsyncAction); return transition; } @@ -8792,7 +8745,7 @@ function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) { captureCommitPhaseError(childToDelete, parentFiber, error); } } - if (parentFiber.subtreeFlags & 12854) + if (parentFiber.subtreeFlags & 13878) for (parentFiber = parentFiber.child; null !== parentFiber; ) commitMutationEffectsOnFiber(parentFiber, root$jscomp$0), (parentFiber = parentFiber.sibling); @@ -9748,10 +9701,6 @@ var DefaultCacheDispatcher = { } }, PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, - ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentCache = ReactSharedInternals.ReactCurrentCache, - ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner, - ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig, executionContext = 0, workInProgressRoot = null, workInProgress = null, @@ -9790,8 +9739,8 @@ function requestUpdateLane(fiber) { (fiber = currentEntangledLane), 0 !== fiber ? fiber : requestTransitionLane() ); - fiber = currentUpdatePriority; - return 0 !== fiber ? fiber : 32; + fiber = 0 !== currentUpdatePriority ? currentUpdatePriority : 32; + return fiber; } function requestDeferredLane() { 0 === workInProgressDeferredLane && @@ -9869,13 +9818,18 @@ function performConcurrentWorkOnRoot(root, didTimeout) { root, renderWasConcurrent ); - 0 !== errorRetryLanes && + if ( + 0 !== errorRetryLanes && ((lanes = errorRetryLanes), (exitStatus = recoverFromConcurrentError( root, renderWasConcurrent, errorRetryLanes - ))); + )), + (renderWasConcurrent = !1), + 2 !== exitStatus) + ) + continue; } if (1 === exitStatus) { prepareFreshStack(root, 0); @@ -10173,8 +10127,8 @@ function prepareFreshStack(root, lanes) { } function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - ReactCurrentOwner.current = null; + ReactSharedInternals.H = ContextOnlyDispatcher; + ReactSharedInternals.owner = null; if (thrownValue === SuspenseException) { thrownValue = getSuspendedThenable(); var handler = suspenseHandlerStackCursor.current; @@ -10241,13 +10195,13 @@ function handleThrow(root, thrownValue) { } } function pushDispatcher() { - var prevDispatcher = ReactCurrentDispatcher.current; - ReactCurrentDispatcher.current = ContextOnlyDispatcher; + var prevDispatcher = ReactSharedInternals.H; + ReactSharedInternals.H = ContextOnlyDispatcher; return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher; } function pushCacheDispatcher() { - var prevCacheDispatcher = ReactCurrentCache.current; - ReactCurrentCache.current = DefaultCacheDispatcher; + var prevCacheDispatcher = ReactSharedInternals.C; + ReactSharedInternals.C = DefaultCacheDispatcher; return prevCacheDispatcher; } function renderDidSuspendDelayIfPossible() { @@ -10309,8 +10263,8 @@ function renderRootSync(root, lanes) { lanes && root.shellSuspendCounter++; resetContextDependencies(); executionContext = prevExecutionContext; - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; + ReactSharedInternals.H = prevDispatcher; + ReactSharedInternals.C = prevCacheDispatcher; if (null !== workInProgress) throw Error( "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." @@ -10427,8 +10381,8 @@ function renderRootConcurrent(root, lanes) { } while (1); resetContextDependencies(); - ReactCurrentDispatcher.current = prevDispatcher; - ReactCurrentCache.current = prevCacheDispatcher; + ReactSharedInternals.H = prevDispatcher; + ReactSharedInternals.C = prevCacheDispatcher; executionContext = prevExecutionContext; if (null !== workInProgress) return ( @@ -10458,7 +10412,7 @@ function performUnitOfWork(unitOfWork) { null === current ? completeUnitOfWork(unitOfWork) : (workInProgress = current); - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; } function replaySuspendedUnitOfWork(unitOfWork) { var current = unitOfWork.alternate, @@ -10517,7 +10471,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { null === current ? completeUnitOfWork(unitOfWork) : (workInProgress = current); - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -10613,11 +10567,11 @@ function commitRoot( didIncludeRenderPhaseUpdate, spawnedLane ) { - var previousUpdateLanePriority = currentUpdatePriority, - prevTransition = ReactCurrentBatchConfig.transition; + var prevTransition = ReactSharedInternals.T, + previousUpdateLanePriority = currentUpdatePriority; try { - (ReactCurrentBatchConfig.transition = null), - (currentUpdatePriority = 2), + (currentUpdatePriority = 2), + (ReactSharedInternals.T = null), commitRootImpl( root, recoverableErrors, @@ -10627,7 +10581,7 @@ function commitRoot( spawnedLane ); } finally { - (ReactCurrentBatchConfig.transition = prevTransition), + (ReactSharedInternals.T = prevTransition), (currentUpdatePriority = previousUpdateLanePriority); } return null; @@ -10678,13 +10632,13 @@ function commitRootImpl( })); transitions = 0 !== (finishedWork.flags & 15990); if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { - transitions = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = null; + transitions = ReactSharedInternals.T; + ReactSharedInternals.T = null; spawnedLane = currentUpdatePriority; currentUpdatePriority = 2; var prevExecutionContext = executionContext; executionContext |= 4; - ReactCurrentOwner.current = null; + ReactSharedInternals.owner = null; commitBeforeMutationEffects(root, finishedWork); commitTime = now(); commitMutationEffects(root, finishedWork, lanes); @@ -10699,7 +10653,7 @@ function commitRootImpl( requestPaint(); executionContext = prevExecutionContext; currentUpdatePriority = spawnedLane; - ReactCurrentBatchConfig.transition = transitions; + ReactSharedInternals.T = transitions; } else (root.current = finishedWork), (commitTime = now()); rootDoesHavePassiveEffects ? ((rootDoesHavePassiveEffects = !1), @@ -10749,18 +10703,17 @@ function flushPassiveEffects() { remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), - priority = 32 > renderPriority ? 32 : renderPriority; - renderPriority = ReactCurrentBatchConfig.transition; - var previousPriority = currentUpdatePriority; + prevTransition = ReactSharedInternals.T, + previousPriority = currentUpdatePriority; try { - ReactCurrentBatchConfig.transition = null; - currentUpdatePriority = priority; + currentUpdatePriority = 32 > renderPriority ? 32 : renderPriority; + ReactSharedInternals.T = null; if (null === rootWithPendingPassiveEffects) var JSCompiler_inline_result = !1; else { var transitions = pendingPassiveTransitions; pendingPassiveTransitions = null; - priority = rootWithPendingPassiveEffects; + renderPriority = rootWithPendingPassiveEffects; var lanes = pendingPassiveEffectsLanes; rootWithPendingPassiveEffects = null; pendingPassiveEffectsLanes = 0; @@ -10772,10 +10725,10 @@ function flushPassiveEffects() { injectedProfilingHooks.markPassiveEffectsStarted(lanes); var prevExecutionContext = executionContext; executionContext |= 4; - commitPassiveUnmountOnFiber(priority.current); + commitPassiveUnmountOnFiber(renderPriority.current); commitPassiveMountOnFiber( - priority, - priority.current, + renderPriority, + renderPriority.current, lanes, transitions ); @@ -10828,9 +10781,9 @@ function flushPassiveEffects() { "function" === typeof injectedHook.onPostCommitFiberRoot ) try { - injectedHook.onPostCommitFiberRoot(rendererID, priority); + injectedHook.onPostCommitFiberRoot(rendererID, renderPriority); } catch (err) {} - var stateNode = priority.current.stateNode; + var stateNode = renderPriority.current.stateNode; stateNode.effectDuration = 0; stateNode.passiveEffectDuration = 0; JSCompiler_inline_result = !0; @@ -10838,7 +10791,7 @@ function flushPassiveEffects() { return JSCompiler_inline_result; } finally { (currentUpdatePriority = previousPriority), - (ReactCurrentBatchConfig.transition = renderPriority), + (ReactSharedInternals.T = prevTransition), releaseRootPooledCache(root, remainingLanes); } } @@ -11478,6 +11431,13 @@ function getInspectorDataForInstance(closestInstance) { componentStack: "" }; closestInstance = findCurrentFiberUsingSlowPath(closestInstance); + if (null === closestInstance) + return { + hierarchy: [], + props: emptyObject, + selectedIndex: null, + componentStack: "" + }; var hierarchy = []; traverseOwnerTreeUp(hierarchy, closestInstance); var JSCompiler_inline_result; @@ -11498,10 +11458,7 @@ function getInspectorDataForInstance(closestInstance) { instance = createHierarchy(hierarchy); var props = getHostProps(JSCompiler_inline_result); hierarchy = hierarchy.indexOf(JSCompiler_inline_result); - closestInstance = - null !== closestInstance - ? getStackByFiberInDevAndProd(closestInstance) - : ""; + closestInstance = getStackByFiberInDevAndProd(closestInstance); return { closestInstance: JSCompiler_inline_result, hierarchy: instance, @@ -11511,9 +11468,11 @@ function getInspectorDataForInstance(closestInstance) { }; } function traverseOwnerTreeUp(hierarchy, instance) { - instance && - (hierarchy.unshift(instance), - traverseOwnerTreeUp(hierarchy, instance._debugOwner)); + hierarchy.unshift(instance); + instance = instance._debugOwner; + null != instance && + "number" === typeof instance.tag && + traverseOwnerTreeUp(hierarchy, instance); } if ( "function" !== @@ -11560,10 +11519,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1245 = { + devToolsConfig$jscomp$inline_1248 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "19.0.0-canary-e56bfcc6", + version: "19.0.0-canary-ad58aafc", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -11593,10 +11552,10 @@ var roots = new Map(), } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1245.bundleType, - version: devToolsConfig$jscomp$inline_1245.version, - rendererPackageName: devToolsConfig$jscomp$inline_1245.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1245.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1248.bundleType, + version: devToolsConfig$jscomp$inline_1248.version, + rendererPackageName: devToolsConfig$jscomp$inline_1248.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1248.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -11606,20 +11565,20 @@ var roots = new Map(), setErrorHandler: null, setSuspenseHandler: null, scheduleUpdate: null, - currentDispatcherRef: ReactSharedInternals.ReactCurrentDispatcher, + currentDispatcherRef: ReactSharedInternals, findHostInstanceByFiber: function (fiber) { fiber = findCurrentHostFiber(fiber); return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1245.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1248.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-e56bfcc6" + reconcilerVersion: "19.0.0-canary-ad58aafc" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { computeComponentStackForErrorReporting: function (reactTag) {