diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js index 2d29b130b4..af48dd7cbb 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<955b120cad9193034a86d0bde3df7d2a>> + * @generated SignedSource<<1b15d797a9023201acc95022ba001e0f>> */ 'use strict'; @@ -1052,15 +1052,21 @@ function getCurrentFiberStackInDev() { } } -function resetCurrentDebugFiberInDEV() { - { - resetCurrentFiber(); - } -} -function setCurrentDebugFiberInDEV(fiber) { +function runWithFiberInDEV(fiber, callback, arg0, arg1, arg2, arg3, arg4) { { + var previousFiber = current; setCurrentFiber(fiber); - } + + try { + return callback(arg0, arg1, arg2, arg3, arg4); + } finally { + current = previousFiber; + } + } // These errors should never make it into a build so we don't need to encode them in codes.json + // eslint-disable-next-line react-internal/prod-error-codes + + + throw new Error('runWithFiberInDEV should never be called in production. This is a bug in React.'); } function resetCurrentFiber() { { @@ -1078,11 +1084,6 @@ function setCurrentFiber(fiber) { current = fiber; } -function getCurrentFiber() { - { - return current; - } -} function setIsRendering(rendering) { { isRendering = rendering; @@ -5357,14 +5358,9 @@ var ReactStrictModeWarnings = { didWarnAboutLegacyContext.add(fiber.type); }); var sortedNames = setToSortedString(uniqueNames); - - try { - setCurrentDebugFiberInDEV(firstFiber); - + runWithFiberInDEV(firstFiber, function () { error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://react.dev/link/legacy-context', sortedNames); - } finally { - resetCurrentDebugFiberInDEV(); - } + }); }); }; @@ -5720,12 +5716,9 @@ var warnForMissingKey = function (child, returnFiber) {}; var fiber = createFiberFromElement(child, returnFiber.mode, 0); fiber.return = returnFiber; - var prevDebugFiber = getCurrentFiber(); - setCurrentFiber(fiber); - - error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwnerAppendix); - - setCurrentFiber(prevDebugFiber); + runWithFiberInDEV(fiber, function () { + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwnerAppendix); + }); }; } // Given a fragment, validate that it can only be provided with fragment props // We do this here instead of BeginWork because the Fragment fiber doesn't have @@ -5747,12 +5740,9 @@ function validateFragmentProps(element, fiber, returnFiber) { fiber.return = returnFiber; } - var prevDebugFiber = getCurrentFiber(); - setCurrentFiber(fiber); - - error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); - - setCurrentFiber(prevDebugFiber); + runWithFiberInDEV(fiber, function (erroredKey) { + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', erroredKey); + }, key); break; } } @@ -11814,11 +11804,9 @@ function createRootErrorUpdate(root, errorInfo, lane) { }; update.callback = function () { - var prevFiber = getCurrentFiber(); // should just be the root - - setCurrentDebugFiberInDEV(errorInfo.source); - logUncaughtError(root, errorInfo); - setCurrentDebugFiberInDEV(prevFiber); + { + runWithFiberInDEV(errorInfo.source, logUncaughtError, root, errorInfo); + } }; return update; @@ -11845,11 +11833,9 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } - var prevFiber = getCurrentFiber(); // should be the error boundary - - setCurrentDebugFiberInDEV(errorInfo.source); - logCaughtError(root, fiber, errorInfo); - setCurrentDebugFiberInDEV(prevFiber); + { + runWithFiberInDEV(errorInfo.source, logCaughtError, root, fiber, errorInfo); + } }; } @@ -11862,11 +11848,9 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } - var prevFiber = getCurrentFiber(); // should be the error boundary - - setCurrentDebugFiberInDEV(errorInfo.source); - logCaughtError(root, fiber, errorInfo); - setCurrentDebugFiberInDEV(prevFiber); + { + runWithFiberInDEV(errorInfo.source, logCaughtError, root, fiber, errorInfo); + } if (typeof getDerivedStateFromError !== 'function') { // To preserve the preexisting retry behavior of error boundaries, @@ -16660,15 +16644,15 @@ function commitBeforeMutationEffects_begin() { function commitBeforeMutationEffects_complete() { while (nextEffect !== null) { var fiber = nextEffect; - setCurrentDebugFiberInDEV(fiber); try { - commitBeforeMutationEffectsOnFiber(fiber); + if (true) { + runWithFiberInDEV(fiber, commitBeforeMutationEffectsOnFiber, fiber); + } } catch (error) { captureCommitPhaseError(fiber, fiber.return, error); } - resetCurrentDebugFiberInDEV(); var sibling = fiber.sibling; if (sibling !== null) { @@ -16685,10 +16669,6 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { var current = finishedWork.alternate; var flags = finishedWork.flags; - if ((flags & Snapshot) !== NoFlags$1) { - setCurrentDebugFiberInDEV(finishedWork); - } - switch (finishedWork.tag) { case FunctionComponent: { @@ -16771,10 +16751,6 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } } } - - if ((flags & Snapshot) !== NoFlags$1) { - resetCurrentDebugFiberInDEV(); - } } function commitHookEffectListUnmount(flags, finishedWork, nearestMountedAncestor) { @@ -17164,7 +17140,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case ForwardRef: case SimpleMemoComponent: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); if (flags & Update) { commitHookLayoutEffects(finishedWork, Layout | HasEffect); @@ -17175,7 +17151,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case ClassComponent: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); if (flags & Update) { commitClassLayoutLifecycles(finishedWork, current); @@ -17194,7 +17170,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case HostRoot: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); if (flags & Callback) { // TODO: I think this is now always non-null by the time it reaches the @@ -17233,7 +17209,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case HostSingleton: case HostComponent: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); // Renderers may schedule work to be done after host components are mounted + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); // Renderers may schedule work to be done after host components are mounted // (eg DOM renderer may schedule auto-focus for inputs and form controls). // These effects should only be committed when components are first mounted, // aka when there is no current/alternate. @@ -17251,7 +17227,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case Profiler: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); // TODO: Should this fire inside an offscreen tree? Or should it wait to + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); // TODO: Should this fire inside an offscreen tree? Or should it wait to // fire when the tree becomes visible again. if (flags & Update) { @@ -17263,7 +17239,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case SuspenseComponent: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); break; } @@ -17293,14 +17269,14 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe var includeWorkInProgressEffects = (finishedWork.subtreeFlags & LayoutMask) !== NoFlags$1; recursivelyTraverseReappearLayoutEffects(finishedRoot, finishedWork, includeWorkInProgressEffects); } else { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); } offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; } } else { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); } if (flags & Ref) { @@ -17318,7 +17294,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe default: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); break; } } @@ -18028,9 +18004,10 @@ function attachSuspenseRetryListeners(finishedWork, wakeables) { }); } // This function detects when a Suspense boundary goes from visible to hidden. function commitMutationEffects(root, finishedWork, committedLanes) { - setCurrentDebugFiberInDEV(finishedWork); - commitMutationEffectsOnFiber(finishedWork, root); - resetCurrentDebugFiberInDEV(); + + { + runWithFiberInDEV(finishedWork, commitMutationEffectsOnFiber, finishedWork, root, committedLanes); + } } function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { @@ -18050,19 +18027,17 @@ function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { } } - var prevDebugFiber = getCurrentFiber(); - if (parentFiber.subtreeFlags & MutationMask) { var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); - commitMutationEffectsOnFiber(child, root); + { + runWithFiberInDEV(child, commitMutationEffectsOnFiber, child, root, lanes); + } + child = child.sibling; } } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function commitMutationEffectsOnFiber(finishedWork, root, lanes) { @@ -18077,7 +18052,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case MemoComponent: case SimpleMemoComponent: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); if (flags & Update) { @@ -18116,7 +18091,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case ClassComponent: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); if (flags & Ref) { @@ -18142,7 +18117,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case HostComponent: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); if (flags & Ref) { @@ -18205,7 +18180,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case HostText: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); if (flags & Update) { @@ -18235,7 +18210,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case HostRoot: { { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); } @@ -18245,7 +18220,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case HostPortal: { { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); } @@ -18254,7 +18229,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case SuspenseComponent: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); // TODO: We should mark a flag on the Suspense fiber itself, rather than // relying on the Offscreen fiber having a flag also being marked. The // reason is that this offscreen fiber might not be part of the work-in- @@ -18321,11 +18296,11 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden || isHidden; offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || wasHidden; - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; } else { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); } commitReconciliationEffects(finishedWork); @@ -18388,7 +18363,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case SuspenseListComponent: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); if (flags & Update) { @@ -18411,7 +18386,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { default: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); return; } @@ -18444,27 +18419,27 @@ function commitReconciliationEffects(finishedWork) { } function commitLayoutEffects(finishedWork, root, committedLanes) { - setCurrentDebugFiberInDEV(finishedWork); var current = finishedWork.alternate; - commitLayoutEffectOnFiber(root, current, finishedWork); - resetCurrentDebugFiberInDEV(); + + { + runWithFiberInDEV(finishedWork, commitLayoutEffectOnFiber, root, current, finishedWork, committedLanes); + } } function recursivelyTraverseLayoutEffects(root, parentFiber, lanes) { - var prevDebugFiber = getCurrentFiber(); - if (parentFiber.subtreeFlags & LayoutMask) { var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); var current = child.alternate; - commitLayoutEffectOnFiber(root, current, child); + + { + runWithFiberInDEV(child, commitLayoutEffectOnFiber, root, current, child, lanes); + } + child = child.sibling; } } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function disappearLayoutEffects(finishedWork) { @@ -18665,16 +18640,17 @@ function recursivelyTraverseReappearLayoutEffects(finishedRoot, parentFiber, inc // node was reused. var childShouldIncludeWorkInProgressEffects = includeWorkInProgressEffects && (parentFiber.subtreeFlags & LayoutMask) !== NoFlags$1; // TODO (Offscreen) Check: flags & (RefStatic | LayoutStatic) - var prevDebugFiber = getCurrentFiber(); var child = parentFiber.child; while (child !== null) { var current = child.alternate; - reappearLayoutEffects(finishedRoot, current, child, childShouldIncludeWorkInProgressEffects); + + { + runWithFiberInDEV(child, reappearLayoutEffects, finishedRoot, current, child, childShouldIncludeWorkInProgressEffects); + } + child = child.sibling; } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function commitHookPassiveMountEffects(finishedWork, hookFlags) { @@ -18752,25 +18728,23 @@ function commitCachePassiveMountEffect(current, finishedWork) { } function commitPassiveMountEffects(root, finishedWork, committedLanes, committedTransitions) { - setCurrentDebugFiberInDEV(finishedWork); - commitPassiveMountOnFiber(root, finishedWork, committedLanes, committedTransitions); - resetCurrentDebugFiberInDEV(); + { + runWithFiberInDEV(finishedWork, commitPassiveMountOnFiber, root, finishedWork, committedLanes, committedTransitions); + } } function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLanes, committedTransitions) { - var prevDebugFiber = getCurrentFiber(); - if (parentFiber.subtreeFlags & PassiveMask) { var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); - commitPassiveMountOnFiber(root, child, committedLanes, committedTransitions); + { + runWithFiberInDEV(child, commitPassiveMountOnFiber, root, child, committedLanes, committedTransitions); + } + child = child.sibling; } } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -18850,7 +18824,7 @@ function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, c // "Atomic" effects are ones that need to fire on every commit, // even during pre-rendering. An example is updating the reference // count on cache instances. - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions); } } else { // Legacy Mode: Fire the effects even if the tree is hidden. @@ -18910,15 +18884,15 @@ function recursivelyTraverseReconnectPassiveEffects(finishedRoot, parentFiber, c // node was reused. var childShouldIncludeWorkInProgressEffects = includeWorkInProgressEffects && (parentFiber.subtreeFlags & PassiveMask) !== NoFlags$1; // TODO (Offscreen) Check: flags & (RefStatic | LayoutStatic) - var prevDebugFiber = getCurrentFiber(); var child = parentFiber.child; while (child !== null) { - reconnectPassiveEffects(finishedRoot, child, committedLanes, committedTransitions, childShouldIncludeWorkInProgressEffects); + { + runWithFiberInDEV(child, reconnectPassiveEffects, finishedRoot, child, committedLanes, committedTransitions, childShouldIncludeWorkInProgressEffects); + } + child = child.sibling; } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function reconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, // This function visits both newly finished work and nodes that were re-used @@ -18968,7 +18942,7 @@ includeWorkInProgressEffects) { // "Atomic" effects are ones that need to fire on every commit, // even during pre-rendering. An example is updating the reference // count on cache instances. - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions); } } else { // Legacy Mode: Fire the effects even if the tree is hidden. @@ -19023,19 +18997,18 @@ function recursivelyTraverseAtomicPassiveEffects(finishedRoot, parentFiber, comm // "Atomic" effects are ones that need to fire on every commit, even during // pre-rendering. We call this function when traversing a hidden tree whose // regular effects are currently disconnected. - var prevDebugFiber = getCurrentFiber(); // TODO: Add special flag for atomic effects - + // TODO: Add special flag for atomic effects if (parentFiber.subtreeFlags & PassiveMask) { var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); - commitAtomicPassiveEffects(finishedRoot, child); + { + runWithFiberInDEV(child, commitAtomicPassiveEffects, finishedRoot, child, committedLanes, committedTransitions); + } + child = child.sibling; } } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -19047,7 +19020,7 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, switch (finishedWork.tag) { case OffscreenComponent: { - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions); if (flags & Passive$1) { // TODO: Pass `current` as argument to this function @@ -19060,7 +19033,7 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, case CacheComponent: { - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions); if (flags & Passive$1) { // TODO: Pass `current` as argument to this function @@ -19073,16 +19046,16 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, default: { - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions); break; } } } function commitPassiveUnmountEffects(finishedWork) { - setCurrentDebugFiberInDEV(finishedWork); - commitPassiveUnmountOnFiber(finishedWork); - resetCurrentDebugFiberInDEV(); + { + runWithFiberInDEV(finishedWork, commitPassiveUnmountOnFiber, finishedWork); + } } // If we're inside a brand new tree, or a tree that was already visible, then we // should only suspend host components that have a ShouldSuspendCommit flag. // Components without it haven't changed since the last commit, so we can skip @@ -19228,21 +19201,20 @@ function recursivelyTraversePassiveUnmountEffects(parentFiber) { } detachAlternateSiblings(parentFiber); - } + } // TODO: Split PassiveMask into separate masks for mount and unmount? - var prevDebugFiber = getCurrentFiber(); // TODO: Split PassiveMask into separate masks for mount and unmount? if (parentFiber.subtreeFlags & PassiveMask) { var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); - commitPassiveUnmountOnFiber(child); + { + runWithFiberInDEV(child, commitPassiveUnmountOnFiber, child); + } + child = child.sibling; } } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveUnmountOnFiber(finishedWork) { @@ -19306,19 +19278,18 @@ function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { } detachAlternateSiblings(parentFiber); - } + } // TODO: Check PassiveStatic flag - var prevDebugFiber = getCurrentFiber(); // TODO: Check PassiveStatic flag var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); - disconnectPassiveEffect(child); + { + runWithFiberInDEV(child, disconnectPassiveEffect, child); + } + child = child.sibling; } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function disconnectPassiveEffect(finishedWork) { @@ -19360,9 +19331,10 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot var fiber = nextEffect; // Deletion effects fire in parent -> child order // TODO: Check if fiber has a PassiveStatic flag - setCurrentDebugFiberInDEV(fiber); - commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); - resetCurrentDebugFiberInDEV(); + { + runWithFiberInDEV(fiber, commitPassiveUnmountInsideDeletedTreeOnFiber, fiber, nearestMountedAncestor); + } + var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. if (child !== null) { @@ -21141,19 +21113,20 @@ function performUnitOfWork(unitOfWork) { // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. var current = unitOfWork.alternate; - setCurrentDebugFiberInDEV(unitOfWork); var next; if ((unitOfWork.mode & ProfileMode) !== NoMode) { startProfilerTimer(unitOfWork); - next = beginWork(current, unitOfWork, entangledRenderLanes); + + { + next = runWithFiberInDEV(unitOfWork, beginWork, current, unitOfWork, entangledRenderLanes); + } + stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); } else { - next = beginWork(current, unitOfWork, entangledRenderLanes); - } - - { - resetCurrentFiber(); + { + next = runWithFiberInDEV(unitOfWork, beginWork, current, unitOfWork, entangledRenderLanes); + } } unitOfWork.memoizedProps = unitOfWork.pendingProps; @@ -21169,9 +21142,26 @@ function performUnitOfWork(unitOfWork) { function replaySuspendedUnitOfWork(unitOfWork) { // This is a fork of performUnitOfWork specifcally for replaying a fiber that // just suspended. - // + var next; + + { + next = runWithFiberInDEV(unitOfWork, replayBeginWork, unitOfWork); + } // The begin phase finished successfully without suspending. Return to the + + unitOfWork.memoizedProps = unitOfWork.pendingProps; + + if (next === null) { + // If this doesn't spawn new work, complete the current work. + completeUnitOfWork(unitOfWork); + } else { + workInProgress = next; + } +} + +function replayBeginWork(unitOfWork) { + // This is a fork of beginWork specifcally for replaying a fiber that + // just suspended. var current = unitOfWork.alternate; - setCurrentDebugFiberInDEV(unitOfWork); var next; var isProfilingMode = (unitOfWork.mode & ProfileMode) !== NoMode; @@ -21246,22 +21236,9 @@ function replaySuspendedUnitOfWork(unitOfWork) { if (isProfilingMode) { stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); - } // The begin phase finished successfully without suspending. Return to the - // normal work loop. - - - { - resetCurrentFiber(); } - unitOfWork.memoizedProps = unitOfWork.pendingProps; - - if (next === null) { - // If this doesn't spawn new work, complete the current work. - completeUnitOfWork(unitOfWork); - } else { - workInProgress = next; - } + return next; } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { @@ -21348,20 +21325,23 @@ function completeUnitOfWork(unitOfWork) { var current = completedWork.alternate; var returnFiber = completedWork.return; - setCurrentDebugFiberInDEV(completedWork); var next = void 0; if ((completedWork.mode & ProfileMode) === NoMode) { - next = completeWork(current, completedWork, entangledRenderLanes); + { + next = runWithFiberInDEV(completedWork, completeWork, current, completedWork, entangledRenderLanes); + } } else { startProfilerTimer(completedWork); - next = completeWork(current, completedWork, entangledRenderLanes); // Update render duration assuming we didn't error. + + { + next = runWithFiberInDEV(completedWork, completeWork, current, completedWork, entangledRenderLanes); + } // Update render duration assuming we didn't error. + stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); } - resetCurrentDebugFiberInDEV(); - if (next !== null) { // Completing this fiber spawned new work. Work on that next. workInProgress = next; @@ -21601,7 +21581,7 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh } // The next phase is the mutation phase, where we mutate the host tree. - commitMutationEffects(root, finishedWork); + commitMutationEffects(root, finishedWork, lanes); // the mutation phase, so that the previous tree is still current during // componentWillUnmount, but before the layout phase, so that the finished // work is current during componentDidMount/Update. @@ -21612,7 +21592,7 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh markLayoutEffectsStarted(lanes); } - commitLayoutEffects(finishedWork, root); + commitLayoutEffects(finishedWork, root, lanes); { markLayoutEffectsStopped(); @@ -21693,9 +21673,10 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh for (var i = 0; i < recoverableErrors.length; i++) { var recoverableError = recoverableErrors[i]; var errorInfo = makeErrorInfo(recoverableError.stack); - setCurrentDebugFiberInDEV(recoverableError.source); - onRecoverableError(recoverableError.value, errorInfo); - resetCurrentDebugFiberInDEV(); + + { + runWithFiberInDEV(recoverableError.source, onRecoverableError, recoverableError.value, errorInfo); + } } } // If the passive effects are the result of a discrete render, flush them // synchronously at the end of the current task so that the result is @@ -22196,13 +22177,9 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.tag !== OffscreenComponent) { if (fiber.flags & PlacementDEV) { - setCurrentDebugFiberInDEV(fiber); - if (isInStrictMode) { - doubleInvokeEffectsOnFiber(root, fiber, (fiber.mode & NoStrictPassiveEffectsMode) === NoMode); + runWithFiberInDEV(fiber, doubleInvokeEffectsOnFiber, root, fiber, (fiber.mode & NoStrictPassiveEffectsMode) === NoMode); } - - resetCurrentDebugFiberInDEV(); } else { recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } @@ -22215,19 +22192,15 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.memoizedState === null) { // Only consider Offscreen that is visible. // TODO (Offscreen) Handle manual mode. - setCurrentDebugFiberInDEV(fiber); - if (isInStrictMode && fiber.flags & Visibility) { // Double invoke effects on Offscreen's subtree only // if it is visible and its visibility has changed. - doubleInvokeEffectsOnFiber(root, fiber); + runWithFiberInDEV(fiber, doubleInvokeEffectsOnFiber, root, fiber); } else if (fiber.subtreeFlags & PlacementDEV) { // Something in the subtree could have been suspended. // We need to continue traversal and find newly inserted fibers. - recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); + runWithFiberInDEV(fiber, recursivelyTraverseAndDoubleInvokeEffectsInDEV, root, fiber, isInStrictMode); } - - resetCurrentDebugFiberInDEV(); } } @@ -22242,7 +22215,8 @@ function commitDoubleInvokeEffectsInDEV(root, hasPassiveEffects) { recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, root.current, doubleInvokeEffects); } else { - legacyCommitDoubleInvokeEffectsInDEV(root.current, hasPassiveEffects); + // TODO: Is this runWithFiberInDEV needed since the other effect functions do it too? + runWithFiberInDEV(root.current, legacyCommitDoubleInvokeEffectsInDEV, root.current, hasPassiveEffects); } } } @@ -22251,7 +22225,6 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { // TODO (StrictEffects) Should we set a marker on the root if it contains strict effects // so we don't traverse unnecessarily? similar to subtreeFlags but just at the root level. // Maybe not a big deal since this is DEV only behavior. - setCurrentDebugFiberInDEV(fiber); invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectUnmountInDEV); if (hasPassiveEffects) { @@ -22263,8 +22236,6 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { if (hasPassiveEffects) { invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectMountInDEV); } - - resetCurrentDebugFiberInDEV(); } function invokeEffectsInDev(firstChild, fiberFlags, invokeEffectFn) { @@ -22324,19 +22295,9 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { didWarnStateUpdateForNotYetMountedComponent = new Set([componentName]); } - var previousFiber = current; - - try { - setCurrentDebugFiberInDEV(fiber); - + runWithFiberInDEV(fiber, function () { error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); - } finally { - if (previousFiber) { - setCurrentDebugFiberInDEV(fiber); - } else { - resetCurrentDebugFiberInDEV(); - } - } + }); } } var didWarnAboutUpdateInRender = false; @@ -22432,19 +22393,9 @@ function warnIfUpdatesNotWrappedWithActDEV(fiber) { } if (ReactSharedInternals.actQueue === null) { - var previousFiber = current; - - try { - setCurrentDebugFiberInDEV(fiber); - + runWithFiberInDEV(fiber, function () { error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://react.dev/link/wrap-tests-with-act', getComponentNameFromFiber(fiber)); - } finally { - if (previousFiber) { - setCurrentDebugFiberInDEV(fiber); - } else { - resetCurrentDebugFiberInDEV(); - } - } + }); } } } @@ -23505,7 +23456,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-rc-999503d6'; +var ReactVersion = '19.0.0-rc-aa7289e4'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js index 765bb710b5..e8e68312a9 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "use strict"; @@ -8193,23 +8193,24 @@ function performUnitOfWork(unitOfWork) { null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); } function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; - switch (unitOfWork.tag) { + var next = unitOfWork; + var current = next.alternate; + switch (next.tag) { case 15: case 0: - var Component = unitOfWork.type, - unresolvedProps = unitOfWork.pendingProps; + var Component = next.type, + unresolvedProps = next.pendingProps; unresolvedProps = - unitOfWork.elementType === Component + next.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); var context = isContextProvider(Component) ? previousContext : contextStackCursor$1.current; - context = getMaskedContext(unitOfWork, context); - current = replayFunctionComponent( + context = getMaskedContext(next, context); + next = replayFunctionComponent( current, - unitOfWork, + next, unresolvedProps, Component, context, @@ -8217,33 +8218,31 @@ function replaySuspendedUnitOfWork(unitOfWork) { ); break; case 11: - Component = unitOfWork.type.render; - unresolvedProps = unitOfWork.pendingProps; + Component = next.type.render; + unresolvedProps = next.pendingProps; unresolvedProps = - unitOfWork.elementType === Component + next.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); - current = replayFunctionComponent( + next = replayFunctionComponent( current, - unitOfWork, + next, unresolvedProps, Component, - unitOfWork.ref, + next.ref, workInProgressRootRenderLanes ); break; case 5: - resetHooksOnUnwind(unitOfWork); + resetHooksOnUnwind(next); default: - unwindInterruptedWork(current, unitOfWork), - (unitOfWork = workInProgress = - resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + unwindInterruptedWork(current, next), + (next = workInProgress = + resetWorkInProgress(next, entangledRenderLanes)), + (next = beginWork(current, next, entangledRenderLanes)); } unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current - ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); + null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -9298,19 +9297,19 @@ function wrapFiber(fiber) { fiberToWrapper.set(fiber, wrapper)); return wrapper; } -var devToolsConfig$jscomp$inline_1042 = { +var devToolsConfig$jscomp$inline_1047 = { findFiberByHostInstance: function () { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "19.0.0-rc-c9fc27c4", + version: "19.0.0-rc-96bb2a1a", rendererPackageName: "react-test-renderer" }; -var internals$jscomp$inline_1229 = { - bundleType: devToolsConfig$jscomp$inline_1042.bundleType, - version: devToolsConfig$jscomp$inline_1042.version, - rendererPackageName: devToolsConfig$jscomp$inline_1042.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1042.rendererConfig, +var internals$jscomp$inline_1234 = { + bundleType: devToolsConfig$jscomp$inline_1047.bundleType, + version: devToolsConfig$jscomp$inline_1047.version, + rendererPackageName: devToolsConfig$jscomp$inline_1047.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1047.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -9327,26 +9326,26 @@ var internals$jscomp$inline_1229 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1042.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1047.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-rc-c9fc27c4" + reconcilerVersion: "19.0.0-rc-96bb2a1a" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1230 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1235 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1230.isDisabled && - hook$jscomp$inline_1230.supportsFiber + !hook$jscomp$inline_1235.isDisabled && + hook$jscomp$inline_1235.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1230.inject( - internals$jscomp$inline_1229 + (rendererID = hook$jscomp$inline_1235.inject( + internals$jscomp$inline_1234 )), - (injectedHook = hook$jscomp$inline_1230); + (injectedHook = hook$jscomp$inline_1235); } catch (err) {} } exports._Scheduler = Scheduler; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js index 19fea36ee0..6f7b65a6ae 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<9c5c6f7a7a130bf71d8398c6f3e8e036>> */ "use strict"; @@ -8735,25 +8735,26 @@ function performUnitOfWork(unitOfWork) { : (workInProgress = current); } function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate, - isProfilingMode = 0 !== (unitOfWork.mode & 2); - isProfilingMode && startProfilerTimer(unitOfWork); - switch (unitOfWork.tag) { + var next = unitOfWork; + var current = next.alternate, + isProfilingMode = 0 !== (next.mode & 2); + isProfilingMode && startProfilerTimer(next); + switch (next.tag) { case 15: case 0: - var Component = unitOfWork.type, - unresolvedProps = unitOfWork.pendingProps; + var Component = next.type, + unresolvedProps = next.pendingProps; unresolvedProps = - unitOfWork.elementType === Component + next.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); var context = isContextProvider(Component) ? previousContext : contextStackCursor$1.current; - context = getMaskedContext(unitOfWork, context); + context = getMaskedContext(next, context); current = replayFunctionComponent( current, - unitOfWork, + next, unresolvedProps, Component, context, @@ -8761,34 +8762,33 @@ function replaySuspendedUnitOfWork(unitOfWork) { ); break; case 11: - Component = unitOfWork.type.render; - unresolvedProps = unitOfWork.pendingProps; + Component = next.type.render; + unresolvedProps = next.pendingProps; unresolvedProps = - unitOfWork.elementType === Component + next.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); current = replayFunctionComponent( current, - unitOfWork, + next, unresolvedProps, Component, - unitOfWork.ref, + next.ref, workInProgressRootRenderLanes ); break; case 5: - resetHooksOnUnwind(unitOfWork); + resetHooksOnUnwind(next); default: - unwindInterruptedWork(current, unitOfWork), - (unitOfWork = workInProgress = - resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + unwindInterruptedWork(current, next), + (next = workInProgress = + resetWorkInProgress(next, entangledRenderLanes)), + (current = beginWork(current, next, entangledRenderLanes)); } - isProfilingMode && stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0); + isProfilingMode && stopProfilerTimerIfRunningAndRecordDelta(next, !0); + next = current; unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current - ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); + null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -9941,12 +9941,12 @@ function wrapFiber(fiber) { fiberToWrapper.set(fiber, wrapper)); return wrapper; } -var devToolsConfig$jscomp$inline_1105 = { +var devToolsConfig$jscomp$inline_1111 = { findFiberByHostInstance: function () { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "19.0.0-rc-77c04414", + version: "19.0.0-rc-6d8ae8ad", rendererPackageName: "react-test-renderer" }; (function (internals) { @@ -9963,10 +9963,10 @@ var devToolsConfig$jscomp$inline_1105 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1105.bundleType, - version: devToolsConfig$jscomp$inline_1105.version, - rendererPackageName: devToolsConfig$jscomp$inline_1105.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1105.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1111.bundleType, + version: devToolsConfig$jscomp$inline_1111.version, + rendererPackageName: devToolsConfig$jscomp$inline_1111.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1111.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -9983,14 +9983,14 @@ var devToolsConfig$jscomp$inline_1105 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1105.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1111.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-rc-77c04414" + reconcilerVersion: "19.0.0-rc-6d8ae8ad" }); exports._Scheduler = Scheduler; exports.act = act; 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 556138a304..62bef87d14 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 @@ -d6cfa0f295f4c8b366af15fd20c84e27cdd1fab7 +b078c810c787cf13d9bd1958f083b4e3a162a720 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 79c25add91..6f87cb9695 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<<66f3250cfa263c3a4528924d68e4197c>> */ 'use strict'; @@ -5179,15 +5179,21 @@ function getCurrentFiberStackInDev() { } } -function resetCurrentDebugFiberInDEV() { - { - resetCurrentFiber(); - } -} -function setCurrentDebugFiberInDEV(fiber) { +function runWithFiberInDEV(fiber, callback, arg0, arg1, arg2, arg3, arg4) { { + var previousFiber = current; setCurrentFiber(fiber); - } + + try { + return callback(arg0, arg1, arg2, arg3, arg4); + } finally { + current = previousFiber; + } + } // These errors should never make it into a build so we don't need to encode them in codes.json + // eslint-disable-next-line react-internal/prod-error-codes + + + throw new Error('runWithFiberInDEV should never be called in production. This is a bug in React.'); } function resetCurrentFiber() { { @@ -5205,11 +5211,6 @@ function setCurrentFiber(fiber) { current = fiber; } -function getCurrentFiber() { - { - return current; - } -} function setIsRendering(rendering) { { isRendering = rendering; @@ -8092,14 +8093,9 @@ var ReactStrictModeWarnings = { didWarnAboutLegacyContext.add(fiber.type); }); var sortedNames = setToSortedString(uniqueNames); - - try { - setCurrentDebugFiberInDEV(firstFiber); - + runWithFiberInDEV(firstFiber, function () { error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://react.dev/link/legacy-context', sortedNames); - } finally { - resetCurrentDebugFiberInDEV(); - } + }); }); }; @@ -8455,12 +8451,9 @@ var warnForMissingKey = function (child, returnFiber) {}; var fiber = createFiberFromElement(child, returnFiber.mode, 0); fiber.return = returnFiber; - var prevDebugFiber = getCurrentFiber(); - setCurrentFiber(fiber); - - error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwnerAppendix); - - setCurrentFiber(prevDebugFiber); + runWithFiberInDEV(fiber, function () { + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwnerAppendix); + }); }; } // Given a fragment, validate that it can only be provided with fragment props // We do this here instead of BeginWork because the Fragment fiber doesn't have @@ -8482,12 +8475,9 @@ function validateFragmentProps(element, fiber, returnFiber) { fiber.return = returnFiber; } - var prevDebugFiber = getCurrentFiber(); - setCurrentFiber(fiber); - - error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); - - setCurrentFiber(prevDebugFiber); + runWithFiberInDEV(fiber, function (erroredKey) { + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', erroredKey); + }, key); break; } } @@ -14610,11 +14600,9 @@ function createRootErrorUpdate(root, errorInfo, lane) { }; update.callback = function () { - var prevFiber = getCurrentFiber(); // should just be the root - - setCurrentDebugFiberInDEV(errorInfo.source); - logUncaughtError(root, errorInfo); - setCurrentDebugFiberInDEV(prevFiber); + { + runWithFiberInDEV(errorInfo.source, logUncaughtError, root, errorInfo); + } }; return update; @@ -14641,11 +14629,9 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } - var prevFiber = getCurrentFiber(); // should be the error boundary - - setCurrentDebugFiberInDEV(errorInfo.source); - logCaughtError(root, fiber, errorInfo); - setCurrentDebugFiberInDEV(prevFiber); + { + runWithFiberInDEV(errorInfo.source, logCaughtError, root, fiber, errorInfo); + } }; } @@ -14658,11 +14644,9 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } - var prevFiber = getCurrentFiber(); // should be the error boundary - - setCurrentDebugFiberInDEV(errorInfo.source); - logCaughtError(root, fiber, errorInfo); - setCurrentDebugFiberInDEV(prevFiber); + { + runWithFiberInDEV(errorInfo.source, logCaughtError, root, fiber, errorInfo); + } if (typeof getDerivedStateFromError !== 'function') { // To preserve the preexisting retry behavior of error boundaries, @@ -19673,15 +19657,15 @@ function commitBeforeMutationEffects_begin() { function commitBeforeMutationEffects_complete() { while (nextEffect !== null) { var fiber = nextEffect; - setCurrentDebugFiberInDEV(fiber); try { - commitBeforeMutationEffectsOnFiber(fiber); + if (true) { + runWithFiberInDEV(fiber, commitBeforeMutationEffectsOnFiber, fiber); + } } catch (error) { captureCommitPhaseError(fiber, fiber.return, error); } - resetCurrentDebugFiberInDEV(); var sibling = fiber.sibling; if (sibling !== null) { @@ -19698,10 +19682,6 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { var current = finishedWork.alternate; var flags = finishedWork.flags; - if ((flags & Snapshot) !== NoFlags$1) { - setCurrentDebugFiberInDEV(finishedWork); - } - switch (finishedWork.tag) { case FunctionComponent: { @@ -19778,10 +19758,6 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } } } - - if ((flags & Snapshot) !== NoFlags$1) { - resetCurrentDebugFiberInDEV(); - } } function commitHookEffectListUnmount(flags, finishedWork, nearestMountedAncestor) { @@ -20171,7 +20147,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case ForwardRef: case SimpleMemoComponent: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); if (flags & Update) { commitHookLayoutEffects(finishedWork, Layout | HasEffect); @@ -20182,7 +20158,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case ClassComponent: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); if (flags & Update) { commitClassLayoutLifecycles(finishedWork, current); @@ -20201,7 +20177,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case HostRoot: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); if (flags & Callback) { // TODO: I think this is now always non-null by the time it reaches the @@ -20240,7 +20216,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case HostSingleton: case HostComponent: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); // Renderers may schedule work to be done after host components are mounted + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); // Renderers may schedule work to be done after host components are mounted // (eg DOM renderer may schedule auto-focus for inputs and form controls). // These effects should only be committed when components are first mounted, // aka when there is no current/alternate. @@ -20258,7 +20234,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case Profiler: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); // TODO: Should this fire inside an offscreen tree? Or should it wait to + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); // TODO: Should this fire inside an offscreen tree? Or should it wait to // fire when the tree becomes visible again. if (flags & Update) { @@ -20270,7 +20246,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case SuspenseComponent: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); break; } @@ -20300,14 +20276,14 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe var includeWorkInProgressEffects = (finishedWork.subtreeFlags & LayoutMask) !== NoFlags$1; recursivelyTraverseReappearLayoutEffects(finishedRoot, finishedWork, includeWorkInProgressEffects); } else { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); } offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; } } else { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); } if (flags & Ref) { @@ -20325,7 +20301,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe default: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); break; } } @@ -20734,9 +20710,11 @@ function attachSuspenseRetryListeners(finishedWork, wakeables) { function commitMutationEffects(root, finishedWork, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; - setCurrentDebugFiberInDEV(finishedWork); - commitMutationEffectsOnFiber(finishedWork, root); - resetCurrentDebugFiberInDEV(); + + { + runWithFiberInDEV(finishedWork, commitMutationEffectsOnFiber, finishedWork, root, committedLanes); + } + inProgressLanes = null; inProgressRoot = null; } @@ -20758,19 +20736,17 @@ function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { } } - var prevDebugFiber = getCurrentFiber(); - if (parentFiber.subtreeFlags & MutationMask) { var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); - commitMutationEffectsOnFiber(child, root); + { + runWithFiberInDEV(child, commitMutationEffectsOnFiber, child, root, lanes); + } + child = child.sibling; } } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function commitMutationEffectsOnFiber(finishedWork, root, lanes) { @@ -20785,7 +20761,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case MemoComponent: case SimpleMemoComponent: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); if (flags & Update) { @@ -20824,7 +20800,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case ClassComponent: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); if (flags & Ref) { @@ -20850,7 +20826,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case HostComponent: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); if (flags & Ref) { @@ -20864,7 +20840,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case HostText: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); return; @@ -20873,7 +20849,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case HostRoot: { { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); } @@ -20897,7 +20873,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case HostPortal: { { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); } @@ -20920,7 +20896,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case SuspenseComponent: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); // TODO: We should mark a flag on the Suspense fiber itself, rather than // relying on the Offscreen fiber having a flag also being marked. The // reason is that this offscreen fiber might not be part of the work-in- @@ -20992,11 +20968,11 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden || isHidden; offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || wasHidden; - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; } else { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); } commitReconciliationEffects(finishedWork); @@ -21052,7 +21028,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case SuspenseListComponent: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); if (flags & Update) { @@ -21075,7 +21051,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { default: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); return; } @@ -21110,29 +21086,30 @@ function commitReconciliationEffects(finishedWork) { function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; - setCurrentDebugFiberInDEV(finishedWork); var current = finishedWork.alternate; - commitLayoutEffectOnFiber(root, current, finishedWork); - resetCurrentDebugFiberInDEV(); + + { + runWithFiberInDEV(finishedWork, commitLayoutEffectOnFiber, root, current, finishedWork, committedLanes); + } + inProgressLanes = null; inProgressRoot = null; } function recursivelyTraverseLayoutEffects(root, parentFiber, lanes) { - var prevDebugFiber = getCurrentFiber(); - if (parentFiber.subtreeFlags & LayoutMask) { var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); var current = child.alternate; - commitLayoutEffectOnFiber(root, current, child); + + { + runWithFiberInDEV(child, commitLayoutEffectOnFiber, root, current, child, lanes); + } + child = child.sibling; } } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function disappearLayoutEffects(finishedWork) { @@ -21333,16 +21310,17 @@ function recursivelyTraverseReappearLayoutEffects(finishedRoot, parentFiber, inc // node was reused. var childShouldIncludeWorkInProgressEffects = includeWorkInProgressEffects && (parentFiber.subtreeFlags & LayoutMask) !== NoFlags$1; // TODO (Offscreen) Check: flags & (RefStatic | LayoutStatic) - var prevDebugFiber = getCurrentFiber(); var child = parentFiber.child; while (child !== null) { var current = child.alternate; - reappearLayoutEffects(finishedRoot, current, child, childShouldIncludeWorkInProgressEffects); + + { + runWithFiberInDEV(child, reappearLayoutEffects, finishedRoot, current, child, childShouldIncludeWorkInProgressEffects); + } + child = child.sibling; } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function commitHookPassiveMountEffects(finishedWork, hookFlags) { @@ -21420,25 +21398,23 @@ function commitCachePassiveMountEffect(current, finishedWork) { } function commitPassiveMountEffects(root, finishedWork, committedLanes, committedTransitions) { - setCurrentDebugFiberInDEV(finishedWork); - commitPassiveMountOnFiber(root, finishedWork, committedLanes, committedTransitions); - resetCurrentDebugFiberInDEV(); + { + runWithFiberInDEV(finishedWork, commitPassiveMountOnFiber, root, finishedWork, committedLanes, committedTransitions); + } } function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLanes, committedTransitions) { - var prevDebugFiber = getCurrentFiber(); - if (parentFiber.subtreeFlags & PassiveMask) { var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); - commitPassiveMountOnFiber(root, child, committedLanes, committedTransitions); + { + runWithFiberInDEV(child, commitPassiveMountOnFiber, root, child, committedLanes, committedTransitions); + } + child = child.sibling; } } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -21518,7 +21494,7 @@ function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, c // "Atomic" effects are ones that need to fire on every commit, // even during pre-rendering. An example is updating the reference // count on cache instances. - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions); } } else { // Legacy Mode: Fire the effects even if the tree is hidden. @@ -21578,15 +21554,15 @@ function recursivelyTraverseReconnectPassiveEffects(finishedRoot, parentFiber, c // node was reused. var childShouldIncludeWorkInProgressEffects = includeWorkInProgressEffects && (parentFiber.subtreeFlags & PassiveMask) !== NoFlags$1; // TODO (Offscreen) Check: flags & (RefStatic | LayoutStatic) - var prevDebugFiber = getCurrentFiber(); var child = parentFiber.child; while (child !== null) { - reconnectPassiveEffects(finishedRoot, child, committedLanes, committedTransitions, childShouldIncludeWorkInProgressEffects); + { + runWithFiberInDEV(child, reconnectPassiveEffects, finishedRoot, child, committedLanes, committedTransitions, childShouldIncludeWorkInProgressEffects); + } + child = child.sibling; } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function reconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, // This function visits both newly finished work and nodes that were re-used @@ -21636,7 +21612,7 @@ includeWorkInProgressEffects) { // "Atomic" effects are ones that need to fire on every commit, // even during pre-rendering. An example is updating the reference // count on cache instances. - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions); } } else { // Legacy Mode: Fire the effects even if the tree is hidden. @@ -21691,19 +21667,18 @@ function recursivelyTraverseAtomicPassiveEffects(finishedRoot, parentFiber, comm // "Atomic" effects are ones that need to fire on every commit, even during // pre-rendering. We call this function when traversing a hidden tree whose // regular effects are currently disconnected. - var prevDebugFiber = getCurrentFiber(); // TODO: Add special flag for atomic effects - + // TODO: Add special flag for atomic effects if (parentFiber.subtreeFlags & PassiveMask) { var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); - commitAtomicPassiveEffects(finishedRoot, child); + { + runWithFiberInDEV(child, commitAtomicPassiveEffects, finishedRoot, child, committedLanes, committedTransitions); + } + child = child.sibling; } } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -21715,7 +21690,7 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, switch (finishedWork.tag) { case OffscreenComponent: { - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions); if (flags & Passive$1) { // TODO: Pass `current` as argument to this function @@ -21728,7 +21703,7 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, case CacheComponent: { - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions); if (flags & Passive$1) { // TODO: Pass `current` as argument to this function @@ -21741,16 +21716,16 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, default: { - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions); break; } } } function commitPassiveUnmountEffects(finishedWork) { - setCurrentDebugFiberInDEV(finishedWork); - commitPassiveUnmountOnFiber(finishedWork); - resetCurrentDebugFiberInDEV(); + { + runWithFiberInDEV(finishedWork, commitPassiveUnmountOnFiber, finishedWork); + } } // If we're inside a brand new tree, or a tree that was already visible, then we // should only suspend host components that have a ShouldSuspendCommit flag. // Components without it haven't changed since the last commit, so we can skip @@ -21896,21 +21871,20 @@ function recursivelyTraversePassiveUnmountEffects(parentFiber) { } detachAlternateSiblings(parentFiber); - } + } // TODO: Split PassiveMask into separate masks for mount and unmount? - var prevDebugFiber = getCurrentFiber(); // TODO: Split PassiveMask into separate masks for mount and unmount? if (parentFiber.subtreeFlags & PassiveMask) { var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); - commitPassiveUnmountOnFiber(child); + { + runWithFiberInDEV(child, commitPassiveUnmountOnFiber, child); + } + child = child.sibling; } } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveUnmountOnFiber(finishedWork) { @@ -21974,19 +21948,18 @@ function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { } detachAlternateSiblings(parentFiber); - } + } // TODO: Check PassiveStatic flag - var prevDebugFiber = getCurrentFiber(); // TODO: Check PassiveStatic flag var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); - disconnectPassiveEffect(child); + { + runWithFiberInDEV(child, disconnectPassiveEffect, child); + } + child = child.sibling; } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function disconnectPassiveEffect(finishedWork) { @@ -22028,9 +22001,10 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot var fiber = nextEffect; // Deletion effects fire in parent -> child order // TODO: Check if fiber has a PassiveStatic flag - setCurrentDebugFiberInDEV(fiber); - commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); - resetCurrentDebugFiberInDEV(); + { + runWithFiberInDEV(fiber, commitPassiveUnmountInsideDeletedTreeOnFiber, fiber, nearestMountedAncestor); + } + var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. if (child !== null) { @@ -23838,19 +23812,20 @@ function performUnitOfWork(unitOfWork) { // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. var current = unitOfWork.alternate; - setCurrentDebugFiberInDEV(unitOfWork); var next; if ((unitOfWork.mode & ProfileMode) !== NoMode) { startProfilerTimer(unitOfWork); - next = beginWork(current, unitOfWork, entangledRenderLanes); + + { + next = runWithFiberInDEV(unitOfWork, beginWork, current, unitOfWork, entangledRenderLanes); + } + stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); } else { - next = beginWork(current, unitOfWork, entangledRenderLanes); - } - - { - resetCurrentFiber(); + { + next = runWithFiberInDEV(unitOfWork, beginWork, current, unitOfWork, entangledRenderLanes); + } } unitOfWork.memoizedProps = unitOfWork.pendingProps; @@ -23866,9 +23841,26 @@ function performUnitOfWork(unitOfWork) { function replaySuspendedUnitOfWork(unitOfWork) { // This is a fork of performUnitOfWork specifcally for replaying a fiber that // just suspended. - // + var next; + + { + next = runWithFiberInDEV(unitOfWork, replayBeginWork, unitOfWork); + } // The begin phase finished successfully without suspending. Return to the + + unitOfWork.memoizedProps = unitOfWork.pendingProps; + + if (next === null) { + // If this doesn't spawn new work, complete the current work. + completeUnitOfWork(unitOfWork); + } else { + workInProgress = next; + } +} + +function replayBeginWork(unitOfWork) { + // This is a fork of beginWork specifcally for replaying a fiber that + // just suspended. var current = unitOfWork.alternate; - setCurrentDebugFiberInDEV(unitOfWork); var next; var isProfilingMode = (unitOfWork.mode & ProfileMode) !== NoMode; @@ -23943,22 +23935,9 @@ function replaySuspendedUnitOfWork(unitOfWork) { if (isProfilingMode) { stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); - } // The begin phase finished successfully without suspending. Return to the - // normal work loop. - - - { - resetCurrentFiber(); } - unitOfWork.memoizedProps = unitOfWork.pendingProps; - - if (next === null) { - // If this doesn't spawn new work, complete the current work. - completeUnitOfWork(unitOfWork); - } else { - workInProgress = next; - } + return next; } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { @@ -24045,20 +24024,23 @@ function completeUnitOfWork(unitOfWork) { var current = completedWork.alternate; var returnFiber = completedWork.return; - setCurrentDebugFiberInDEV(completedWork); var next = void 0; if ((completedWork.mode & ProfileMode) === NoMode) { - next = completeWork(current, completedWork, entangledRenderLanes); + { + next = runWithFiberInDEV(completedWork, completeWork, current, completedWork, entangledRenderLanes); + } } else { startProfilerTimer(completedWork); - next = completeWork(current, completedWork, entangledRenderLanes); // Update render duration assuming we didn't error. + + { + next = runWithFiberInDEV(completedWork, completeWork, current, completedWork, entangledRenderLanes); + } // Update render duration assuming we didn't error. + stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); } - resetCurrentDebugFiberInDEV(); - if (next !== null) { // Completing this fiber spawned new work. Work on that next. workInProgress = next; @@ -24398,9 +24380,10 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh for (var i = 0; i < recoverableErrors.length; i++) { var recoverableError = recoverableErrors[i]; var errorInfo = makeErrorInfo(recoverableError.stack); - setCurrentDebugFiberInDEV(recoverableError.source); - onRecoverableError(recoverableError.value, errorInfo); - resetCurrentDebugFiberInDEV(); + + { + runWithFiberInDEV(recoverableError.source, onRecoverableError, recoverableError.value, errorInfo); + } } } // If the passive effects are the result of a discrete render, flush them // synchronously at the end of the current task so that the result is @@ -24918,13 +24901,9 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.tag !== OffscreenComponent) { if (fiber.flags & PlacementDEV) { - setCurrentDebugFiberInDEV(fiber); - if (isInStrictMode) { - doubleInvokeEffectsOnFiber(root, fiber, (fiber.mode & NoStrictPassiveEffectsMode) === NoMode); + runWithFiberInDEV(fiber, doubleInvokeEffectsOnFiber, root, fiber, (fiber.mode & NoStrictPassiveEffectsMode) === NoMode); } - - resetCurrentDebugFiberInDEV(); } else { recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } @@ -24937,19 +24916,15 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.memoizedState === null) { // Only consider Offscreen that is visible. // TODO (Offscreen) Handle manual mode. - setCurrentDebugFiberInDEV(fiber); - if (isInStrictMode && fiber.flags & Visibility) { // Double invoke effects on Offscreen's subtree only // if it is visible and its visibility has changed. - doubleInvokeEffectsOnFiber(root, fiber); + runWithFiberInDEV(fiber, doubleInvokeEffectsOnFiber, root, fiber); } else if (fiber.subtreeFlags & PlacementDEV) { // Something in the subtree could have been suspended. // We need to continue traversal and find newly inserted fibers. - recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); + runWithFiberInDEV(fiber, recursivelyTraverseAndDoubleInvokeEffectsInDEV, root, fiber, isInStrictMode); } - - resetCurrentDebugFiberInDEV(); } } @@ -24964,7 +24939,8 @@ function commitDoubleInvokeEffectsInDEV(root, hasPassiveEffects) { recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, root.current, doubleInvokeEffects); } else { - legacyCommitDoubleInvokeEffectsInDEV(root.current, hasPassiveEffects); + // TODO: Is this runWithFiberInDEV needed since the other effect functions do it too? + runWithFiberInDEV(root.current, legacyCommitDoubleInvokeEffectsInDEV, root.current, hasPassiveEffects); } } } @@ -24973,7 +24949,6 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { // TODO (StrictEffects) Should we set a marker on the root if it contains strict effects // so we don't traverse unnecessarily? similar to subtreeFlags but just at the root level. // Maybe not a big deal since this is DEV only behavior. - setCurrentDebugFiberInDEV(fiber); invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectUnmountInDEV); if (hasPassiveEffects) { @@ -24985,8 +24960,6 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { if (hasPassiveEffects) { invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectMountInDEV); } - - resetCurrentDebugFiberInDEV(); } function invokeEffectsInDev(firstChild, fiberFlags, invokeEffectFn) { @@ -25046,19 +25019,9 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { didWarnStateUpdateForNotYetMountedComponent = new Set([componentName]); } - var previousFiber = current; - - try { - setCurrentDebugFiberInDEV(fiber); - + runWithFiberInDEV(fiber, function () { error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); - } finally { - if (previousFiber) { - setCurrentDebugFiberInDEV(fiber); - } else { - resetCurrentDebugFiberInDEV(); - } - } + }); } } var didWarnAboutUpdateInRender = false; @@ -25167,19 +25130,9 @@ function warnIfUpdatesNotWrappedWithActDEV(fiber) { } if (ReactSharedInternals.actQueue === null) { - var previousFiber = current; - - try { - setCurrentDebugFiberInDEV(fiber); - + runWithFiberInDEV(fiber, function () { error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://react.dev/link/wrap-tests-with-act', getComponentNameFromFiber(fiber)); - } finally { - if (previousFiber) { - setCurrentDebugFiberInDEV(fiber); - } else { - resetCurrentDebugFiberInDEV(); - } - } + }); } } } @@ -26244,7 +26197,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-rc-56feef65'; +var ReactVersion = '19.0.0-rc-c70662b2'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol @@ -26385,25 +26338,13 @@ function findHostInstanceWithWarning(component, methodName) { if (!didWarnAboutFindNodeInStrictMode[componentName]) { didWarnAboutFindNodeInStrictMode[componentName] = true; - var previousFiber = current; - - try { - setCurrentDebugFiberInDEV(hostFiber); - + runWithFiberInDEV(hostFiber, function () { if (fiber.mode & StrictLegacyMode) { error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://react.dev/link/strict-mode-find-node', methodName, methodName, componentName); } else { error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which renders StrictMode children. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://react.dev/link/strict-mode-find-node', methodName, methodName, componentName); } - } finally { - // Ideally this should reset to previous but this shouldn't be called in - // render and there's another warning for that anyway. - if (previousFiber) { - setCurrentDebugFiberInDEV(previousFiber); - } else { - resetCurrentDebugFiberInDEV(); - } - } + }); } } 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 e4cc2c0da1..3e9065b4ec 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<<3689ff78df6b7a85aed1c29948aad1e2>> + * @generated SignedSource<<2010209dd2101a00236bbe4927c1ce22>> */ "use strict"; @@ -9578,24 +9578,24 @@ function performUnitOfWork(unitOfWork) { null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); } function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; - switch (unitOfWork.tag) { + var next = unitOfWork; + var current = next.alternate; + switch (next.tag) { case 15: case 0: - var Component = unitOfWork.type, - unresolvedProps = unitOfWork.pendingProps; + var Component = next.type, + unresolvedProps = next.pendingProps; unresolvedProps = - disableDefaultPropsExceptForClasses || - unitOfWork.elementType === Component + disableDefaultPropsExceptForClasses || next.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); var context = isContextProvider(Component) ? previousContext : contextStackCursor$1.current; - context = getMaskedContext(unitOfWork, context); - current = replayFunctionComponent( + context = getMaskedContext(next, context); + next = replayFunctionComponent( current, - unitOfWork, + next, unresolvedProps, Component, context, @@ -9603,34 +9603,31 @@ function replaySuspendedUnitOfWork(unitOfWork) { ); break; case 11: - Component = unitOfWork.type.render; - unresolvedProps = unitOfWork.pendingProps; + Component = next.type.render; + unresolvedProps = next.pendingProps; unresolvedProps = - disableDefaultPropsExceptForClasses || - unitOfWork.elementType === Component + disableDefaultPropsExceptForClasses || next.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); - current = replayFunctionComponent( + next = replayFunctionComponent( current, - unitOfWork, + next, unresolvedProps, Component, - unitOfWork.ref, + next.ref, workInProgressRootRenderLanes ); break; case 5: - resetHooksOnUnwind(unitOfWork); + resetHooksOnUnwind(next); default: - unwindInterruptedWork(current, unitOfWork), - (unitOfWork = workInProgress = - resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + unwindInterruptedWork(current, next), + (next = workInProgress = + resetWorkInProgress(next, entangledRenderLanes)), + (next = beginWork(current, next, entangledRenderLanes)); } unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current - ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); + null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -10558,10 +10555,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1119 = { + devToolsConfig$jscomp$inline_1124 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "19.0.0-rc-c41f552c", + version: "19.0.0-rc-68b4213e", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10577,11 +10574,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1349 = { - bundleType: devToolsConfig$jscomp$inline_1119.bundleType, - version: devToolsConfig$jscomp$inline_1119.version, - rendererPackageName: devToolsConfig$jscomp$inline_1119.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1119.rendererConfig, +var internals$jscomp$inline_1354 = { + bundleType: devToolsConfig$jscomp$inline_1124.bundleType, + version: devToolsConfig$jscomp$inline_1124.version, + rendererPackageName: devToolsConfig$jscomp$inline_1124.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1124.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10597,26 +10594,26 @@ var internals$jscomp$inline_1349 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1119.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1124.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-rc-c41f552c" + reconcilerVersion: "19.0.0-rc-68b4213e" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1350 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1355 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1350.isDisabled && - hook$jscomp$inline_1350.supportsFiber + !hook$jscomp$inline_1355.isDisabled && + hook$jscomp$inline_1355.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1350.inject( - internals$jscomp$inline_1349 + (rendererID = hook$jscomp$inline_1355.inject( + internals$jscomp$inline_1354 )), - (injectedHook = hook$jscomp$inline_1350); + (injectedHook = hook$jscomp$inline_1355); } 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 b1f1d09f21..8a4626d7ad 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<<9e26d0a8949cc8f63aeb19b1d6f092fd>> + * @generated SignedSource<<8bf9b34548f4c8e979ea4fc8b49091e3>> */ "use strict"; @@ -10174,26 +10174,26 @@ function performUnitOfWork(unitOfWork) { : (workInProgress = current); } function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate, - isProfilingMode = 0 !== (unitOfWork.mode & 2); - isProfilingMode && startProfilerTimer(unitOfWork); - switch (unitOfWork.tag) { + var next = unitOfWork; + var current = next.alternate, + isProfilingMode = 0 !== (next.mode & 2); + isProfilingMode && startProfilerTimer(next); + switch (next.tag) { case 15: case 0: - var Component = unitOfWork.type, - unresolvedProps = unitOfWork.pendingProps; + var Component = next.type, + unresolvedProps = next.pendingProps; unresolvedProps = - disableDefaultPropsExceptForClasses || - unitOfWork.elementType === Component + disableDefaultPropsExceptForClasses || next.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); var context = isContextProvider(Component) ? previousContext : contextStackCursor$1.current; - context = getMaskedContext(unitOfWork, context); + context = getMaskedContext(next, context); current = replayFunctionComponent( current, - unitOfWork, + next, unresolvedProps, Component, context, @@ -10201,35 +10201,33 @@ function replaySuspendedUnitOfWork(unitOfWork) { ); break; case 11: - Component = unitOfWork.type.render; - unresolvedProps = unitOfWork.pendingProps; + Component = next.type.render; + unresolvedProps = next.pendingProps; unresolvedProps = - disableDefaultPropsExceptForClasses || - unitOfWork.elementType === Component + disableDefaultPropsExceptForClasses || next.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); current = replayFunctionComponent( current, - unitOfWork, + next, unresolvedProps, Component, - unitOfWork.ref, + next.ref, workInProgressRootRenderLanes ); break; case 5: - resetHooksOnUnwind(unitOfWork); + resetHooksOnUnwind(next); default: - unwindInterruptedWork(current, unitOfWork), - (unitOfWork = workInProgress = - resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + unwindInterruptedWork(current, next), + (next = workInProgress = + resetWorkInProgress(next, entangledRenderLanes)), + (current = beginWork(current, next, entangledRenderLanes)); } - isProfilingMode && stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0); + isProfilingMode && stopProfilerTimerIfRunningAndRecordDelta(next, !0); + next = current; unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current - ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); + null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -11263,10 +11261,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1199 = { + devToolsConfig$jscomp$inline_1205 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "19.0.0-rc-24969d43", + version: "19.0.0-rc-30caa758", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -11296,10 +11294,10 @@ var roots = new Map(), } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1199.bundleType, - version: devToolsConfig$jscomp$inline_1199.version, - rendererPackageName: devToolsConfig$jscomp$inline_1199.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1199.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1205.bundleType, + version: devToolsConfig$jscomp$inline_1205.version, + rendererPackageName: devToolsConfig$jscomp$inline_1205.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1205.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -11315,14 +11313,14 @@ var roots = new Map(), return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1199.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1205.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-rc-24969d43" + reconcilerVersion: "19.0.0-rc-30caa758" }); 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 4782487adc..8374a672ab 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<<3d4cf8990ac0b10f2ad4552e0a0fc75f>> */ 'use strict'; @@ -3238,15 +3238,21 @@ function getCurrentFiberStackInDev() { } } -function resetCurrentDebugFiberInDEV() { - { - resetCurrentFiber(); - } -} -function setCurrentDebugFiberInDEV(fiber) { +function runWithFiberInDEV(fiber, callback, arg0, arg1, arg2, arg3, arg4) { { + var previousFiber = current; setCurrentFiber(fiber); - } + + try { + return callback(arg0, arg1, arg2, arg3, arg4); + } finally { + current = previousFiber; + } + } // These errors should never make it into a build so we don't need to encode them in codes.json + // eslint-disable-next-line react-internal/prod-error-codes + + + throw new Error('runWithFiberInDEV should never be called in production. This is a bug in React.'); } function resetCurrentFiber() { { @@ -3264,11 +3270,6 @@ function setCurrentFiber(fiber) { current = fiber; } -function getCurrentFiber() { - { - return current; - } -} function setIsRendering(rendering) { { isRendering = rendering; @@ -8269,14 +8270,9 @@ var ReactStrictModeWarnings = { didWarnAboutLegacyContext.add(fiber.type); }); var sortedNames = setToSortedString(uniqueNames); - - try { - setCurrentDebugFiberInDEV(firstFiber); - + runWithFiberInDEV(firstFiber, function () { error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://react.dev/link/legacy-context', sortedNames); - } finally { - resetCurrentDebugFiberInDEV(); - } + }); }); }; @@ -8632,12 +8628,9 @@ var warnForMissingKey = function (child, returnFiber) {}; var fiber = createFiberFromElement(child, returnFiber.mode, 0); fiber.return = returnFiber; - var prevDebugFiber = getCurrentFiber(); - setCurrentFiber(fiber); - - error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwnerAppendix); - - setCurrentFiber(prevDebugFiber); + runWithFiberInDEV(fiber, function () { + error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwnerAppendix); + }); }; } // Given a fragment, validate that it can only be provided with fragment props // We do this here instead of BeginWork because the Fragment fiber doesn't have @@ -8659,12 +8652,9 @@ function validateFragmentProps(element, fiber, returnFiber) { fiber.return = returnFiber; } - var prevDebugFiber = getCurrentFiber(); - setCurrentFiber(fiber); - - error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); - - setCurrentFiber(prevDebugFiber); + runWithFiberInDEV(fiber, function (erroredKey) { + error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', erroredKey); + }, key); break; } } @@ -14787,11 +14777,9 @@ function createRootErrorUpdate(root, errorInfo, lane) { }; update.callback = function () { - var prevFiber = getCurrentFiber(); // should just be the root - - setCurrentDebugFiberInDEV(errorInfo.source); - logUncaughtError(root, errorInfo); - setCurrentDebugFiberInDEV(prevFiber); + { + runWithFiberInDEV(errorInfo.source, logUncaughtError, root, errorInfo); + } }; return update; @@ -14818,11 +14806,9 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } - var prevFiber = getCurrentFiber(); // should be the error boundary - - setCurrentDebugFiberInDEV(errorInfo.source); - logCaughtError(root, fiber, errorInfo); - setCurrentDebugFiberInDEV(prevFiber); + { + runWithFiberInDEV(errorInfo.source, logCaughtError, root, fiber, errorInfo); + } }; } @@ -14835,11 +14821,9 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } - var prevFiber = getCurrentFiber(); // should be the error boundary - - setCurrentDebugFiberInDEV(errorInfo.source); - logCaughtError(root, fiber, errorInfo); - setCurrentDebugFiberInDEV(prevFiber); + { + runWithFiberInDEV(errorInfo.source, logCaughtError, root, fiber, errorInfo); + } if (typeof getDerivedStateFromError !== 'function') { // To preserve the preexisting retry behavior of error boundaries, @@ -19658,15 +19642,15 @@ function commitBeforeMutationEffects_begin() { function commitBeforeMutationEffects_complete() { while (nextEffect !== null) { var fiber = nextEffect; - setCurrentDebugFiberInDEV(fiber); try { - commitBeforeMutationEffectsOnFiber(fiber); + if (true) { + runWithFiberInDEV(fiber, commitBeforeMutationEffectsOnFiber, fiber); + } } catch (error) { captureCommitPhaseError(fiber, fiber.return, error); } - resetCurrentDebugFiberInDEV(); var sibling = fiber.sibling; if (sibling !== null) { @@ -19683,10 +19667,6 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { var current = finishedWork.alternate; var flags = finishedWork.flags; - if ((flags & Snapshot) !== NoFlags$1) { - setCurrentDebugFiberInDEV(finishedWork); - } - switch (finishedWork.tag) { case FunctionComponent: { @@ -19763,10 +19743,6 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } } } - - if ((flags & Snapshot) !== NoFlags$1) { - resetCurrentDebugFiberInDEV(); - } } function commitHookEffectListUnmount(flags, finishedWork, nearestMountedAncestor) { @@ -20156,7 +20132,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case ForwardRef: case SimpleMemoComponent: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); if (flags & Update) { commitHookLayoutEffects(finishedWork, Layout | HasEffect); @@ -20167,7 +20143,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case ClassComponent: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); if (flags & Update) { commitClassLayoutLifecycles(finishedWork, current); @@ -20186,7 +20162,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case HostRoot: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); if (flags & Callback) { // TODO: I think this is now always non-null by the time it reaches the @@ -20225,7 +20201,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case HostSingleton: case HostComponent: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); // Renderers may schedule work to be done after host components are mounted + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); // Renderers may schedule work to be done after host components are mounted // (eg DOM renderer may schedule auto-focus for inputs and form controls). // These effects should only be committed when components are first mounted, // aka when there is no current/alternate. @@ -20243,7 +20219,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case Profiler: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); // TODO: Should this fire inside an offscreen tree? Or should it wait to + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); // TODO: Should this fire inside an offscreen tree? Or should it wait to // fire when the tree becomes visible again. if (flags & Update) { @@ -20255,7 +20231,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe case SuspenseComponent: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); break; } @@ -20285,14 +20261,14 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe var includeWorkInProgressEffects = (finishedWork.subtreeFlags & LayoutMask) !== NoFlags$1; recursivelyTraverseReappearLayoutEffects(finishedRoot, finishedWork, includeWorkInProgressEffects); } else { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); } offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; } } else { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); } if (flags & Ref) { @@ -20310,7 +20286,7 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committe default: { - recursivelyTraverseLayoutEffects(finishedRoot, finishedWork); + recursivelyTraverseLayoutEffects(finishedRoot, finishedWork, committedLanes); break; } } @@ -21033,9 +21009,11 @@ function attachSuspenseRetryListeners(finishedWork, wakeables) { function commitMutationEffects(root, finishedWork, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; - setCurrentDebugFiberInDEV(finishedWork); - commitMutationEffectsOnFiber(finishedWork, root); - resetCurrentDebugFiberInDEV(); + + { + runWithFiberInDEV(finishedWork, commitMutationEffectsOnFiber, finishedWork, root, committedLanes); + } + inProgressLanes = null; inProgressRoot = null; } @@ -21057,19 +21035,17 @@ function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { } } - var prevDebugFiber = getCurrentFiber(); - if (parentFiber.subtreeFlags & MutationMask) { var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); - commitMutationEffectsOnFiber(child, root); + { + runWithFiberInDEV(child, commitMutationEffectsOnFiber, child, root, lanes); + } + child = child.sibling; } } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function commitMutationEffectsOnFiber(finishedWork, root, lanes) { @@ -21084,7 +21060,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case MemoComponent: case SimpleMemoComponent: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); if (flags & Update) { @@ -21123,7 +21099,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case ClassComponent: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); if (flags & Ref) { @@ -21149,7 +21125,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case HostComponent: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); if (flags & Ref) { @@ -21212,7 +21188,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case HostText: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); if (flags & Update) { @@ -21242,7 +21218,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case HostRoot: { { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); } @@ -21252,7 +21228,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case HostPortal: { { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); } @@ -21261,7 +21237,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case SuspenseComponent: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); // TODO: We should mark a flag on the Suspense fiber itself, rather than // relying on the Offscreen fiber having a flag also being marked. The // reason is that this offscreen fiber might not be part of the work-in- @@ -21333,11 +21309,11 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden || isHidden; offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || wasHidden; - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; } else { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); } commitReconciliationEffects(finishedWork); @@ -21400,7 +21376,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { case SuspenseListComponent: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); if (flags & Update) { @@ -21423,7 +21399,7 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { default: { - recursivelyTraverseMutationEffects(root, finishedWork); + recursivelyTraverseMutationEffects(root, finishedWork, lanes); commitReconciliationEffects(finishedWork); return; } @@ -21458,29 +21434,30 @@ function commitReconciliationEffects(finishedWork) { function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; - setCurrentDebugFiberInDEV(finishedWork); var current = finishedWork.alternate; - commitLayoutEffectOnFiber(root, current, finishedWork); - resetCurrentDebugFiberInDEV(); + + { + runWithFiberInDEV(finishedWork, commitLayoutEffectOnFiber, root, current, finishedWork, committedLanes); + } + inProgressLanes = null; inProgressRoot = null; } function recursivelyTraverseLayoutEffects(root, parentFiber, lanes) { - var prevDebugFiber = getCurrentFiber(); - if (parentFiber.subtreeFlags & LayoutMask) { var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); var current = child.alternate; - commitLayoutEffectOnFiber(root, current, child); + + { + runWithFiberInDEV(child, commitLayoutEffectOnFiber, root, current, child, lanes); + } + child = child.sibling; } } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function disappearLayoutEffects(finishedWork) { @@ -21681,16 +21658,17 @@ function recursivelyTraverseReappearLayoutEffects(finishedRoot, parentFiber, inc // node was reused. var childShouldIncludeWorkInProgressEffects = includeWorkInProgressEffects && (parentFiber.subtreeFlags & LayoutMask) !== NoFlags$1; // TODO (Offscreen) Check: flags & (RefStatic | LayoutStatic) - var prevDebugFiber = getCurrentFiber(); var child = parentFiber.child; while (child !== null) { var current = child.alternate; - reappearLayoutEffects(finishedRoot, current, child, childShouldIncludeWorkInProgressEffects); + + { + runWithFiberInDEV(child, reappearLayoutEffects, finishedRoot, current, child, childShouldIncludeWorkInProgressEffects); + } + child = child.sibling; } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function commitHookPassiveMountEffects(finishedWork, hookFlags) { @@ -21768,25 +21746,23 @@ function commitCachePassiveMountEffect(current, finishedWork) { } function commitPassiveMountEffects(root, finishedWork, committedLanes, committedTransitions) { - setCurrentDebugFiberInDEV(finishedWork); - commitPassiveMountOnFiber(root, finishedWork, committedLanes, committedTransitions); - resetCurrentDebugFiberInDEV(); + { + runWithFiberInDEV(finishedWork, commitPassiveMountOnFiber, root, finishedWork, committedLanes, committedTransitions); + } } function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLanes, committedTransitions) { - var prevDebugFiber = getCurrentFiber(); - if (parentFiber.subtreeFlags & PassiveMask) { var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); - commitPassiveMountOnFiber(root, child, committedLanes, committedTransitions); + { + runWithFiberInDEV(child, commitPassiveMountOnFiber, root, child, committedLanes, committedTransitions); + } + child = child.sibling; } } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -21866,7 +21842,7 @@ function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, c // "Atomic" effects are ones that need to fire on every commit, // even during pre-rendering. An example is updating the reference // count on cache instances. - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions); } } else { // Legacy Mode: Fire the effects even if the tree is hidden. @@ -21926,15 +21902,15 @@ function recursivelyTraverseReconnectPassiveEffects(finishedRoot, parentFiber, c // node was reused. var childShouldIncludeWorkInProgressEffects = includeWorkInProgressEffects && (parentFiber.subtreeFlags & PassiveMask) !== NoFlags$1; // TODO (Offscreen) Check: flags & (RefStatic | LayoutStatic) - var prevDebugFiber = getCurrentFiber(); var child = parentFiber.child; while (child !== null) { - reconnectPassiveEffects(finishedRoot, child, committedLanes, committedTransitions, childShouldIncludeWorkInProgressEffects); + { + runWithFiberInDEV(child, reconnectPassiveEffects, finishedRoot, child, committedLanes, committedTransitions, childShouldIncludeWorkInProgressEffects); + } + child = child.sibling; } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function reconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, // This function visits both newly finished work and nodes that were re-used @@ -21984,7 +21960,7 @@ includeWorkInProgressEffects) { // "Atomic" effects are ones that need to fire on every commit, // even during pre-rendering. An example is updating the reference // count on cache instances. - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions); } } else { // Legacy Mode: Fire the effects even if the tree is hidden. @@ -22039,19 +22015,18 @@ function recursivelyTraverseAtomicPassiveEffects(finishedRoot, parentFiber, comm // "Atomic" effects are ones that need to fire on every commit, even during // pre-rendering. We call this function when traversing a hidden tree whose // regular effects are currently disconnected. - var prevDebugFiber = getCurrentFiber(); // TODO: Add special flag for atomic effects - + // TODO: Add special flag for atomic effects if (parentFiber.subtreeFlags & PassiveMask) { var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); - commitAtomicPassiveEffects(finishedRoot, child); + { + runWithFiberInDEV(child, commitAtomicPassiveEffects, finishedRoot, child, committedLanes, committedTransitions); + } + child = child.sibling; } } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -22063,7 +22038,7 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, switch (finishedWork.tag) { case OffscreenComponent: { - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions); if (flags & Passive$1) { // TODO: Pass `current` as argument to this function @@ -22076,7 +22051,7 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, case CacheComponent: { - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions); if (flags & Passive$1) { // TODO: Pass `current` as argument to this function @@ -22089,16 +22064,16 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, default: { - recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork); + recursivelyTraverseAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions); break; } } } function commitPassiveUnmountEffects(finishedWork) { - setCurrentDebugFiberInDEV(finishedWork); - commitPassiveUnmountOnFiber(finishedWork); - resetCurrentDebugFiberInDEV(); + { + runWithFiberInDEV(finishedWork, commitPassiveUnmountOnFiber, finishedWork); + } } // If we're inside a brand new tree, or a tree that was already visible, then we // should only suspend host components that have a ShouldSuspendCommit flag. // Components without it haven't changed since the last commit, so we can skip @@ -22244,21 +22219,20 @@ function recursivelyTraversePassiveUnmountEffects(parentFiber) { } detachAlternateSiblings(parentFiber); - } + } // TODO: Split PassiveMask into separate masks for mount and unmount? - var prevDebugFiber = getCurrentFiber(); // TODO: Split PassiveMask into separate masks for mount and unmount? if (parentFiber.subtreeFlags & PassiveMask) { var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); - commitPassiveUnmountOnFiber(child); + { + runWithFiberInDEV(child, commitPassiveUnmountOnFiber, child); + } + child = child.sibling; } } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveUnmountOnFiber(finishedWork) { @@ -22322,19 +22296,18 @@ function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { } detachAlternateSiblings(parentFiber); - } + } // TODO: Check PassiveStatic flag - var prevDebugFiber = getCurrentFiber(); // TODO: Check PassiveStatic flag var child = parentFiber.child; while (child !== null) { - setCurrentDebugFiberInDEV(child); - disconnectPassiveEffect(child); + { + runWithFiberInDEV(child, disconnectPassiveEffect, child); + } + child = child.sibling; } - - setCurrentDebugFiberInDEV(prevDebugFiber); } function disconnectPassiveEffect(finishedWork) { @@ -22376,9 +22349,10 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot var fiber = nextEffect; // Deletion effects fire in parent -> child order // TODO: Check if fiber has a PassiveStatic flag - setCurrentDebugFiberInDEV(fiber); - commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); - resetCurrentDebugFiberInDEV(); + { + runWithFiberInDEV(fiber, commitPassiveUnmountInsideDeletedTreeOnFiber, fiber, nearestMountedAncestor); + } + var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. if (child !== null) { @@ -24188,19 +24162,20 @@ function performUnitOfWork(unitOfWork) { // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. var current = unitOfWork.alternate; - setCurrentDebugFiberInDEV(unitOfWork); var next; if ((unitOfWork.mode & ProfileMode) !== NoMode) { startProfilerTimer(unitOfWork); - next = beginWork(current, unitOfWork, entangledRenderLanes); + + { + next = runWithFiberInDEV(unitOfWork, beginWork, current, unitOfWork, entangledRenderLanes); + } + stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); } else { - next = beginWork(current, unitOfWork, entangledRenderLanes); - } - - { - resetCurrentFiber(); + { + next = runWithFiberInDEV(unitOfWork, beginWork, current, unitOfWork, entangledRenderLanes); + } } unitOfWork.memoizedProps = unitOfWork.pendingProps; @@ -24216,9 +24191,26 @@ function performUnitOfWork(unitOfWork) { function replaySuspendedUnitOfWork(unitOfWork) { // This is a fork of performUnitOfWork specifcally for replaying a fiber that // just suspended. - // + var next; + + { + next = runWithFiberInDEV(unitOfWork, replayBeginWork, unitOfWork); + } // The begin phase finished successfully without suspending. Return to the + + unitOfWork.memoizedProps = unitOfWork.pendingProps; + + if (next === null) { + // If this doesn't spawn new work, complete the current work. + completeUnitOfWork(unitOfWork); + } else { + workInProgress = next; + } +} + +function replayBeginWork(unitOfWork) { + // This is a fork of beginWork specifcally for replaying a fiber that + // just suspended. var current = unitOfWork.alternate; - setCurrentDebugFiberInDEV(unitOfWork); var next; var isProfilingMode = (unitOfWork.mode & ProfileMode) !== NoMode; @@ -24293,22 +24285,9 @@ function replaySuspendedUnitOfWork(unitOfWork) { if (isProfilingMode) { stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); - } // The begin phase finished successfully without suspending. Return to the - // normal work loop. - - - { - resetCurrentFiber(); } - unitOfWork.memoizedProps = unitOfWork.pendingProps; - - if (next === null) { - // If this doesn't spawn new work, complete the current work. - completeUnitOfWork(unitOfWork); - } else { - workInProgress = next; - } + return next; } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { @@ -24395,20 +24374,23 @@ function completeUnitOfWork(unitOfWork) { var current = completedWork.alternate; var returnFiber = completedWork.return; - setCurrentDebugFiberInDEV(completedWork); var next = void 0; if ((completedWork.mode & ProfileMode) === NoMode) { - next = completeWork(current, completedWork, entangledRenderLanes); + { + next = runWithFiberInDEV(completedWork, completeWork, current, completedWork, entangledRenderLanes); + } } else { startProfilerTimer(completedWork); - next = completeWork(current, completedWork, entangledRenderLanes); // Update render duration assuming we didn't error. + + { + next = runWithFiberInDEV(completedWork, completeWork, current, completedWork, entangledRenderLanes); + } // Update render duration assuming we didn't error. + stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); } - resetCurrentDebugFiberInDEV(); - if (next !== null) { // Completing this fiber spawned new work. Work on that next. workInProgress = next; @@ -24748,9 +24730,10 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh for (var i = 0; i < recoverableErrors.length; i++) { var recoverableError = recoverableErrors[i]; var errorInfo = makeErrorInfo(recoverableError.stack); - setCurrentDebugFiberInDEV(recoverableError.source); - onRecoverableError(recoverableError.value, errorInfo); - resetCurrentDebugFiberInDEV(); + + { + runWithFiberInDEV(recoverableError.source, onRecoverableError, recoverableError.value, errorInfo); + } } } // If the passive effects are the result of a discrete render, flush them // synchronously at the end of the current task so that the result is @@ -25268,13 +25251,9 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.tag !== OffscreenComponent) { if (fiber.flags & PlacementDEV) { - setCurrentDebugFiberInDEV(fiber); - if (isInStrictMode) { - doubleInvokeEffectsOnFiber(root, fiber, (fiber.mode & NoStrictPassiveEffectsMode) === NoMode); + runWithFiberInDEV(fiber, doubleInvokeEffectsOnFiber, root, fiber, (fiber.mode & NoStrictPassiveEffectsMode) === NoMode); } - - resetCurrentDebugFiberInDEV(); } else { recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } @@ -25287,19 +25266,15 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.memoizedState === null) { // Only consider Offscreen that is visible. // TODO (Offscreen) Handle manual mode. - setCurrentDebugFiberInDEV(fiber); - if (isInStrictMode && fiber.flags & Visibility) { // Double invoke effects on Offscreen's subtree only // if it is visible and its visibility has changed. - doubleInvokeEffectsOnFiber(root, fiber); + runWithFiberInDEV(fiber, doubleInvokeEffectsOnFiber, root, fiber); } else if (fiber.subtreeFlags & PlacementDEV) { // Something in the subtree could have been suspended. // We need to continue traversal and find newly inserted fibers. - recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); + runWithFiberInDEV(fiber, recursivelyTraverseAndDoubleInvokeEffectsInDEV, root, fiber, isInStrictMode); } - - resetCurrentDebugFiberInDEV(); } } @@ -25314,7 +25289,8 @@ function commitDoubleInvokeEffectsInDEV(root, hasPassiveEffects) { recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, root.current, doubleInvokeEffects); } else { - legacyCommitDoubleInvokeEffectsInDEV(root.current, hasPassiveEffects); + // TODO: Is this runWithFiberInDEV needed since the other effect functions do it too? + runWithFiberInDEV(root.current, legacyCommitDoubleInvokeEffectsInDEV, root.current, hasPassiveEffects); } } } @@ -25323,7 +25299,6 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { // TODO (StrictEffects) Should we set a marker on the root if it contains strict effects // so we don't traverse unnecessarily? similar to subtreeFlags but just at the root level. // Maybe not a big deal since this is DEV only behavior. - setCurrentDebugFiberInDEV(fiber); invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectUnmountInDEV); if (hasPassiveEffects) { @@ -25335,8 +25310,6 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { if (hasPassiveEffects) { invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectMountInDEV); } - - resetCurrentDebugFiberInDEV(); } function invokeEffectsInDev(firstChild, fiberFlags, invokeEffectFn) { @@ -25396,19 +25369,9 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { didWarnStateUpdateForNotYetMountedComponent = new Set([componentName]); } - var previousFiber = current; - - try { - setCurrentDebugFiberInDEV(fiber); - + runWithFiberInDEV(fiber, function () { error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); - } finally { - if (previousFiber) { - setCurrentDebugFiberInDEV(fiber); - } else { - resetCurrentDebugFiberInDEV(); - } - } + }); } } var didWarnAboutUpdateInRender = false; @@ -25517,19 +25480,9 @@ function warnIfUpdatesNotWrappedWithActDEV(fiber) { } if (ReactSharedInternals.actQueue === null) { - var previousFiber = current; - - try { - setCurrentDebugFiberInDEV(fiber); - + runWithFiberInDEV(fiber, function () { error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://react.dev/link/wrap-tests-with-act', getComponentNameFromFiber(fiber)); - } finally { - if (previousFiber) { - setCurrentDebugFiberInDEV(fiber); - } else { - resetCurrentDebugFiberInDEV(); - } - } + }); } } } @@ -26594,7 +26547,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-rc-39aeea68'; +var ReactVersion = '19.0.0-rc-3589e53b'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol @@ -26735,25 +26688,13 @@ function findHostInstanceWithWarning(component, methodName) { if (!didWarnAboutFindNodeInStrictMode[componentName]) { didWarnAboutFindNodeInStrictMode[componentName] = true; - var previousFiber = current; - - try { - setCurrentDebugFiberInDEV(hostFiber); - + runWithFiberInDEV(hostFiber, function () { if (fiber.mode & StrictLegacyMode) { error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://react.dev/link/strict-mode-find-node', methodName, methodName, componentName); } else { error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which renders StrictMode children. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://react.dev/link/strict-mode-find-node', methodName, methodName, componentName); } - } finally { - // Ideally this should reset to previous but this shouldn't be called in - // render and there's another warning for that anyway. - if (previousFiber) { - setCurrentDebugFiberInDEV(previousFiber); - } else { - resetCurrentDebugFiberInDEV(); - } - } + }); } } 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 975557455e..35ef15b023 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<<9ace4387e0d9bb1ccd42fb1b3159b6be>> + * @generated SignedSource<<8f6bd9d36ed0f004525a1311fbf265d6>> */ "use strict"; @@ -9760,24 +9760,24 @@ function performUnitOfWork(unitOfWork) { null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); } function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; - switch (unitOfWork.tag) { + var next = unitOfWork; + var current = next.alternate; + switch (next.tag) { case 15: case 0: - var Component = unitOfWork.type, - unresolvedProps = unitOfWork.pendingProps; + var Component = next.type, + unresolvedProps = next.pendingProps; unresolvedProps = - disableDefaultPropsExceptForClasses || - unitOfWork.elementType === Component + disableDefaultPropsExceptForClasses || next.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); var context = isContextProvider(Component) ? previousContext : contextStackCursor$1.current; - context = getMaskedContext(unitOfWork, context); - current = replayFunctionComponent( + context = getMaskedContext(next, context); + next = replayFunctionComponent( current, - unitOfWork, + next, unresolvedProps, Component, context, @@ -9785,34 +9785,31 @@ function replaySuspendedUnitOfWork(unitOfWork) { ); break; case 11: - Component = unitOfWork.type.render; - unresolvedProps = unitOfWork.pendingProps; + Component = next.type.render; + unresolvedProps = next.pendingProps; unresolvedProps = - disableDefaultPropsExceptForClasses || - unitOfWork.elementType === Component + disableDefaultPropsExceptForClasses || next.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); - current = replayFunctionComponent( + next = replayFunctionComponent( current, - unitOfWork, + next, unresolvedProps, Component, - unitOfWork.ref, + next.ref, workInProgressRootRenderLanes ); break; case 5: - resetHooksOnUnwind(unitOfWork); + resetHooksOnUnwind(next); default: - unwindInterruptedWork(current, unitOfWork), - (unitOfWork = workInProgress = - resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + unwindInterruptedWork(current, next), + (next = workInProgress = + resetWorkInProgress(next, entangledRenderLanes)), + (next = beginWork(current, next, entangledRenderLanes)); } unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current - ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); + null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -10747,10 +10744,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1187 = { + devToolsConfig$jscomp$inline_1192 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "19.0.0-rc-73edc03e", + version: "19.0.0-rc-20ea0bb8", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10766,11 +10763,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1434 = { - bundleType: devToolsConfig$jscomp$inline_1187.bundleType, - version: devToolsConfig$jscomp$inline_1187.version, - rendererPackageName: devToolsConfig$jscomp$inline_1187.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1187.rendererConfig, +var internals$jscomp$inline_1439 = { + bundleType: devToolsConfig$jscomp$inline_1192.bundleType, + version: devToolsConfig$jscomp$inline_1192.version, + rendererPackageName: devToolsConfig$jscomp$inline_1192.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1192.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10786,26 +10783,26 @@ var internals$jscomp$inline_1434 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1187.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1192.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-rc-73edc03e" + reconcilerVersion: "19.0.0-rc-20ea0bb8" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1435 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1440 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1435.isDisabled && - hook$jscomp$inline_1435.supportsFiber + !hook$jscomp$inline_1440.isDisabled && + hook$jscomp$inline_1440.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1435.inject( - internals$jscomp$inline_1434 + (rendererID = hook$jscomp$inline_1440.inject( + internals$jscomp$inline_1439 )), - (injectedHook = hook$jscomp$inline_1435); + (injectedHook = hook$jscomp$inline_1440); } 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 f80b4d2f67..432b512604 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<<253a44e83fba3348fd4685279485108a>> */ "use strict"; @@ -10357,26 +10357,26 @@ function performUnitOfWork(unitOfWork) { : (workInProgress = current); } function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate, - isProfilingMode = 0 !== (unitOfWork.mode & 2); - isProfilingMode && startProfilerTimer(unitOfWork); - switch (unitOfWork.tag) { + var next = unitOfWork; + var current = next.alternate, + isProfilingMode = 0 !== (next.mode & 2); + isProfilingMode && startProfilerTimer(next); + switch (next.tag) { case 15: case 0: - var Component = unitOfWork.type, - unresolvedProps = unitOfWork.pendingProps; + var Component = next.type, + unresolvedProps = next.pendingProps; unresolvedProps = - disableDefaultPropsExceptForClasses || - unitOfWork.elementType === Component + disableDefaultPropsExceptForClasses || next.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); var context = isContextProvider(Component) ? previousContext : contextStackCursor$1.current; - context = getMaskedContext(unitOfWork, context); + context = getMaskedContext(next, context); current = replayFunctionComponent( current, - unitOfWork, + next, unresolvedProps, Component, context, @@ -10384,35 +10384,33 @@ function replaySuspendedUnitOfWork(unitOfWork) { ); break; case 11: - Component = unitOfWork.type.render; - unresolvedProps = unitOfWork.pendingProps; + Component = next.type.render; + unresolvedProps = next.pendingProps; unresolvedProps = - disableDefaultPropsExceptForClasses || - unitOfWork.elementType === Component + disableDefaultPropsExceptForClasses || next.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); current = replayFunctionComponent( current, - unitOfWork, + next, unresolvedProps, Component, - unitOfWork.ref, + next.ref, workInProgressRootRenderLanes ); break; case 5: - resetHooksOnUnwind(unitOfWork); + resetHooksOnUnwind(next); default: - unwindInterruptedWork(current, unitOfWork), - (unitOfWork = workInProgress = - resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + unwindInterruptedWork(current, next), + (next = workInProgress = + resetWorkInProgress(next, entangledRenderLanes)), + (current = beginWork(current, next, entangledRenderLanes)); } - isProfilingMode && stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0); + isProfilingMode && stopProfilerTimerIfRunningAndRecordDelta(next, !0); + next = current; unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current - ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); + null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -11453,10 +11451,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1267 = { + devToolsConfig$jscomp$inline_1273 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "19.0.0-rc-ada09fe8", + version: "19.0.0-rc-d745ad21", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -11486,10 +11484,10 @@ var roots = new Map(), } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1267.bundleType, - version: devToolsConfig$jscomp$inline_1267.version, - rendererPackageName: devToolsConfig$jscomp$inline_1267.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1267.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1273.bundleType, + version: devToolsConfig$jscomp$inline_1273.version, + rendererPackageName: devToolsConfig$jscomp$inline_1273.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1273.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -11505,14 +11503,14 @@ var roots = new Map(), return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1267.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1273.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-rc-ada09fe8" + reconcilerVersion: "19.0.0-rc-d745ad21" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { computeComponentStackForErrorReporting: function (reactTag) {