From 434adbdb006edb069eda759f4f12b612fe3d37aa Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Mon, 8 Aug 2022 16:44:55 -0700 Subject: [PATCH] React Native sync for revisions d300ceb...9e3b772 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Sync goes to v18.2 release. I had to manually trigger CircleCI builds because TTL for build artefacts is 30 days. This sync includes the following changes: - **[060505e9d](https://github.com/facebook/react/commit/060505e9d )**: Fix misapplying prod error opt-out ([#24688](https://github.com/facebook/react/pull/24688)) //// - **[47944142f](https://github.com/facebook/react/commit/47944142f )**: `now` isn't part of the react-reconciler config anymore ([#24689](https://github.com/facebook/react/pull/24689)) //// - **[b34552352](https://github.com/facebook/react/commit/b34552352 )**: [Fizz] Support abort reasons ([#24680](https://github.com/facebook/react/pull/24680)) //// - **[79f54c16d](https://github.com/facebook/react/commit/79f54c16d )**: Bugfix: Revealing a hidden update ([#24685](https://github.com/facebook/react/pull/24685)) //// - **[7e8a020a4](https://github.com/facebook/react/commit/7e8a020a4 )**: Remove extra Server Context argument ([#24683](https://github.com/facebook/react/pull/24683)) //// - **[4f29ba1cc](https://github.com/facebook/react/commit/4f29ba1cc )**: support errorInfo in onRecoverableError ([#24591](https://github.com/facebook/react/pull/24591)) //// - **[1cd90d2cc](https://github.com/facebook/react/commit/1cd90d2cc )**: Refactor of interleaved ("concurrent") update queue ([#24663](https://github.com/facebook/react/pull/24663)) //// Changelog: [General][Changed] - React Native sync for revisions d300ceb...9e3b772 jest_e2e[run_all_tests] Reviewed By: JoshuaGross Differential Revision: D38496392 fbshipit-source-id: 3ecffc2b3354104562eb23a2643fe0a37a01a7e6 --- Libraries/Renderer/REVISION | 2 +- .../implementations/ReactFabric-dev.js | 529 +++++++++++------- .../implementations/ReactFabric-prod.js | 389 +++++++------ .../implementations/ReactFabric-profiling.js | 461 ++++++++------- .../ReactNativeRenderer-dev.js | 529 ++++++++++-------- .../ReactNativeRenderer-prod.js | 422 +++++++------- .../ReactNativeRenderer-profiling.js | 494 ++++++++-------- package.json | 8 +- packages/rn-tester/package.json | 2 +- repo-config/package.json | 4 +- template/package.json | 4 +- yarn.lock | 35 +- 12 files changed, 1601 insertions(+), 1278 deletions(-) diff --git a/Libraries/Renderer/REVISION b/Libraries/Renderer/REVISION index c9a2a7c8e0a927..9e4b4fc49cfd26 100644 --- a/Libraries/Renderer/REVISION +++ b/Libraries/Renderer/REVISION @@ -1 +1 @@ -d300cebde2a63e742ccb8b6aa7b0f61db1ae29b4 \ No newline at end of file +9e3b772b8cabbd8cadc7522ebe3dde3279e79d9e \ No newline at end of file diff --git a/Libraries/Renderer/implementations/ReactFabric-dev.js b/Libraries/Renderer/implementations/ReactFabric-dev.js index 89b2d1153112db..beb1a29161ff08 100644 --- a/Libraries/Renderer/implementations/ReactFabric-dev.js +++ b/Libraries/Renderer/implementations/ReactFabric-dev.js @@ -8,7 +8,7 @@ * @nolint * @providesModule ReactFabric-dev * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<343bc15819bccf8610b6ff32fcb59b21>> */ 'use strict'; @@ -7197,30 +7197,27 @@ function readContext(context) { return value; } -// An array of all update queues that received updates during the current // render. When this render exits, either because it finishes or because it is // interrupted, the interleaved updates will be transferred onto the main part // of the queue. -var interleavedQueues = null; -function pushInterleavedQueue(queue) { - if (interleavedQueues === null) { - interleavedQueues = [queue]; + +var concurrentQueues = null; +function pushConcurrentUpdateQueue(queue) { + if (concurrentQueues === null) { + concurrentQueues = [queue]; } else { - interleavedQueues.push(queue); + concurrentQueues.push(queue); } } -function hasInterleavedUpdates() { - return interleavedQueues !== null; -} -function enqueueInterleavedUpdates() { +function finishQueueingConcurrentUpdates() { // Transfer the interleaved updates onto the main queue. Each queue has a // `pending` field and an `interleaved` field. When they are not null, they // point to the last node in a circular linked list. We need to append the // interleaved list to the end of the pending list by joining them into a // single, circular list. - if (interleavedQueues !== null) { - for (var i = 0; i < interleavedQueues.length; i++) { - var queue = interleavedQueues[i]; + if (concurrentQueues !== null) { + for (var i = 0; i < concurrentQueues.length; i++) { + var queue = concurrentQueues[i]; var lastInterleavedUpdate = queue.interleaved; if (lastInterleavedUpdate !== null) { @@ -7238,7 +7235,115 @@ function enqueueInterleavedUpdates() { } } - interleavedQueues = null; + concurrentQueues = null; + } +} +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + var interleaved = queue.interleaved; + + if (interleaved === null) { + // This is the first update. Create a circular list. + update.next = update; // At the end of the current render, this queue's interleaved updates will + // be transferred to the pending queue. + + pushConcurrentUpdateQueue(queue); + } else { + update.next = interleaved.next; + interleaved.next = update; + } + + queue.interleaved = update; + return markUpdateLaneFromFiberToRoot(fiber, lane); +} +function enqueueConcurrentHookUpdateAndEagerlyBailout( + fiber, + queue, + update, + lane +) { + var interleaved = queue.interleaved; + + if (interleaved === null) { + // This is the first update. Create a circular list. + update.next = update; // At the end of the current render, this queue's interleaved updates will + // be transferred to the pending queue. + + pushConcurrentUpdateQueue(queue); + } else { + update.next = interleaved.next; + interleaved.next = update; + } + + queue.interleaved = update; +} +function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { + var interleaved = queue.interleaved; + + if (interleaved === null) { + // This is the first update. Create a circular list. + update.next = update; // At the end of the current render, this queue's interleaved updates will + // be transferred to the pending queue. + + pushConcurrentUpdateQueue(queue); + } else { + update.next = interleaved.next; + interleaved.next = update; + } + + queue.interleaved = update; + return markUpdateLaneFromFiberToRoot(fiber, lane); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + return markUpdateLaneFromFiberToRoot(fiber, lane); +} // Calling this function outside this module should only be done for backwards +// compatibility and should always be accompanied by a warning. + +var unsafe_markUpdateLaneFromFiberToRoot = markUpdateLaneFromFiberToRoot; + +function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + // Update the source fiber's lanes + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); + var alternate = sourceFiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } + + { + if ( + alternate === null && + (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags + ) { + warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); + } + } // Walk the parent path to the root and update the child lanes. + + var node = sourceFiber; + var parent = sourceFiber.return; + + while (parent !== null) { + parent.childLanes = mergeLanes(parent.childLanes, lane); + alternate = parent.alternate; + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, lane); + } else { + { + if ((parent.flags & (Placement | Hydrating)) !== NoFlags) { + warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); + } + } + } + + node = parent; + parent = parent.return; + } + + if (node.tag === HostRoot) { + var root = node.stateNode; + return root; + } else { + return null; } } @@ -7304,40 +7409,11 @@ function enqueueUpdate(fiber, update, lane) { if (updateQueue === null) { // Only occurs if the fiber has been unmounted. - return; + return null; } var sharedQueue = updateQueue.shared; - if (isInterleavedUpdate(fiber)) { - var interleaved = sharedQueue.interleaved; - - if (interleaved === null) { - // This is the first update. Create a circular list. - update.next = update; // At the end of the current render, this queue's interleaved updates will - // be transferred to the pending queue. - - pushInterleavedQueue(sharedQueue); - } else { - update.next = interleaved.next; - interleaved.next = update; - } - - sharedQueue.interleaved = update; - } else { - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; - } - { if ( currentlyProcessingQueue === sharedQueue && @@ -7353,6 +7429,29 @@ function enqueueUpdate(fiber, update, lane) { didWarnUpdateInsideUpdate = true; } } + + if (isUnsafeClassRenderPhaseUpdate()) { + // This is an unsafe render phase update. Add directly to the update + // queue so we can process it immediately during the current render. + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering + // this fiber. This is for backwards compatibility in the case where you + // update a different component during render phase than the one that is + // currently renderings (a pattern that is accompanied by a warning). + + return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); + } else { + return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); + } } function entangleTransitions(root, fiber, lane) { var updateQueue = fiber.updateQueue; @@ -7889,10 +7988,10 @@ var classComponentUpdater = { update.callback = callback; } - enqueueUpdate(fiber, update); - var root = scheduleUpdateOnFiber(fiber, lane, eventTime); + var root = enqueueUpdate(fiber, update, lane); if (root !== null) { + scheduleUpdateOnFiber(root, fiber, lane, eventTime); entangleTransitions(root, fiber, lane); } }, @@ -7912,10 +8011,10 @@ var classComponentUpdater = { update.callback = callback; } - enqueueUpdate(fiber, update); - var root = scheduleUpdateOnFiber(fiber, lane, eventTime); + var root = enqueueUpdate(fiber, update, lane); if (root !== null) { + scheduleUpdateOnFiber(root, fiber, lane, eventTime); entangleTransitions(root, fiber, lane); } }, @@ -7934,10 +8033,10 @@ var classComponentUpdater = { update.callback = callback; } - enqueueUpdate(fiber, update); - var root = scheduleUpdateOnFiber(fiber, lane, eventTime); + var root = enqueueUpdate(fiber, update, lane); if (root !== null) { + scheduleUpdateOnFiber(root, fiber, lane, eventTime); entangleTransitions(root, fiber, lane); } } @@ -11318,7 +11417,11 @@ function checkIfSnapshotChanged(inst) { } function forceStoreRerender(fiber) { - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (root !== null) { + scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + } } function mountState(initialState) { @@ -11804,11 +11907,11 @@ function dispatchReducerAction(fiber, queue, action) { if (isRenderPhaseUpdate(fiber)) { enqueueRenderPhaseUpdate(queue, update); } else { - enqueueUpdate$1(fiber, queue, update); - var eventTime = requestEventTime(); - var root = scheduleUpdateOnFiber(fiber, lane, eventTime); + var root = enqueueConcurrentHookUpdate(fiber, queue, update, lane); if (root !== null) { + var eventTime = requestEventTime(); + scheduleUpdateOnFiber(root, fiber, lane, eventTime); entangleTransitionUpdate(root, queue, lane); } } @@ -11837,7 +11940,6 @@ function dispatchSetState(fiber, queue, action) { if (isRenderPhaseUpdate(fiber)) { enqueueRenderPhaseUpdate(queue, update); } else { - enqueueUpdate$1(fiber, queue, update); var alternate = fiber.alternate; if ( @@ -11872,6 +11974,13 @@ function dispatchSetState(fiber, queue, action) { // It's still possible that we'll need to rebase this update later, // if the component re-renders for a different reason and by that // time the reducer has changed. + // TODO: Do we still need to entangle transitions in this case? + enqueueConcurrentHookUpdateAndEagerlyBailout( + fiber, + queue, + update, + lane + ); return; } } catch (error) { @@ -11884,10 +11993,11 @@ function dispatchSetState(fiber, queue, action) { } } - var eventTime = requestEventTime(); - var root = scheduleUpdateOnFiber(fiber, lane, eventTime); + var root = enqueueConcurrentHookUpdate(fiber, queue, update, lane); if (root !== null) { + var eventTime = requestEventTime(); + scheduleUpdateOnFiber(root, fiber, lane, eventTime); entangleTransitionUpdate(root, queue, lane); } } @@ -11917,38 +12027,7 @@ function enqueueRenderPhaseUpdate(queue, update) { } queue.pending = update; -} - -function enqueueUpdate$1(fiber, queue, update, lane) { - if (isInterleavedUpdate(fiber)) { - var interleaved = queue.interleaved; - - if (interleaved === null) { - // This is the first update. Create a circular list. - update.next = update; // At the end of the current render, this queue's interleaved updates will - // be transferred to the pending queue. - - pushInterleavedQueue(queue); - } else { - update.next = interleaved.next; - interleaved.next = update; - } - - queue.interleaved = update; - } else { - var pending = queue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - queue.pending = update; - } -} +} // TODO: Move to ReactFiberConcurrentUpdates? function entangleTransitionUpdate(root, queue, lane) { if (isTransitionLane(lane)) { @@ -12996,13 +13075,22 @@ function transferActualDuration(fiber) { } } -function createCapturedValue(value, source) { +function createCapturedValueAtFiber(value, source) { // If the value is an error, call this function immediately after it is thrown // so the stack is accurate. return { value: value, source: source, - stack: getStackByFiberInDevAndProd(source) + stack: getStackByFiberInDevAndProd(source), + digest: null + }; +} +function createCapturedValue(value, digest, stack) { + return { + value: value, + source: null, + stack: stack != null ? stack : null, + digest: digest != null ? digest : null }; } @@ -13358,7 +13446,7 @@ function markSuspenseBoundaryShouldCapture( // prevent a bail out. var update = createUpdate(NoTimestamp, SyncLane); update.tag = ForceUpdate; - enqueueUpdate(sourceFiber, update); + enqueueUpdate(sourceFiber, update, SyncLane); } } // The source fiber did not complete. Mark it with Sync priority to // indicate that it still has pending work. @@ -13488,12 +13576,13 @@ function throwException( value = uncaughtSuspenseError; } - } // We didn't find a boundary that could handle this type of exception. Start + } + + value = createCapturedValueAtFiber(value, sourceFiber); + renderDidError(value); // We didn't find a boundary that could handle this type of exception. Start // over and traverse parent path again, this time treating the exception // as an error. - renderDidError(value); - value = createCapturedValue(value, sourceFiber); var workInProgress = returnFiber; do { @@ -14131,7 +14220,7 @@ function updateClassComponent( var update = createClassErrorUpdate( workInProgress, - createCapturedValue(error$1, workInProgress), + createCapturedValueAtFiber(error$1, workInProgress), lane ); enqueueCapturedUpdate(workInProgress, update); @@ -15305,21 +15394,35 @@ function updateDehydratedSuspenseComponent( // This boundary is in a permanent fallback state. In this case, we'll never // get an update and we'll never be able to hydrate the final content. Let's just try the // client side render instead. - var _getSuspenseInstanceF = getSuspenseInstanceFallbackErrorDetails(), - errorMessage = _getSuspenseInstanceF.errorMessage; - - var error = errorMessage // eslint-disable-next-line react-internal/prod-error-codes - ? new Error(errorMessage) - : new Error( - "The server could not finish this Suspense boundary, likely " + - "due to an error during server rendering. Switched to " + - "client rendering." - ); + var digest, message, stack; + + { + var _getSuspenseInstanceF = getSuspenseInstanceFallbackErrorDetails(); + + digest = _getSuspenseInstanceF.digest; + message = _getSuspenseInstanceF.message; + stack = _getSuspenseInstanceF.stack; + } + + var error; + + if (message) { + // eslint-disable-next-line react-internal/prod-error-codes + error = new Error(message); + } else { + error = new Error( + "The server could not finish this Suspense boundary, likely " + + "due to an error during server rendering. Switched to " + + "client rendering." + ); + } + + var capturedValue = createCapturedValue(error, digest, stack); return retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, - error + capturedValue ); } // any context has changed, we need to treat is as if the input might have changed. @@ -15347,7 +15450,13 @@ function updateDehydratedSuspenseComponent( suspenseState.retryLane = attemptHydrationAtLane; // TODO: Ideally this would inherit the event time of the current render var eventTime = NoTimestamp; - scheduleUpdateOnFiber(current, attemptHydrationAtLane, eventTime); + enqueueConcurrentRenderForLane(current, attemptHydrationAtLane); + scheduleUpdateOnFiber( + root, + current, + attemptHydrationAtLane, + eventTime + ); } } // If we have scheduled higher pri work above, this will probably just abort the render // since we now have higher priority work, but in case it doesn't, we need to prepare to @@ -15356,10 +15465,8 @@ function updateDehydratedSuspenseComponent( // Delay having to do this as long as the suspense timeout allows us. renderDidSuspendDelayIfPossible(); - return retrySuspenseComponentWithoutHydrating( - current, - workInProgress, - renderLanes, + + var _capturedValue = createCapturedValue( new Error( "This Suspense boundary received an update before it finished " + "hydrating. This caused the boundary to switch to client rendering. " + @@ -15367,6 +15474,13 @@ function updateDehydratedSuspenseComponent( "in startTransition." ) ); + + return retrySuspenseComponentWithoutHydrating( + current, + workInProgress, + renderLanes, + _capturedValue + ); } else if (isSuspenseInstancePending()) { // This component is still pending more data from the server, so we can't hydrate its // content. We treat it as if this component suspended itself. It might seem as if @@ -15411,15 +15525,20 @@ function updateDehydratedSuspenseComponent( if (workInProgress.flags & ForceClientRender) { // Something errored during hydration. Try again without hydrating. workInProgress.flags &= ~ForceClientRender; - return retrySuspenseComponentWithoutHydrating( - current, - workInProgress, - renderLanes, + + var _capturedValue2 = createCapturedValue( new Error( "There was an error while hydrating this Suspense boundary. " + "Switched to client rendering." ) ); + + return retrySuspenseComponentWithoutHydrating( + current, + workInProgress, + renderLanes, + _capturedValue2 + ); } else if (workInProgress.memoizedState !== null) { // Something suspended and we should still be in dehydrated mode. // Leave the existing child in place. @@ -19198,8 +19317,12 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { var offscreenFiber = finishedWork.child; if (offscreenFiber.flags & Visibility) { + var offscreenInstance = offscreenFiber.stateNode; var newState = offscreenFiber.memoizedState; - var isHidden = newState !== null; + var isHidden = newState !== null; // Track the current state on the Offscreen instance so we can + // read it during an event + + offscreenInstance.isHidden = isHidden; if (isHidden) { var wasHidden = @@ -19236,7 +19359,13 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { commitReconciliationEffects(finishedWork); if (flags & Visibility) { + var _offscreenInstance = finishedWork.stateNode; var _newState = finishedWork.memoizedState; + + var _isHidden = _newState !== null; + // read it during an event + + _offscreenInstance.isHidden = _isHidden; } return; @@ -19900,7 +20029,7 @@ function requestRetryLane(fiber) { return claimNextRetryLane(); } -function scheduleUpdateOnFiber(fiber, lane, eventTime) { +function scheduleUpdateOnFiber(root, fiber, lane, eventTime) { checkForNestedUpdates(); { @@ -19909,12 +20038,6 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { } } - var root = markUpdateLaneFromFiberToRoot(fiber, lane); - - if (root === null) { - return null; - } - { if (isFlushingPassiveEffects) { didScheduleUpdateDuringPassiveEffects = true; @@ -19945,7 +20068,6 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { warnIfUpdatesNotWrappedWithActDEV(fiber); if (root === workInProgressRoot) { - // TODO: Consolidate with `isInterleavedUpdate` check // Received an update to a tree that's in the middle of rendering. Mark // that there was an interleaved update work on this root. Unless the // `deferRenderPhaseUpdateToNextBatch` flag is off and this is a render @@ -19986,76 +20108,14 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { flushSyncCallbacksOnlyInLegacyMode(); } } - - return root; } -// work without treating it as a typical update that originates from an event; -// e.g. retrying a Suspense boundary isn't an update, but it does schedule work -// on a fiber. - -function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - // Update the source fiber's lanes - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); - var alternate = sourceFiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } - - { - if ( - alternate === null && - (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags - ) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } // Walk the parent path to the root and update the child lanes. - - var node = sourceFiber; - var parent = sourceFiber.return; - - while (parent !== null) { - parent.childLanes = mergeLanes(parent.childLanes, lane); - alternate = parent.alternate; - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, lane); - } else { - { - if ((parent.flags & (Placement | Hydrating)) !== NoFlags) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } - } - - node = parent; - parent = parent.return; - } - - if (node.tag === HostRoot) { - var root = node.stateNode; - return root; - } else { - return null; - } -} - -function isInterleavedUpdate(fiber, lane) { +function isUnsafeClassRenderPhaseUpdate(fiber) { + // Check if this is a render phase update. Only called by class components, + // which special (deprecated) behavior for UNSAFE_componentWillReceive props. return ( - // TODO: Optimize slightly by comparing to root that fiber belongs to. - // Requires some refactoring. Not a big deal though since it's rare for - // concurrent apps to have more than a single root. - (workInProgressRoot !== null || // If the interleaved updates queue hasn't been cleared yet, then - // we should treat this as an interleaved update, too. This is also a - // defensive coding measure in case a new update comes in between when - // rendering has finished and when the interleaved updates are transferred - // to the main queue. - hasInterleavedUpdates()) && - (fiber.mode & ConcurrentMode) !== NoMode && // If this is a render phase update (i.e. UNSAFE_componentWillReceiveProps), - // then don't treat this as an interleaved update. This pattern is - // accompanied by a warning but we haven't fully deprecated it yet. We can - // remove once the deferRenderPhaseUpdateToNextBatch flag is enabled. - (executionContext & RenderContext) === NoContext + // TODO: Remove outdated deferRenderPhaseUpdateToNextBatch experiment. We + // decided not to enable it. + (executionContext & RenderContext) !== NoContext ); } // Use this function to schedule a task for a root. There's only one task per // root; if a task was already scheduled, we'll check to make sure the priority @@ -20752,7 +20812,7 @@ function prepareFreshStack(root, lanes) { workInProgressRootPingedLanes = NoLanes; workInProgressRootConcurrentErrors = null; workInProgressRootRecoverableErrors = null; - enqueueInterleavedUpdates(); + finishQueueingConcurrentUpdates(); { ReactStrictModeWarnings.discardPendingWarnings(); @@ -21397,7 +21457,12 @@ function commitRootImpl( for (var i = 0; i < recoverableErrors.length; i++) { var recoverableError = recoverableErrors[i]; - onRecoverableError(recoverableError); + var componentStack = recoverableError.stack; + var digest = recoverableError.digest; + onRecoverableError(recoverableError.value, { + componentStack: componentStack, + digest: digest + }); } } @@ -21579,11 +21644,10 @@ function prepareToThrowUncaughtError(error) { var onUncaughtError = prepareToThrowUncaughtError; function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - var errorInfo = createCapturedValue(error, sourceFiber); + var errorInfo = createCapturedValueAtFiber(error, sourceFiber); var update = createRootErrorUpdate(rootFiber, errorInfo, SyncLane); - enqueueUpdate(rootFiber, update); + var root = enqueueUpdate(rootFiber, update, SyncLane); var eventTime = requestEventTime(); - var root = markUpdateLaneFromFiberToRoot(rootFiber, SyncLane); if (root !== null) { markRootUpdated(root, SyncLane, eventTime); @@ -21623,11 +21687,10 @@ function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error$1) { (typeof instance.componentDidCatch === "function" && !isAlreadyFailedLegacyErrorBoundary(instance)) ) { - var errorInfo = createCapturedValue(error$1, sourceFiber); + var errorInfo = createCapturedValueAtFiber(error$1, sourceFiber); var update = createClassErrorUpdate(fiber, errorInfo, SyncLane); - enqueueUpdate(fiber, update); + var root = enqueueUpdate(fiber, update, SyncLane); var eventTime = requestEventTime(); - var root = markUpdateLaneFromFiberToRoot(fiber, SyncLane); if (root !== null) { markRootUpdated(root, SyncLane, eventTime); @@ -21714,7 +21777,7 @@ function retryTimedOutBoundary(boundaryFiber, retryLane) { } // TODO: Special case idle priority? var eventTime = requestEventTime(); - var root = markUpdateLaneFromFiberToRoot(boundaryFiber, retryLane); + var root = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); if (root !== null) { markRootUpdated(root, retryLane, eventTime); @@ -21830,7 +21893,6 @@ function flushRenderPhaseStrictModeWarningsInDEV() { } var didWarnStateUpdateForNotYetMountedComponent = null; - function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { { if ((executionContext & RenderContext) !== NoContext) { @@ -21890,7 +21952,6 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { } } } - var beginWork$1; { @@ -22416,7 +22477,11 @@ function scheduleFibersWithFamiliesRecursively( } if (needsRemount || needsRender) { - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var _root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (_root !== null) { + scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp); + } } if (child !== null && !needsRemount) { @@ -23121,7 +23186,9 @@ function createFiberFromOffscreen(pendingProps, mode, lanes, key) { var fiber = createFiber(OffscreenComponent, pendingProps, key, mode); fiber.elementType = REACT_OFFSCREEN_TYPE; fiber.lanes = lanes; - var primaryChildInstance = {}; + var primaryChildInstance = { + isHidden: false + }; fiber.stateNode = primaryChildInstance; return fiber; } @@ -23293,7 +23360,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.2.0-next-d300cebde-20220601"; +var ReactVersion = "18.2.0-next-9e3b772b8-20220608"; function createPortal( children, @@ -23491,10 +23558,10 @@ function updateContainer(element, container, parentComponent, callback) { update.callback = callback; } - enqueueUpdate(current$1, update); - var root = scheduleUpdateOnFiber(current$1, lane, eventTime); + var root = enqueueUpdate(current$1, update, lane); if (root !== null) { + scheduleUpdateOnFiber(root, current$1, lane, eventTime); entangleTransitions(root, current$1, lane); } @@ -23654,7 +23721,11 @@ var setSuspenseHandler = null; // Shallow cloning props works as a workaround for now to bypass the bailout check. fiber.memoizedProps = assign({}, fiber.memoizedProps); - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (root !== null) { + scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + } } }; @@ -23671,7 +23742,11 @@ var setSuspenseHandler = null; // Shallow cloning props works as a workaround for now to bypass the bailout check. fiber.memoizedProps = assign({}, fiber.memoizedProps); - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (root !== null) { + scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + } } }; @@ -23688,7 +23763,11 @@ var setSuspenseHandler = null; // Shallow cloning props works as a workaround for now to bypass the bailout check. fiber.memoizedProps = assign({}, fiber.memoizedProps); - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (root !== null) { + scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + } } }; // Support DevTools props for function components, forwardRef, memo, host components, etc. @@ -23699,7 +23778,11 @@ var setSuspenseHandler = null; fiber.alternate.pendingProps = fiber.pendingProps; } - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (root !== null) { + scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + } }; overridePropsDeletePath = function(fiber, path) { @@ -23709,7 +23792,11 @@ var setSuspenseHandler = null; fiber.alternate.pendingProps = fiber.pendingProps; } - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (root !== null) { + scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + } }; overridePropsRenamePath = function(fiber, oldPath, newPath) { @@ -23719,11 +23806,19 @@ var setSuspenseHandler = null; fiber.alternate.pendingProps = fiber.pendingProps; } - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (root !== null) { + scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + } }; scheduleUpdate = function(fiber) { - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (root !== null) { + scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + } }; setErrorHandler = function(newShouldErrorImpl) { diff --git a/Libraries/Renderer/implementations/ReactFabric-prod.js b/Libraries/Renderer/implementations/ReactFabric-prod.js index 9f83af5c81ecf0..7da25248f032a4 100644 --- a/Libraries/Renderer/implementations/ReactFabric-prod.js +++ b/Libraries/Renderer/implementations/ReactFabric-prod.js @@ -8,7 +8,7 @@ * @nolint * @providesModule ReactFabric-prod * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "use strict"; @@ -1017,7 +1017,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_218 = { +var injectedNamesToPlugins$jscomp$inline_223 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -1063,33 +1063,33 @@ var injectedNamesToPlugins$jscomp$inline_218 = { } } }, - isOrderingDirty$jscomp$inline_219 = !1, - pluginName$jscomp$inline_220; -for (pluginName$jscomp$inline_220 in injectedNamesToPlugins$jscomp$inline_218) + isOrderingDirty$jscomp$inline_224 = !1, + pluginName$jscomp$inline_225; +for (pluginName$jscomp$inline_225 in injectedNamesToPlugins$jscomp$inline_223) if ( - injectedNamesToPlugins$jscomp$inline_218.hasOwnProperty( - pluginName$jscomp$inline_220 + injectedNamesToPlugins$jscomp$inline_223.hasOwnProperty( + pluginName$jscomp$inline_225 ) ) { - var pluginModule$jscomp$inline_221 = - injectedNamesToPlugins$jscomp$inline_218[pluginName$jscomp$inline_220]; + var pluginModule$jscomp$inline_226 = + injectedNamesToPlugins$jscomp$inline_223[pluginName$jscomp$inline_225]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_220) || - namesToPlugins[pluginName$jscomp$inline_220] !== - pluginModule$jscomp$inline_221 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_225) || + namesToPlugins[pluginName$jscomp$inline_225] !== + pluginModule$jscomp$inline_226 ) { - if (namesToPlugins[pluginName$jscomp$inline_220]) + if (namesToPlugins[pluginName$jscomp$inline_225]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_220 + "`.") + (pluginName$jscomp$inline_225 + "`.") ); namesToPlugins[ - pluginName$jscomp$inline_220 - ] = pluginModule$jscomp$inline_221; - isOrderingDirty$jscomp$inline_219 = !0; + pluginName$jscomp$inline_225 + ] = pluginModule$jscomp$inline_226; + isOrderingDirty$jscomp$inline_224 = !0; } } -isOrderingDirty$jscomp$inline_219 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_224 && recomputePluginOrdering(); function getInstanceFromInstance(instanceHandle) { return instanceHandle; } @@ -2325,8 +2325,34 @@ function readContext(context) { } else lastContextDependency = lastContextDependency.next = context; return value; } -var interleavedQueues = null, - hasForceUpdate = !1; +var concurrentQueues = null; +function pushConcurrentUpdateQueue(queue) { + null === concurrentQueues + ? (concurrentQueues = [queue]) + : concurrentQueues.push(queue); +} +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + var interleaved = queue.interleaved; + null === interleaved + ? ((update.next = update), pushConcurrentUpdateQueue(queue)) + : ((update.next = interleaved.next), (interleaved.next = update)); + queue.interleaved = update; + return markUpdateLaneFromFiberToRoot(fiber, lane); +} +function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + alternate = sourceFiber; + for (sourceFiber = sourceFiber.return; null !== sourceFiber; ) + (sourceFiber.childLanes |= lane), + (alternate = sourceFiber.alternate), + null !== alternate && (alternate.childLanes |= lane), + (alternate = sourceFiber), + (sourceFiber = sourceFiber.return); + return 3 === alternate.tag ? alternate.stateNode : null; +} +var hasForceUpdate = !1; function initializeUpdateQueue(fiber) { fiber.updateQueue = { baseState: fiber.memoizedState, @@ -2357,24 +2383,24 @@ function createUpdate(eventTime, lane) { next: null }; } -function enqueueUpdate(fiber, update) { +function enqueueUpdate(fiber, update, lane) { var updateQueue = fiber.updateQueue; - null !== updateQueue && - ((updateQueue = updateQueue.shared), - isInterleavedUpdate(fiber) - ? ((fiber = updateQueue.interleaved), - null === fiber - ? ((update.next = update), - null === interleavedQueues - ? (interleavedQueues = [updateQueue]) - : interleavedQueues.push(updateQueue)) - : ((update.next = fiber.next), (fiber.next = update)), - (updateQueue.interleaved = update)) - : ((fiber = updateQueue.pending), - null === fiber - ? (update.next = update) - : ((update.next = fiber.next), (fiber.next = update)), - (updateQueue.pending = update))); + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if (0 !== (executionContext & 2)) { + var pending = updateQueue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.pending = update; + return markUpdateLaneFromFiberToRoot(fiber, lane); + } + pending = updateQueue.interleaved; + null === pending + ? ((update.next = update), pushConcurrentUpdateQueue(updateQueue)) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.interleaved = update; + return markUpdateLaneFromFiberToRoot(fiber, lane); } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; @@ -2611,9 +2637,10 @@ var classComponentUpdater = { update = createUpdate(eventTime, lane); update.payload = payload; void 0 !== callback && null !== callback && (update.callback = callback); - enqueueUpdate(inst, update); - payload = scheduleUpdateOnFiber(inst, lane, eventTime); - null !== payload && entangleTransitions(payload, inst, lane); + payload = enqueueUpdate(inst, update, lane); + null !== payload && + (scheduleUpdateOnFiber(payload, inst, lane, eventTime), + entangleTransitions(payload, inst, lane)); }, enqueueReplaceState: function(inst, payload, callback) { inst = inst._reactInternals; @@ -2623,9 +2650,10 @@ var classComponentUpdater = { update.tag = 1; update.payload = payload; void 0 !== callback && null !== callback && (update.callback = callback); - enqueueUpdate(inst, update); - payload = scheduleUpdateOnFiber(inst, lane, eventTime); - null !== payload && entangleTransitions(payload, inst, lane); + payload = enqueueUpdate(inst, update, lane); + null !== payload && + (scheduleUpdateOnFiber(payload, inst, lane, eventTime), + entangleTransitions(payload, inst, lane)); }, enqueueForceUpdate: function(inst, callback) { inst = inst._reactInternals; @@ -2634,9 +2662,10 @@ var classComponentUpdater = { update = createUpdate(eventTime, lane); update.tag = 2; void 0 !== callback && null !== callback && (update.callback = callback); - enqueueUpdate(inst, update); - callback = scheduleUpdateOnFiber(inst, lane, eventTime); - null !== callback && entangleTransitions(callback, inst, lane); + callback = enqueueUpdate(inst, update, lane); + null !== callback && + (scheduleUpdateOnFiber(callback, inst, lane, eventTime), + entangleTransitions(callback, inst, lane)); } }; function checkShouldComponentUpdate( @@ -3741,11 +3770,11 @@ function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { function updateStoreInstance(fiber, inst, nextSnapshot, getSnapshot) { inst.value = nextSnapshot; inst.getSnapshot = getSnapshot; - checkIfSnapshotChanged(inst) && scheduleUpdateOnFiber(fiber, 1, -1); + checkIfSnapshotChanged(inst) && forceStoreRerender(fiber); } function subscribeToStore(fiber, inst, subscribe) { return subscribe(function() { - checkIfSnapshotChanged(inst) && scheduleUpdateOnFiber(fiber, 1, -1); + checkIfSnapshotChanged(inst) && forceStoreRerender(fiber); }); } function checkIfSnapshotChanged(inst) { @@ -3758,6 +3787,10 @@ function checkIfSnapshotChanged(inst) { return !0; } } +function forceStoreRerender(fiber) { + var root = markUpdateLaneFromFiberToRoot(fiber, 1); + null !== root && scheduleUpdateOnFiber(root, fiber, 1, -1); +} function mountState(initialState) { var hook = mountWorkInProgressHook(); "function" === typeof initialState && (initialState = initialState()); @@ -3928,12 +3961,15 @@ function dispatchReducerAction(fiber, queue, action) { eagerState: null, next: null }; - isRenderPhaseUpdate(fiber) - ? enqueueRenderPhaseUpdate(queue, action) - : (enqueueUpdate$1(fiber, queue, action), - (action = requestEventTime()), - (fiber = scheduleUpdateOnFiber(fiber, lane, action)), - null !== fiber && entangleTransitionUpdate(fiber, queue, lane)); + if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, action); + else if ( + ((action = enqueueConcurrentHookUpdate(fiber, queue, action, lane)), + null !== action) + ) { + var eventTime = requestEventTime(); + scheduleUpdateOnFiber(action, fiber, lane, eventTime); + entangleTransitionUpdate(action, queue, lane); + } } function dispatchSetState(fiber, queue, action) { var lane = requestUpdateLane(fiber), @@ -3946,7 +3982,6 @@ function dispatchSetState(fiber, queue, action) { }; if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, update); else { - enqueueUpdate$1(fiber, queue, update); var alternate = fiber.alternate; if ( 0 === fiber.lanes && @@ -3958,13 +3993,22 @@ function dispatchSetState(fiber, queue, action) { eagerState = alternate(currentState, action); update.hasEagerState = !0; update.eagerState = eagerState; - if (objectIs(eagerState, currentState)) return; + if (objectIs(eagerState, currentState)) { + var interleaved = queue.interleaved; + null === interleaved + ? ((update.next = update), pushConcurrentUpdateQueue(queue)) + : ((update.next = interleaved.next), (interleaved.next = update)); + queue.interleaved = update; + return; + } } catch (error) { } finally { } - action = requestEventTime(); - fiber = scheduleUpdateOnFiber(fiber, lane, action); - null !== fiber && entangleTransitionUpdate(fiber, queue, lane); + action = enqueueConcurrentHookUpdate(fiber, queue, update, lane); + null !== action && + ((update = requestEventTime()), + scheduleUpdateOnFiber(action, fiber, lane, update), + entangleTransitionUpdate(action, queue, lane)); } } function isRenderPhaseUpdate(fiber) { @@ -3982,22 +4026,6 @@ function enqueueRenderPhaseUpdate(queue, update) { : ((update.next = pending.next), (pending.next = update)); queue.pending = update; } -function enqueueUpdate$1(fiber, queue, update) { - isInterleavedUpdate(fiber) - ? ((fiber = queue.interleaved), - null === fiber - ? ((update.next = update), - null === interleavedQueues - ? (interleavedQueues = [queue]) - : interleavedQueues.push(queue)) - : ((update.next = fiber.next), (fiber.next = update)), - (queue.interleaved = update)) - : ((fiber = queue.pending), - null === fiber - ? (update.next = update) - : ((update.next = fiber.next), (fiber.next = update)), - (queue.pending = update)); -} function entangleTransitionUpdate(root, queue, lane) { if (0 !== (lane & 4194240)) { var queueLanes = queue.lanes; @@ -4193,7 +4221,7 @@ var ContextOnlyDispatcher = { useId: updateId, unstable_isNewReconciler: !1 }; -function createCapturedValue(value, source) { +function createCapturedValueAtFiber(value, source) { try { var info = "", node = source; @@ -4204,7 +4232,20 @@ function createCapturedValue(value, source) { JSCompiler_inline_result = "\nError generating stack: " + x.message + "\n" + x.stack; } - return { value: value, source: source, stack: JSCompiler_inline_result }; + return { + value: value, + source: source, + stack: JSCompiler_inline_result, + digest: null + }; +} +function createCapturedValue(value, digest, stack) { + return { + value: value, + source: null, + stack: null != stack ? stack : null, + digest: null != digest ? digest : null + }; } if ( "function" !== @@ -4930,13 +4971,16 @@ function updateDehydratedSuspenseComponent( if (workInProgress.flags & 256) return ( (workInProgress.flags &= -257), + (suspenseState = createCapturedValue( + Error( + "There was an error while hydrating this Suspense boundary. Switched to client rendering." + ) + )), retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, - Error( - "There was an error while hydrating this Suspense boundary. Switched to client rendering." - ) + suspenseState ) ); if (null !== workInProgress.memoizedState) @@ -4981,16 +5025,19 @@ function updateDehydratedSuspenseComponent( ); if (shim$1()) return ( - (suspenseState = shim$1().errorMessage), + (suspenseState = shim$1().digest), + (suspenseState = createCapturedValue( + Error( + "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." + ), + suspenseState, + void 0 + )), retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, suspenseState - ? Error(suspenseState) - : Error( - "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." - ) ) ); didSuspend = 0 !== (renderLanes & current.childLanes); @@ -5033,23 +5080,27 @@ function updateDehydratedSuspenseComponent( default: didSuspend = 0; } - nextProps = + didSuspend = 0 !== (didSuspend & (nextProps.suspendedLanes | renderLanes)) ? 0 : didSuspend; - 0 !== nextProps && - nextProps !== suspenseState.retryLane && - ((suspenseState.retryLane = nextProps), - scheduleUpdateOnFiber(current, nextProps, -1)); + 0 !== didSuspend && + didSuspend !== suspenseState.retryLane && + ((suspenseState.retryLane = didSuspend), + markUpdateLaneFromFiberToRoot(current, didSuspend), + scheduleUpdateOnFiber(nextProps, current, didSuspend, -1)); } renderDidSuspendDelayIfPossible(); + suspenseState = createCapturedValue( + Error( + "This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition." + ) + ); return retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, - Error( - "This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition." - ) + suspenseState ); } if (shim$1()) @@ -5450,14 +5501,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$60 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$60 = lastTailNode), + for (var lastTailNode$62 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$62 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$60 + null === lastTailNode$62 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$60.sibling = null); + : (lastTailNode$62.sibling = null); } } function bubbleProperties(completedWork) { @@ -5467,19 +5518,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$61 = completedWork.child; null !== child$61; ) - (newChildLanes |= child$61.lanes | child$61.childLanes), - (subtreeFlags |= child$61.subtreeFlags & 14680064), - (subtreeFlags |= child$61.flags & 14680064), - (child$61.return = completedWork), - (child$61 = child$61.sibling); + for (var child$63 = completedWork.child; null !== child$63; ) + (newChildLanes |= child$63.lanes | child$63.childLanes), + (subtreeFlags |= child$63.subtreeFlags & 14680064), + (subtreeFlags |= child$63.flags & 14680064), + (child$63.return = completedWork), + (child$63 = child$63.sibling); else - for (child$61 = completedWork.child; null !== child$61; ) - (newChildLanes |= child$61.lanes | child$61.childLanes), - (subtreeFlags |= child$61.subtreeFlags), - (subtreeFlags |= child$61.flags), - (child$61.return = completedWork), - (child$61 = child$61.sibling); + for (child$63 = completedWork.child; null !== child$63; ) + (newChildLanes |= child$63.lanes | child$63.childLanes), + (subtreeFlags |= child$63.subtreeFlags), + (subtreeFlags |= child$63.flags), + (child$63.return = completedWork), + (child$63 = child$63.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -5971,8 +6022,8 @@ function commitHookEffectListMount(flags, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & flags) === flags) { - var create$73 = effect.create; - effect.destroy = create$73(); + var create$75 = effect.create; + effect.destroy = create$75(); } effect = effect.next; } while (effect !== finishedWork); @@ -6155,8 +6206,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$77) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$77); + } catch (error$79) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$79); } } break; @@ -6191,14 +6242,18 @@ function commitMutationEffectsOnFiber(finishedWork, root) { commitReconciliationEffects(finishedWork); root = finishedWork.child; root.flags & 8192 && - null !== root.memoizedState && - (null === root.alternate || null === root.alternate.memoizedState) && - (globalMostRecentFallbackTime = now()); + ((current = null !== root.memoizedState), + (root.stateNode.isHidden = current), + !current || + (null !== root.alternate && null !== root.alternate.memoizedState) || + (globalMostRecentFallbackTime = now())); flags & 4 && attachSuspenseRetryListeners(finishedWork); break; case 22: recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); + flags & 8192 && + (finishedWork.stateNode.isHidden = null !== finishedWork.memoizedState); break; case 19: recursivelyTraverseMutationEffects(root, finishedWork); @@ -6259,8 +6314,8 @@ function commitLayoutEffects(finishedWork) { commitUpdateQueue(firstChild, updateQueue, instance); break; case 3: - var updateQueue$74 = firstChild.updateQueue; - if (null !== updateQueue$74) { + var updateQueue$76 = firstChild.updateQueue; + if (null !== updateQueue$76) { current = null; if (null !== firstChild.child) switch (firstChild.child.tag) { @@ -6270,7 +6325,7 @@ function commitLayoutEffects(finishedWork) { case 1: current = firstChild.child.stateNode; } - commitUpdateQueue(firstChild, updateQueue$74, current); + commitUpdateQueue(firstChild, updateQueue$76, current); } break; case 5: @@ -6397,15 +6452,13 @@ function requestUpdateLane(fiber) { } return fiber; } -function scheduleUpdateOnFiber(fiber, lane, eventTime) { +function scheduleUpdateOnFiber(root, fiber, lane, eventTime) { if (50 < nestedUpdateCount) throw ((nestedUpdateCount = 0), (rootWithNestedUpdates = null), Error( "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." )); - var root = markUpdateLaneFromFiberToRoot(fiber, lane); - if (null === root) return null; markRootUpdated(root, lane, eventTime); if (0 === (executionContext & 2) || root !== workInProgressRoot) root === workInProgressRoot && @@ -6419,27 +6472,6 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { 0 === (fiber.mode & 1) && ((workInProgressRootRenderTargetTime = now() + 500), includesLegacySyncCallbacks && flushSyncCallbacks()); - return root; -} -function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - sourceFiber.lanes |= lane; - var alternate = sourceFiber.alternate; - null !== alternate && (alternate.lanes |= lane); - alternate = sourceFiber; - for (sourceFiber = sourceFiber.return; null !== sourceFiber; ) - (sourceFiber.childLanes |= lane), - (alternate = sourceFiber.alternate), - null !== alternate && (alternate.childLanes |= lane), - (alternate = sourceFiber), - (sourceFiber = sourceFiber.return); - return 3 === alternate.tag ? alternate.stateNode : null; -} -function isInterleavedUpdate(fiber) { - return ( - (null !== workInProgressRoot || null !== interleavedQueues) && - 0 !== (fiber.mode & 1) && - 0 === (executionContext & 2) - ); } function ensureRootIsScheduled(root, currentTime) { for ( @@ -6844,10 +6876,10 @@ function prepareFreshStack(root, lanes) { workInProgressRootFatalError = null; workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null; - if (null !== interleavedQueues) { - for (lanes = 0; lanes < interleavedQueues.length; lanes++) + if (null !== concurrentQueues) { + for (lanes = 0; lanes < concurrentQueues.length; lanes++) if ( - ((timeoutHandle = interleavedQueues[lanes]), + ((timeoutHandle = concurrentQueues[lanes]), (interruptedWork = timeoutHandle.interleaved), null !== interruptedWork) ) { @@ -6861,7 +6893,7 @@ function prepareFreshStack(root, lanes) { } timeoutHandle.pending = interruptedWork; } - interleavedQueues = null; + concurrentQueues = null; } return root; } @@ -6957,7 +6989,7 @@ function handleError(root$jscomp$0, thrownValue) { else { var update = createUpdate(-1, 1); update.tag = 2; - enqueueUpdate(sourceFiber, update); + enqueueUpdate(sourceFiber, update, 1); } sourceFiber.lanes |= 1; } @@ -6984,13 +7016,12 @@ function handleError(root$jscomp$0, thrownValue) { ); } } - root = value; + root = value = createCapturedValueAtFiber(value, sourceFiber); 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2); null === workInProgressRootConcurrentErrors ? (workInProgressRootConcurrentErrors = [root]) : workInProgressRootConcurrentErrors.push(root); - value = createCapturedValue(value, sourceFiber); root = returnFiber; do { switch (root.tag) { @@ -7222,7 +7253,11 @@ function commitRootImpl( transitions < recoverableErrors.length; transitions++ ) - renderPriorityLevel(recoverableErrors[transitions]); + (lanes = recoverableErrors[transitions]), + renderPriorityLevel(lanes.value, { + componentStack: lanes.stack, + digest: lanes.digest + }); if (hasUncaughtError) throw ((hasUncaughtError = !1), (root = firstUncaughtError), @@ -7386,11 +7421,10 @@ function flushPassiveEffects() { return !1; } function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - sourceFiber = createCapturedValue(error, sourceFiber); + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 1); - enqueueUpdate(rootFiber, sourceFiber); + rootFiber = enqueueUpdate(rootFiber, sourceFiber, 1); sourceFiber = requestEventTime(); - rootFiber = markUpdateLaneFromFiberToRoot(rootFiber, 1); null !== rootFiber && (markRootUpdated(rootFiber, 1, sourceFiber), ensureRootIsScheduled(rootFiber, sourceFiber)); @@ -7420,18 +7454,18 @@ function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { (null === legacyErrorBoundariesThatAlreadyFailed || !legacyErrorBoundariesThatAlreadyFailed.has(instance))) ) { - sourceFiber = createCapturedValue(error, sourceFiber); + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); sourceFiber = createClassErrorUpdate( nearestMountedAncestor, sourceFiber, 1 ); - enqueueUpdate(nearestMountedAncestor, sourceFiber); - sourceFiber = requestEventTime(); - nearestMountedAncestor = markUpdateLaneFromFiberToRoot( + nearestMountedAncestor = enqueueUpdate( nearestMountedAncestor, + sourceFiber, 1 ); + sourceFiber = requestEventTime(); null !== nearestMountedAncestor && (markRootUpdated(nearestMountedAncestor, 1, sourceFiber), ensureRootIsScheduled(nearestMountedAncestor, sourceFiber)); @@ -8086,7 +8120,7 @@ function createFiberFromOffscreen(pendingProps, mode, lanes, key) { pendingProps = createFiber(22, pendingProps, key, mode); pendingProps.elementType = REACT_OFFSCREEN_TYPE; pendingProps.lanes = lanes; - pendingProps.stateNode = {}; + pendingProps.stateNode = { isHidden: !1 }; return pendingProps; } function createFiberFromText(content, mode, lanes) { @@ -8208,9 +8242,10 @@ function updateContainer(element, container, parentComponent, callback) { container.payload = { element: element }; callback = void 0 === callback ? null : callback; null !== callback && (container.callback = callback); - enqueueUpdate(current, container); - element = scheduleUpdateOnFiber(current, lane, eventTime); - null !== element && entangleTransitions(element, current, lane); + element = enqueueUpdate(current, container, lane); + null !== element && + (scheduleUpdateOnFiber(element, current, lane, eventTime), + entangleTransitions(element, current, lane)); return lane; } function emptyFindFiberByHostInstance() { @@ -8245,10 +8280,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_925 = { + devToolsConfig$jscomp$inline_938 = { findFiberByHostInstance: getInstanceFromInstance, bundleType: 0, - version: "18.2.0-next-d300cebde-20220601", + version: "18.2.0-next-9e3b772b8-20220608", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8263,11 +8298,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1171 = { - bundleType: devToolsConfig$jscomp$inline_925.bundleType, - version: devToolsConfig$jscomp$inline_925.version, - rendererPackageName: devToolsConfig$jscomp$inline_925.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_925.rendererConfig, +var internals$jscomp$inline_1180 = { + bundleType: devToolsConfig$jscomp$inline_938.bundleType, + version: devToolsConfig$jscomp$inline_938.version, + rendererPackageName: devToolsConfig$jscomp$inline_938.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_938.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8283,26 +8318,26 @@ var internals$jscomp$inline_1171 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_925.findFiberByHostInstance || + devToolsConfig$jscomp$inline_938.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.2.0-next-d300cebde-20220601" + reconcilerVersion: "18.2.0-next-9e3b772b8-20220608" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1172 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1181 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1172.isDisabled && - hook$jscomp$inline_1172.supportsFiber + !hook$jscomp$inline_1181.isDisabled && + hook$jscomp$inline_1181.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1172.inject( - internals$jscomp$inline_1171 + (rendererID = hook$jscomp$inline_1181.inject( + internals$jscomp$inline_1180 )), - (injectedHook = hook$jscomp$inline_1172); + (injectedHook = hook$jscomp$inline_1181); } catch (err) {} } exports.createPortal = function(children, containerTag) { diff --git a/Libraries/Renderer/implementations/ReactFabric-profiling.js b/Libraries/Renderer/implementations/ReactFabric-profiling.js index d8823b6d8e767d..9ea3a0f9deb677 100644 --- a/Libraries/Renderer/implementations/ReactFabric-profiling.js +++ b/Libraries/Renderer/implementations/ReactFabric-profiling.js @@ -8,7 +8,7 @@ * @nolint * @providesModule ReactFabric-profiling * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<1466b90312f81bedd331ce30d8d61240>> */ @@ -1028,7 +1028,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_229 = { +var injectedNamesToPlugins$jscomp$inline_234 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -1074,33 +1074,33 @@ var injectedNamesToPlugins$jscomp$inline_229 = { } } }, - isOrderingDirty$jscomp$inline_230 = !1, - pluginName$jscomp$inline_231; -for (pluginName$jscomp$inline_231 in injectedNamesToPlugins$jscomp$inline_229) + isOrderingDirty$jscomp$inline_235 = !1, + pluginName$jscomp$inline_236; +for (pluginName$jscomp$inline_236 in injectedNamesToPlugins$jscomp$inline_234) if ( - injectedNamesToPlugins$jscomp$inline_229.hasOwnProperty( - pluginName$jscomp$inline_231 + injectedNamesToPlugins$jscomp$inline_234.hasOwnProperty( + pluginName$jscomp$inline_236 ) ) { - var pluginModule$jscomp$inline_232 = - injectedNamesToPlugins$jscomp$inline_229[pluginName$jscomp$inline_231]; + var pluginModule$jscomp$inline_237 = + injectedNamesToPlugins$jscomp$inline_234[pluginName$jscomp$inline_236]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_231) || - namesToPlugins[pluginName$jscomp$inline_231] !== - pluginModule$jscomp$inline_232 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_236) || + namesToPlugins[pluginName$jscomp$inline_236] !== + pluginModule$jscomp$inline_237 ) { - if (namesToPlugins[pluginName$jscomp$inline_231]) + if (namesToPlugins[pluginName$jscomp$inline_236]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_231 + "`.") + (pluginName$jscomp$inline_236 + "`.") ); namesToPlugins[ - pluginName$jscomp$inline_231 - ] = pluginModule$jscomp$inline_232; - isOrderingDirty$jscomp$inline_230 = !0; + pluginName$jscomp$inline_236 + ] = pluginModule$jscomp$inline_237; + isOrderingDirty$jscomp$inline_235 = !0; } } -isOrderingDirty$jscomp$inline_230 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_235 && recomputePluginOrdering(); function getInstanceFromInstance(instanceHandle) { return instanceHandle; } @@ -2384,8 +2384,34 @@ function readContext(context) { } else lastContextDependency = lastContextDependency.next = context; return value; } -var interleavedQueues = null, - hasForceUpdate = !1; +var concurrentQueues = null; +function pushConcurrentUpdateQueue(queue) { + null === concurrentQueues + ? (concurrentQueues = [queue]) + : concurrentQueues.push(queue); +} +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + var interleaved = queue.interleaved; + null === interleaved + ? ((update.next = update), pushConcurrentUpdateQueue(queue)) + : ((update.next = interleaved.next), (interleaved.next = update)); + queue.interleaved = update; + return markUpdateLaneFromFiberToRoot(fiber, lane); +} +function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + alternate = sourceFiber; + for (sourceFiber = sourceFiber.return; null !== sourceFiber; ) + (sourceFiber.childLanes |= lane), + (alternate = sourceFiber.alternate), + null !== alternate && (alternate.childLanes |= lane), + (alternate = sourceFiber), + (sourceFiber = sourceFiber.return); + return 3 === alternate.tag ? alternate.stateNode : null; +} +var hasForceUpdate = !1; function initializeUpdateQueue(fiber) { fiber.updateQueue = { baseState: fiber.memoizedState, @@ -2416,24 +2442,24 @@ function createUpdate(eventTime, lane) { next: null }; } -function enqueueUpdate(fiber, update) { +function enqueueUpdate(fiber, update, lane) { var updateQueue = fiber.updateQueue; - null !== updateQueue && - ((updateQueue = updateQueue.shared), - isInterleavedUpdate(fiber) - ? ((fiber = updateQueue.interleaved), - null === fiber - ? ((update.next = update), - null === interleavedQueues - ? (interleavedQueues = [updateQueue]) - : interleavedQueues.push(updateQueue)) - : ((update.next = fiber.next), (fiber.next = update)), - (updateQueue.interleaved = update)) - : ((fiber = updateQueue.pending), - null === fiber - ? (update.next = update) - : ((update.next = fiber.next), (fiber.next = update)), - (updateQueue.pending = update))); + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if (0 !== (executionContext & 2)) { + var pending = updateQueue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.pending = update; + return markUpdateLaneFromFiberToRoot(fiber, lane); + } + pending = updateQueue.interleaved; + null === pending + ? ((update.next = update), pushConcurrentUpdateQueue(updateQueue)) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.interleaved = update; + return markUpdateLaneFromFiberToRoot(fiber, lane); } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; @@ -2670,9 +2696,10 @@ var classComponentUpdater = { update = createUpdate(eventTime, lane); update.payload = payload; void 0 !== callback && null !== callback && (update.callback = callback); - enqueueUpdate(inst, update); - payload = scheduleUpdateOnFiber(inst, lane, eventTime); - null !== payload && entangleTransitions(payload, inst, lane); + payload = enqueueUpdate(inst, update, lane); + null !== payload && + (scheduleUpdateOnFiber(payload, inst, lane, eventTime), + entangleTransitions(payload, inst, lane)); }, enqueueReplaceState: function(inst, payload, callback) { inst = inst._reactInternals; @@ -2682,9 +2709,10 @@ var classComponentUpdater = { update.tag = 1; update.payload = payload; void 0 !== callback && null !== callback && (update.callback = callback); - enqueueUpdate(inst, update); - payload = scheduleUpdateOnFiber(inst, lane, eventTime); - null !== payload && entangleTransitions(payload, inst, lane); + payload = enqueueUpdate(inst, update, lane); + null !== payload && + (scheduleUpdateOnFiber(payload, inst, lane, eventTime), + entangleTransitions(payload, inst, lane)); }, enqueueForceUpdate: function(inst, callback) { inst = inst._reactInternals; @@ -2693,9 +2721,10 @@ var classComponentUpdater = { update = createUpdate(eventTime, lane); update.tag = 2; void 0 !== callback && null !== callback && (update.callback = callback); - enqueueUpdate(inst, update); - callback = scheduleUpdateOnFiber(inst, lane, eventTime); - null !== callback && entangleTransitions(callback, inst, lane); + callback = enqueueUpdate(inst, update, lane); + null !== callback && + (scheduleUpdateOnFiber(callback, inst, lane, eventTime), + entangleTransitions(callback, inst, lane)); } }; function checkShouldComponentUpdate( @@ -3800,11 +3829,11 @@ function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { function updateStoreInstance(fiber, inst, nextSnapshot, getSnapshot) { inst.value = nextSnapshot; inst.getSnapshot = getSnapshot; - checkIfSnapshotChanged(inst) && scheduleUpdateOnFiber(fiber, 1, -1); + checkIfSnapshotChanged(inst) && forceStoreRerender(fiber); } function subscribeToStore(fiber, inst, subscribe) { return subscribe(function() { - checkIfSnapshotChanged(inst) && scheduleUpdateOnFiber(fiber, 1, -1); + checkIfSnapshotChanged(inst) && forceStoreRerender(fiber); }); } function checkIfSnapshotChanged(inst) { @@ -3817,6 +3846,10 @@ function checkIfSnapshotChanged(inst) { return !0; } } +function forceStoreRerender(fiber) { + var root = markUpdateLaneFromFiberToRoot(fiber, 1); + null !== root && scheduleUpdateOnFiber(root, fiber, 1, -1); +} function mountState(initialState) { var hook = mountWorkInProgressHook(); "function" === typeof initialState && (initialState = initialState()); @@ -3987,12 +4020,15 @@ function dispatchReducerAction(fiber, queue, action) { eagerState: null, next: null }; - isRenderPhaseUpdate(fiber) - ? enqueueRenderPhaseUpdate(queue, action) - : (enqueueUpdate$1(fiber, queue, action), - (action = requestEventTime()), - (fiber = scheduleUpdateOnFiber(fiber, lane, action)), - null !== fiber && entangleTransitionUpdate(fiber, queue, lane)); + if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, action); + else if ( + ((action = enqueueConcurrentHookUpdate(fiber, queue, action, lane)), + null !== action) + ) { + var eventTime = requestEventTime(); + scheduleUpdateOnFiber(action, fiber, lane, eventTime); + entangleTransitionUpdate(action, queue, lane); + } } function dispatchSetState(fiber, queue, action) { var lane = requestUpdateLane(fiber), @@ -4005,7 +4041,6 @@ function dispatchSetState(fiber, queue, action) { }; if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, update); else { - enqueueUpdate$1(fiber, queue, update); var alternate = fiber.alternate; if ( 0 === fiber.lanes && @@ -4017,13 +4052,22 @@ function dispatchSetState(fiber, queue, action) { eagerState = alternate(currentState, action); update.hasEagerState = !0; update.eagerState = eagerState; - if (objectIs(eagerState, currentState)) return; + if (objectIs(eagerState, currentState)) { + var interleaved = queue.interleaved; + null === interleaved + ? ((update.next = update), pushConcurrentUpdateQueue(queue)) + : ((update.next = interleaved.next), (interleaved.next = update)); + queue.interleaved = update; + return; + } } catch (error) { } finally { } - action = requestEventTime(); - fiber = scheduleUpdateOnFiber(fiber, lane, action); - null !== fiber && entangleTransitionUpdate(fiber, queue, lane); + action = enqueueConcurrentHookUpdate(fiber, queue, update, lane); + null !== action && + ((update = requestEventTime()), + scheduleUpdateOnFiber(action, fiber, lane, update), + entangleTransitionUpdate(action, queue, lane)); } } function isRenderPhaseUpdate(fiber) { @@ -4041,22 +4085,6 @@ function enqueueRenderPhaseUpdate(queue, update) { : ((update.next = pending.next), (pending.next = update)); queue.pending = update; } -function enqueueUpdate$1(fiber, queue, update) { - isInterleavedUpdate(fiber) - ? ((fiber = queue.interleaved), - null === fiber - ? ((update.next = update), - null === interleavedQueues - ? (interleavedQueues = [queue]) - : interleavedQueues.push(queue)) - : ((update.next = fiber.next), (fiber.next = update)), - (queue.interleaved = update)) - : ((fiber = queue.pending), - null === fiber - ? (update.next = update) - : ((update.next = fiber.next), (fiber.next = update)), - (queue.pending = update)); -} function entangleTransitionUpdate(root, queue, lane) { if (0 !== (lane & 4194240)) { var queueLanes = queue.lanes; @@ -4310,7 +4338,7 @@ function transferActualDuration(fiber) { for (var child = fiber.child; child; ) (fiber.actualDuration += child.actualDuration), (child = child.sibling); } -function createCapturedValue(value, source) { +function createCapturedValueAtFiber(value, source) { try { var info = "", node = source; @@ -4321,7 +4349,20 @@ function createCapturedValue(value, source) { JSCompiler_inline_result = "\nError generating stack: " + x.message + "\n" + x.stack; } - return { value: value, source: source, stack: JSCompiler_inline_result }; + return { + value: value, + source: source, + stack: JSCompiler_inline_result, + digest: null + }; +} +function createCapturedValue(value, digest, stack) { + return { + value: value, + source: null, + stack: null != stack ? stack : null, + digest: null != digest ? digest : null + }; } if ( "function" !== @@ -5062,13 +5103,16 @@ function updateDehydratedSuspenseComponent( if (workInProgress.flags & 256) return ( (workInProgress.flags &= -257), + (suspenseState = createCapturedValue( + Error( + "There was an error while hydrating this Suspense boundary. Switched to client rendering." + ) + )), retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, - Error( - "There was an error while hydrating this Suspense boundary. Switched to client rendering." - ) + suspenseState ) ); if (null !== workInProgress.memoizedState) @@ -5113,16 +5157,19 @@ function updateDehydratedSuspenseComponent( ); if (shim$1()) return ( - (suspenseState = shim$1().errorMessage), + (suspenseState = shim$1().digest), + (suspenseState = createCapturedValue( + Error( + "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." + ), + suspenseState, + void 0 + )), retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, suspenseState - ? Error(suspenseState) - : Error( - "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." - ) ) ); didSuspend = 0 !== (renderLanes & current.childLanes); @@ -5165,23 +5212,27 @@ function updateDehydratedSuspenseComponent( default: didSuspend = 0; } - nextProps = + didSuspend = 0 !== (didSuspend & (nextProps.suspendedLanes | renderLanes)) ? 0 : didSuspend; - 0 !== nextProps && - nextProps !== suspenseState.retryLane && - ((suspenseState.retryLane = nextProps), - scheduleUpdateOnFiber(current, nextProps, -1)); + 0 !== didSuspend && + didSuspend !== suspenseState.retryLane && + ((suspenseState.retryLane = didSuspend), + markUpdateLaneFromFiberToRoot(current, didSuspend), + scheduleUpdateOnFiber(nextProps, current, didSuspend, -1)); } renderDidSuspendDelayIfPossible(); + suspenseState = createCapturedValue( + Error( + "This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition." + ) + ); return retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, - Error( - "This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition." - ) + suspenseState ); } if (shim$1()) @@ -5590,14 +5641,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$63 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$63 = lastTailNode), + for (var lastTailNode$65 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$65 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$63 + null === lastTailNode$65 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$63.sibling = null); + : (lastTailNode$65.sibling = null); } } function bubbleProperties(completedWork) { @@ -5609,53 +5660,53 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$65 = completedWork.selfBaseDuration, - child$66 = completedWork.child; - null !== child$66; + var treeBaseDuration$67 = completedWork.selfBaseDuration, + child$68 = completedWork.child; + null !== child$68; ) - (newChildLanes |= child$66.lanes | child$66.childLanes), - (subtreeFlags |= child$66.subtreeFlags & 14680064), - (subtreeFlags |= child$66.flags & 14680064), - (treeBaseDuration$65 += child$66.treeBaseDuration), - (child$66 = child$66.sibling); - completedWork.treeBaseDuration = treeBaseDuration$65; + (newChildLanes |= child$68.lanes | child$68.childLanes), + (subtreeFlags |= child$68.subtreeFlags & 14680064), + (subtreeFlags |= child$68.flags & 14680064), + (treeBaseDuration$67 += child$68.treeBaseDuration), + (child$68 = child$68.sibling); + completedWork.treeBaseDuration = treeBaseDuration$67; } else for ( - treeBaseDuration$65 = completedWork.child; - null !== treeBaseDuration$65; + treeBaseDuration$67 = completedWork.child; + null !== treeBaseDuration$67; ) (newChildLanes |= - treeBaseDuration$65.lanes | treeBaseDuration$65.childLanes), - (subtreeFlags |= treeBaseDuration$65.subtreeFlags & 14680064), - (subtreeFlags |= treeBaseDuration$65.flags & 14680064), - (treeBaseDuration$65.return = completedWork), - (treeBaseDuration$65 = treeBaseDuration$65.sibling); + treeBaseDuration$67.lanes | treeBaseDuration$67.childLanes), + (subtreeFlags |= treeBaseDuration$67.subtreeFlags & 14680064), + (subtreeFlags |= treeBaseDuration$67.flags & 14680064), + (treeBaseDuration$67.return = completedWork), + (treeBaseDuration$67 = treeBaseDuration$67.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$65 = completedWork.actualDuration; - child$66 = completedWork.selfBaseDuration; + treeBaseDuration$67 = completedWork.actualDuration; + child$68 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$65 += child.actualDuration), - (child$66 += child.treeBaseDuration), + (treeBaseDuration$67 += child.actualDuration), + (child$68 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$65; - completedWork.treeBaseDuration = child$66; + completedWork.actualDuration = treeBaseDuration$67; + completedWork.treeBaseDuration = child$68; } else for ( - treeBaseDuration$65 = completedWork.child; - null !== treeBaseDuration$65; + treeBaseDuration$67 = completedWork.child; + null !== treeBaseDuration$67; ) (newChildLanes |= - treeBaseDuration$65.lanes | treeBaseDuration$65.childLanes), - (subtreeFlags |= treeBaseDuration$65.subtreeFlags), - (subtreeFlags |= treeBaseDuration$65.flags), - (treeBaseDuration$65.return = completedWork), - (treeBaseDuration$65 = treeBaseDuration$65.sibling); + treeBaseDuration$67.lanes | treeBaseDuration$67.childLanes), + (subtreeFlags |= treeBaseDuration$67.subtreeFlags), + (subtreeFlags |= treeBaseDuration$67.flags), + (treeBaseDuration$67.return = completedWork), + (treeBaseDuration$67 = treeBaseDuration$67.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -6180,8 +6231,8 @@ function commitHookEffectListMount(flags, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & flags) === flags) { - var create$81 = effect.create; - effect.destroy = create$81(); + var create$83 = effect.create; + effect.destroy = create$83(); } effect = effect.next; } while (effect !== finishedWork); @@ -6397,22 +6448,22 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { startLayoutEffectTimer(), commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$87) { + } catch (error$89) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$87 + error$89 ); } recordLayoutEffectDuration(finishedWork); } else try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$88) { + } catch (error$90) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$88 + error$90 ); } } @@ -6448,14 +6499,18 @@ function commitMutationEffectsOnFiber(finishedWork, root) { commitReconciliationEffects(finishedWork); root = finishedWork.child; root.flags & 8192 && - null !== root.memoizedState && - (null === root.alternate || null === root.alternate.memoizedState) && - (globalMostRecentFallbackTime = now()); + ((current = null !== root.memoizedState), + (root.stateNode.isHidden = current), + !current || + (null !== root.alternate && null !== root.alternate.memoizedState) || + (globalMostRecentFallbackTime = now())); flags & 4 && attachSuspenseRetryListeners(finishedWork); break; case 22: recursivelyTraverseMutationEffects(root, finishedWork); commitReconciliationEffects(finishedWork); + flags & 8192 && + (finishedWork.stateNode.isHidden = null !== finishedWork.memoizedState); break; case 19: recursivelyTraverseMutationEffects(root, finishedWork); @@ -6548,22 +6603,22 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { commitUpdateQueue(committedLanes, updateQueue, instance); break; case 3: - var updateQueue$83 = committedLanes.updateQueue; - if (null !== updateQueue$83) { - var instance$84 = null; + var updateQueue$85 = committedLanes.updateQueue; + if (null !== updateQueue$85) { + var instance$86 = null; if (null !== committedLanes.child) switch (committedLanes.child.tag) { case 5: - instance$84 = + instance$86 = committedLanes.child.stateNode.canonical; break; case 1: - instance$84 = committedLanes.child.stateNode; + instance$86 = committedLanes.child.stateNode; } commitUpdateQueue( committedLanes, - updateQueue$83, - instance$84 + updateQueue$85, + instance$86 ); } break; @@ -6582,7 +6637,7 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { onCommit = _finishedWork$memoize2.onCommit, onRender = _finishedWork$memoize2.onRender, effectDuration = committedLanes.stateNode.effectDuration; - instance$84 = commitTime; + instance$86 = commitTime; current = null === current ? "mount" : "update"; currentUpdateIsNested && (current = "nested-update"); "function" === typeof onRender && @@ -6592,14 +6647,14 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { committedLanes.actualDuration, committedLanes.treeBaseDuration, committedLanes.actualStartTime, - instance$84 + instance$86 ); "function" === typeof onCommit && onCommit( committedLanes.memoizedProps.id, current, effectDuration, - instance$84 + instance$86 ); enqueuePendingPassiveProfilerEffect(committedLanes); var parentFiber = committedLanes.return; @@ -6630,27 +6685,27 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { ); } if (committedLanes.flags & 512) { - instance$84 = void 0; + instance$86 = void 0; current = committedLanes; var ref = current.ref; if (null !== ref) { var instance$jscomp$0 = current.stateNode; switch (current.tag) { case 5: - instance$84 = instance$jscomp$0.canonical; + instance$86 = instance$jscomp$0.canonical; break; default: - instance$84 = instance$jscomp$0; + instance$86 = instance$jscomp$0; } if ("function" === typeof ref) if (current.mode & 2) try { - startLayoutEffectTimer(), ref(instance$84); + startLayoutEffectTimer(), ref(instance$86); } finally { recordLayoutEffectDuration(current); } - else ref(instance$84); - else ref.current = instance$84; + else ref(instance$86); + else ref.current = instance$86; } } } catch (error) { @@ -6665,10 +6720,10 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { nextEffect = null; break; } - instance$84 = committedLanes.sibling; - if (null !== instance$84) { - instance$84.return = committedLanes.return; - nextEffect = instance$84; + instance$86 = committedLanes.sibling; + if (null !== instance$86) { + instance$86.return = committedLanes.return; + nextEffect = instance$86; break; } nextEffect = committedLanes.return; @@ -6739,15 +6794,13 @@ function requestUpdateLane(fiber) { } return fiber; } -function scheduleUpdateOnFiber(fiber, lane, eventTime) { +function scheduleUpdateOnFiber(root, fiber, lane, eventTime) { if (50 < nestedUpdateCount) throw ((nestedUpdateCount = 0), (rootWithNestedUpdates = null), Error( "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." )); - var root = markUpdateLaneFromFiberToRoot(fiber, lane); - if (null === root) return null; markRootUpdated(root, lane, eventTime); if (0 === (executionContext & 2) || root !== workInProgressRoot) isDevToolsPresent && addFiberToLanesMap(root, fiber, lane), @@ -6762,27 +6815,6 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { 0 === (fiber.mode & 1) && ((workInProgressRootRenderTargetTime = now() + 500), includesLegacySyncCallbacks && flushSyncCallbacks()); - return root; -} -function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - sourceFiber.lanes |= lane; - var alternate = sourceFiber.alternate; - null !== alternate && (alternate.lanes |= lane); - alternate = sourceFiber; - for (sourceFiber = sourceFiber.return; null !== sourceFiber; ) - (sourceFiber.childLanes |= lane), - (alternate = sourceFiber.alternate), - null !== alternate && (alternate.childLanes |= lane), - (alternate = sourceFiber), - (sourceFiber = sourceFiber.return); - return 3 === alternate.tag ? alternate.stateNode : null; -} -function isInterleavedUpdate(fiber) { - return ( - (null !== workInProgressRoot || null !== interleavedQueues) && - 0 !== (fiber.mode & 1) && - 0 === (executionContext & 2) - ); } function ensureRootIsScheduled(root, currentTime) { for ( @@ -7198,10 +7230,10 @@ function prepareFreshStack(root, lanes) { workInProgressRootFatalError = null; workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null; - if (null !== interleavedQueues) { - for (lanes = 0; lanes < interleavedQueues.length; lanes++) + if (null !== concurrentQueues) { + for (lanes = 0; lanes < concurrentQueues.length; lanes++) if ( - ((timeoutHandle = interleavedQueues[lanes]), + ((timeoutHandle = concurrentQueues[lanes]), (interruptedWork = timeoutHandle.interleaved), null !== interruptedWork) ) { @@ -7215,7 +7247,7 @@ function prepareFreshStack(root, lanes) { } timeoutHandle.pending = interruptedWork; } - interleavedQueues = null; + concurrentQueues = null; } return root; } @@ -7314,7 +7346,7 @@ function handleError(root$jscomp$0, thrownValue) { else { var update = createUpdate(-1, 1); update.tag = 2; - enqueueUpdate(sourceFiber, update); + enqueueUpdate(sourceFiber, update, 1); } sourceFiber.lanes |= 1; } @@ -7341,13 +7373,12 @@ function handleError(root$jscomp$0, thrownValue) { ); } } - root = value; + root = value = createCapturedValueAtFiber(value, sourceFiber); 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2); null === workInProgressRootConcurrentErrors ? (workInProgressRootConcurrentErrors = [root]) : workInProgressRootConcurrentErrors.push(root); - value = createCapturedValue(value, sourceFiber); root = returnFiber; do { switch (root.tag) { @@ -7611,7 +7642,11 @@ function commitRootImpl( transitions < recoverableErrors.length; transitions++ ) - renderPriorityLevel(recoverableErrors[transitions]); + (lanes = recoverableErrors[transitions]), + renderPriorityLevel(lanes.value, { + componentStack: lanes.stack, + digest: lanes.digest + }); if (hasUncaughtError) throw ((hasUncaughtError = !1), (root = firstUncaughtError), @@ -7841,11 +7876,10 @@ function enqueuePendingPassiveProfilerEffect(fiber) { })); } function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - sourceFiber = createCapturedValue(error, sourceFiber); + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 1); - enqueueUpdate(rootFiber, sourceFiber); + rootFiber = enqueueUpdate(rootFiber, sourceFiber, 1); sourceFiber = requestEventTime(); - rootFiber = markUpdateLaneFromFiberToRoot(rootFiber, 1); null !== rootFiber && (markRootUpdated(rootFiber, 1, sourceFiber), ensureRootIsScheduled(rootFiber, sourceFiber)); @@ -7875,18 +7909,18 @@ function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { (null === legacyErrorBoundariesThatAlreadyFailed || !legacyErrorBoundariesThatAlreadyFailed.has(instance))) ) { - sourceFiber = createCapturedValue(error, sourceFiber); + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); sourceFiber = createClassErrorUpdate( nearestMountedAncestor, sourceFiber, 1 ); - enqueueUpdate(nearestMountedAncestor, sourceFiber); - sourceFiber = requestEventTime(); - nearestMountedAncestor = markUpdateLaneFromFiberToRoot( + nearestMountedAncestor = enqueueUpdate( nearestMountedAncestor, + sourceFiber, 1 ); + sourceFiber = requestEventTime(); null !== nearestMountedAncestor && (markRootUpdated(nearestMountedAncestor, 1, sourceFiber), ensureRootIsScheduled(nearestMountedAncestor, sourceFiber)); @@ -8559,7 +8593,7 @@ function createFiberFromOffscreen(pendingProps, mode, lanes, key) { pendingProps = createFiber(22, pendingProps, key, mode); pendingProps.elementType = REACT_OFFSCREEN_TYPE; pendingProps.lanes = lanes; - pendingProps.stateNode = {}; + pendingProps.stateNode = { isHidden: !1 }; return pendingProps; } function createFiberFromText(content, mode, lanes) { @@ -8685,9 +8719,10 @@ function updateContainer(element, container, parentComponent, callback) { container.payload = { element: element }; callback = void 0 === callback ? null : callback; null !== callback && (container.callback = callback); - enqueueUpdate(current, container); - element = scheduleUpdateOnFiber(current, lane, eventTime); - null !== element && entangleTransitions(element, current, lane); + element = enqueueUpdate(current, container, lane); + null !== element && + (scheduleUpdateOnFiber(element, current, lane, eventTime), + entangleTransitions(element, current, lane)); return lane; } function emptyFindFiberByHostInstance() { @@ -8722,10 +8757,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_968 = { + devToolsConfig$jscomp$inline_981 = { findFiberByHostInstance: getInstanceFromInstance, bundleType: 0, - version: "18.2.0-next-d300cebde-20220601", + version: "18.2.0-next-9e3b772b8-20220608", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8740,11 +8775,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1234 = { - bundleType: devToolsConfig$jscomp$inline_968.bundleType, - version: devToolsConfig$jscomp$inline_968.version, - rendererPackageName: devToolsConfig$jscomp$inline_968.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_968.rendererConfig, +var internals$jscomp$inline_1243 = { + bundleType: devToolsConfig$jscomp$inline_981.bundleType, + version: devToolsConfig$jscomp$inline_981.version, + rendererPackageName: devToolsConfig$jscomp$inline_981.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_981.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8760,26 +8795,26 @@ var internals$jscomp$inline_1234 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_968.findFiberByHostInstance || + devToolsConfig$jscomp$inline_981.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.2.0-next-d300cebde-20220601" + reconcilerVersion: "18.2.0-next-9e3b772b8-20220608" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1235 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1244 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1235.isDisabled && - hook$jscomp$inline_1235.supportsFiber + !hook$jscomp$inline_1244.isDisabled && + hook$jscomp$inline_1244.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1235.inject( - internals$jscomp$inline_1234 + (rendererID = hook$jscomp$inline_1244.inject( + internals$jscomp$inline_1243 )), - (injectedHook = hook$jscomp$inline_1235); + (injectedHook = hook$jscomp$inline_1244); } catch (err) {} } exports.createPortal = function(children, containerTag) { diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js index 18a204692a609c..6c7116eae43870 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js @@ -8,7 +8,7 @@ * @nolint * @providesModule ReactNativeRenderer-dev * @preventMunge - * @generated SignedSource<<8a3af3b821da6ecad0d3cd1faee60e8f>> + * @generated SignedSource<> */ 'use strict'; @@ -7326,30 +7326,27 @@ function readContext(context) { return value; } -// An array of all update queues that received updates during the current // render. When this render exits, either because it finishes or because it is // interrupted, the interleaved updates will be transferred onto the main part // of the queue. -var interleavedQueues = null; -function pushInterleavedQueue(queue) { - if (interleavedQueues === null) { - interleavedQueues = [queue]; + +var concurrentQueues = null; +function pushConcurrentUpdateQueue(queue) { + if (concurrentQueues === null) { + concurrentQueues = [queue]; } else { - interleavedQueues.push(queue); + concurrentQueues.push(queue); } } -function hasInterleavedUpdates() { - return interleavedQueues !== null; -} -function enqueueInterleavedUpdates() { +function finishQueueingConcurrentUpdates() { // Transfer the interleaved updates onto the main queue. Each queue has a // `pending` field and an `interleaved` field. When they are not null, they // point to the last node in a circular linked list. We need to append the // interleaved list to the end of the pending list by joining them into a // single, circular list. - if (interleavedQueues !== null) { - for (var i = 0; i < interleavedQueues.length; i++) { - var queue = interleavedQueues[i]; + if (concurrentQueues !== null) { + for (var i = 0; i < concurrentQueues.length; i++) { + var queue = concurrentQueues[i]; var lastInterleavedUpdate = queue.interleaved; if (lastInterleavedUpdate !== null) { @@ -7367,7 +7364,115 @@ function enqueueInterleavedUpdates() { } } - interleavedQueues = null; + concurrentQueues = null; + } +} +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + var interleaved = queue.interleaved; + + if (interleaved === null) { + // This is the first update. Create a circular list. + update.next = update; // At the end of the current render, this queue's interleaved updates will + // be transferred to the pending queue. + + pushConcurrentUpdateQueue(queue); + } else { + update.next = interleaved.next; + interleaved.next = update; + } + + queue.interleaved = update; + return markUpdateLaneFromFiberToRoot(fiber, lane); +} +function enqueueConcurrentHookUpdateAndEagerlyBailout( + fiber, + queue, + update, + lane +) { + var interleaved = queue.interleaved; + + if (interleaved === null) { + // This is the first update. Create a circular list. + update.next = update; // At the end of the current render, this queue's interleaved updates will + // be transferred to the pending queue. + + pushConcurrentUpdateQueue(queue); + } else { + update.next = interleaved.next; + interleaved.next = update; + } + + queue.interleaved = update; +} +function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { + var interleaved = queue.interleaved; + + if (interleaved === null) { + // This is the first update. Create a circular list. + update.next = update; // At the end of the current render, this queue's interleaved updates will + // be transferred to the pending queue. + + pushConcurrentUpdateQueue(queue); + } else { + update.next = interleaved.next; + interleaved.next = update; + } + + queue.interleaved = update; + return markUpdateLaneFromFiberToRoot(fiber, lane); +} +function enqueueConcurrentRenderForLane(fiber, lane) { + return markUpdateLaneFromFiberToRoot(fiber, lane); +} // Calling this function outside this module should only be done for backwards +// compatibility and should always be accompanied by a warning. + +var unsafe_markUpdateLaneFromFiberToRoot = markUpdateLaneFromFiberToRoot; + +function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + // Update the source fiber's lanes + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); + var alternate = sourceFiber.alternate; + + if (alternate !== null) { + alternate.lanes = mergeLanes(alternate.lanes, lane); + } + + { + if ( + alternate === null && + (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags + ) { + warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); + } + } // Walk the parent path to the root and update the child lanes. + + var node = sourceFiber; + var parent = sourceFiber.return; + + while (parent !== null) { + parent.childLanes = mergeLanes(parent.childLanes, lane); + alternate = parent.alternate; + + if (alternate !== null) { + alternate.childLanes = mergeLanes(alternate.childLanes, lane); + } else { + { + if ((parent.flags & (Placement | Hydrating)) !== NoFlags) { + warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); + } + } + } + + node = parent; + parent = parent.return; + } + + if (node.tag === HostRoot) { + var root = node.stateNode; + return root; + } else { + return null; } } @@ -7433,40 +7538,11 @@ function enqueueUpdate(fiber, update, lane) { if (updateQueue === null) { // Only occurs if the fiber has been unmounted. - return; + return null; } var sharedQueue = updateQueue.shared; - if (isInterleavedUpdate(fiber)) { - var interleaved = sharedQueue.interleaved; - - if (interleaved === null) { - // This is the first update. Create a circular list. - update.next = update; // At the end of the current render, this queue's interleaved updates will - // be transferred to the pending queue. - - pushInterleavedQueue(sharedQueue); - } else { - update.next = interleaved.next; - interleaved.next = update; - } - - sharedQueue.interleaved = update; - } else { - var pending = sharedQueue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - sharedQueue.pending = update; - } - { if ( currentlyProcessingQueue === sharedQueue && @@ -7482,6 +7558,29 @@ function enqueueUpdate(fiber, update, lane) { didWarnUpdateInsideUpdate = true; } } + + if (isUnsafeClassRenderPhaseUpdate()) { + // This is an unsafe render phase update. Add directly to the update + // queue so we can process it immediately during the current render. + var pending = sharedQueue.pending; + + if (pending === null) { + // This is the first update. Create a circular list. + update.next = update; + } else { + update.next = pending.next; + pending.next = update; + } + + sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering + // this fiber. This is for backwards compatibility in the case where you + // update a different component during render phase than the one that is + // currently renderings (a pattern that is accompanied by a warning). + + return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); + } else { + return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); + } } function entangleTransitions(root, fiber, lane) { var updateQueue = fiber.updateQueue; @@ -8018,10 +8117,10 @@ var classComponentUpdater = { update.callback = callback; } - enqueueUpdate(fiber, update); - var root = scheduleUpdateOnFiber(fiber, lane, eventTime); + var root = enqueueUpdate(fiber, update, lane); if (root !== null) { + scheduleUpdateOnFiber(root, fiber, lane, eventTime); entangleTransitions(root, fiber, lane); } }, @@ -8041,10 +8140,10 @@ var classComponentUpdater = { update.callback = callback; } - enqueueUpdate(fiber, update); - var root = scheduleUpdateOnFiber(fiber, lane, eventTime); + var root = enqueueUpdate(fiber, update, lane); if (root !== null) { + scheduleUpdateOnFiber(root, fiber, lane, eventTime); entangleTransitions(root, fiber, lane); } }, @@ -8063,10 +8162,10 @@ var classComponentUpdater = { update.callback = callback; } - enqueueUpdate(fiber, update); - var root = scheduleUpdateOnFiber(fiber, lane, eventTime); + var root = enqueueUpdate(fiber, update, lane); if (root !== null) { + scheduleUpdateOnFiber(root, fiber, lane, eventTime); entangleTransitions(root, fiber, lane); } } @@ -11447,7 +11546,11 @@ function checkIfSnapshotChanged(inst) { } function forceStoreRerender(fiber) { - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (root !== null) { + scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + } } function mountState(initialState) { @@ -11933,11 +12036,11 @@ function dispatchReducerAction(fiber, queue, action) { if (isRenderPhaseUpdate(fiber)) { enqueueRenderPhaseUpdate(queue, update); } else { - enqueueUpdate$1(fiber, queue, update); - var eventTime = requestEventTime(); - var root = scheduleUpdateOnFiber(fiber, lane, eventTime); + var root = enqueueConcurrentHookUpdate(fiber, queue, update, lane); if (root !== null) { + var eventTime = requestEventTime(); + scheduleUpdateOnFiber(root, fiber, lane, eventTime); entangleTransitionUpdate(root, queue, lane); } } @@ -11966,7 +12069,6 @@ function dispatchSetState(fiber, queue, action) { if (isRenderPhaseUpdate(fiber)) { enqueueRenderPhaseUpdate(queue, update); } else { - enqueueUpdate$1(fiber, queue, update); var alternate = fiber.alternate; if ( @@ -12001,6 +12103,13 @@ function dispatchSetState(fiber, queue, action) { // It's still possible that we'll need to rebase this update later, // if the component re-renders for a different reason and by that // time the reducer has changed. + // TODO: Do we still need to entangle transitions in this case? + enqueueConcurrentHookUpdateAndEagerlyBailout( + fiber, + queue, + update, + lane + ); return; } } catch (error) { @@ -12013,10 +12122,11 @@ function dispatchSetState(fiber, queue, action) { } } - var eventTime = requestEventTime(); - var root = scheduleUpdateOnFiber(fiber, lane, eventTime); + var root = enqueueConcurrentHookUpdate(fiber, queue, update, lane); if (root !== null) { + var eventTime = requestEventTime(); + scheduleUpdateOnFiber(root, fiber, lane, eventTime); entangleTransitionUpdate(root, queue, lane); } } @@ -12046,38 +12156,7 @@ function enqueueRenderPhaseUpdate(queue, update) { } queue.pending = update; -} - -function enqueueUpdate$1(fiber, queue, update, lane) { - if (isInterleavedUpdate(fiber)) { - var interleaved = queue.interleaved; - - if (interleaved === null) { - // This is the first update. Create a circular list. - update.next = update; // At the end of the current render, this queue's interleaved updates will - // be transferred to the pending queue. - - pushInterleavedQueue(queue); - } else { - update.next = interleaved.next; - interleaved.next = update; - } - - queue.interleaved = update; - } else { - var pending = queue.pending; - - if (pending === null) { - // This is the first update. Create a circular list. - update.next = update; - } else { - update.next = pending.next; - pending.next = update; - } - - queue.pending = update; - } -} +} // TODO: Move to ReactFiberConcurrentUpdates? function entangleTransitionUpdate(root, queue, lane) { if (isTransitionLane(lane)) { @@ -13125,13 +13204,22 @@ function transferActualDuration(fiber) { } } -function createCapturedValue(value, source) { +function createCapturedValueAtFiber(value, source) { // If the value is an error, call this function immediately after it is thrown // so the stack is accurate. return { value: value, source: source, - stack: getStackByFiberInDevAndProd(source) + stack: getStackByFiberInDevAndProd(source), + digest: null + }; +} +function createCapturedValue(value, digest, stack) { + return { + value: value, + source: null, + stack: stack != null ? stack : null, + digest: digest != null ? digest : null }; } @@ -13487,7 +13575,7 @@ function markSuspenseBoundaryShouldCapture( // prevent a bail out. var update = createUpdate(NoTimestamp, SyncLane); update.tag = ForceUpdate; - enqueueUpdate(sourceFiber, update); + enqueueUpdate(sourceFiber, update, SyncLane); } } // The source fiber did not complete. Mark it with Sync priority to // indicate that it still has pending work. @@ -13617,12 +13705,13 @@ function throwException( value = uncaughtSuspenseError; } - } // We didn't find a boundary that could handle this type of exception. Start + } + + value = createCapturedValueAtFiber(value, sourceFiber); + renderDidError(value); // We didn't find a boundary that could handle this type of exception. Start // over and traverse parent path again, this time treating the exception // as an error. - renderDidError(value); - value = createCapturedValue(value, sourceFiber); var workInProgress = returnFiber; do { @@ -14260,7 +14349,7 @@ function updateClassComponent( var update = createClassErrorUpdate( workInProgress, - createCapturedValue(error$1, workInProgress), + createCapturedValueAtFiber(error$1, workInProgress), lane ); enqueueCapturedUpdate(workInProgress, update); @@ -15434,21 +15523,35 @@ function updateDehydratedSuspenseComponent( // This boundary is in a permanent fallback state. In this case, we'll never // get an update and we'll never be able to hydrate the final content. Let's just try the // client side render instead. - var _getSuspenseInstanceF = getSuspenseInstanceFallbackErrorDetails(), - errorMessage = _getSuspenseInstanceF.errorMessage; - - var error = errorMessage // eslint-disable-next-line react-internal/prod-error-codes - ? new Error(errorMessage) - : new Error( - "The server could not finish this Suspense boundary, likely " + - "due to an error during server rendering. Switched to " + - "client rendering." - ); + var digest, message, stack; + + { + var _getSuspenseInstanceF = getSuspenseInstanceFallbackErrorDetails(); + + digest = _getSuspenseInstanceF.digest; + message = _getSuspenseInstanceF.message; + stack = _getSuspenseInstanceF.stack; + } + + var error; + + if (message) { + // eslint-disable-next-line react-internal/prod-error-codes + error = new Error(message); + } else { + error = new Error( + "The server could not finish this Suspense boundary, likely " + + "due to an error during server rendering. Switched to " + + "client rendering." + ); + } + + var capturedValue = createCapturedValue(error, digest, stack); return retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, - error + capturedValue ); } // any context has changed, we need to treat is as if the input might have changed. @@ -15476,7 +15579,13 @@ function updateDehydratedSuspenseComponent( suspenseState.retryLane = attemptHydrationAtLane; // TODO: Ideally this would inherit the event time of the current render var eventTime = NoTimestamp; - scheduleUpdateOnFiber(current, attemptHydrationAtLane, eventTime); + enqueueConcurrentRenderForLane(current, attemptHydrationAtLane); + scheduleUpdateOnFiber( + root, + current, + attemptHydrationAtLane, + eventTime + ); } } // If we have scheduled higher pri work above, this will probably just abort the render // since we now have higher priority work, but in case it doesn't, we need to prepare to @@ -15485,10 +15594,8 @@ function updateDehydratedSuspenseComponent( // Delay having to do this as long as the suspense timeout allows us. renderDidSuspendDelayIfPossible(); - return retrySuspenseComponentWithoutHydrating( - current, - workInProgress, - renderLanes, + + var _capturedValue = createCapturedValue( new Error( "This Suspense boundary received an update before it finished " + "hydrating. This caused the boundary to switch to client rendering. " + @@ -15496,6 +15603,13 @@ function updateDehydratedSuspenseComponent( "in startTransition." ) ); + + return retrySuspenseComponentWithoutHydrating( + current, + workInProgress, + renderLanes, + _capturedValue + ); } else if (isSuspenseInstancePending()) { // This component is still pending more data from the server, so we can't hydrate its // content. We treat it as if this component suspended itself. It might seem as if @@ -15540,15 +15654,20 @@ function updateDehydratedSuspenseComponent( if (workInProgress.flags & ForceClientRender) { // Something errored during hydration. Try again without hydrating. workInProgress.flags &= ~ForceClientRender; - return retrySuspenseComponentWithoutHydrating( - current, - workInProgress, - renderLanes, + + var _capturedValue2 = createCapturedValue( new Error( "There was an error while hydrating this Suspense boundary. " + "Switched to client rendering." ) ); + + return retrySuspenseComponentWithoutHydrating( + current, + workInProgress, + renderLanes, + _capturedValue2 + ); } else if (workInProgress.memoizedState !== null) { // Something suspended and we should still be in dehydrated mode. // Leave the existing child in place. @@ -19540,8 +19659,12 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { var offscreenFiber = finishedWork.child; if (offscreenFiber.flags & Visibility) { + var offscreenInstance = offscreenFiber.stateNode; var newState = offscreenFiber.memoizedState; - var isHidden = newState !== null; + var isHidden = newState !== null; // Track the current state on the Offscreen instance so we can + // read it during an event + + offscreenInstance.isHidden = isHidden; if (isHidden) { var wasHidden = @@ -19578,11 +19701,15 @@ function commitMutationEffectsOnFiber(finishedWork, root, lanes) { commitReconciliationEffects(finishedWork); if (flags & Visibility) { + var _offscreenInstance = finishedWork.stateNode; var _newState = finishedWork.memoizedState; var _isHidden = _newState !== null; - var offscreenBoundary = finishedWork; + var offscreenBoundary = finishedWork; // Track the current state on the Offscreen instance so we can + // read it during an event + + _offscreenInstance.isHidden = _isHidden; { // TODO: This needs to run whenever there's an insertion or update @@ -20254,7 +20381,7 @@ function requestRetryLane(fiber) { return claimNextRetryLane(); } -function scheduleUpdateOnFiber(fiber, lane, eventTime) { +function scheduleUpdateOnFiber(root, fiber, lane, eventTime) { checkForNestedUpdates(); { @@ -20263,12 +20390,6 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { } } - var root = markUpdateLaneFromFiberToRoot(fiber, lane); - - if (root === null) { - return null; - } - { if (isFlushingPassiveEffects) { didScheduleUpdateDuringPassiveEffects = true; @@ -20299,7 +20420,6 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { warnIfUpdatesNotWrappedWithActDEV(fiber); if (root === workInProgressRoot) { - // TODO: Consolidate with `isInterleavedUpdate` check // Received an update to a tree that's in the middle of rendering. Mark // that there was an interleaved update work on this root. Unless the // `deferRenderPhaseUpdateToNextBatch` flag is off and this is a render @@ -20340,76 +20460,14 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { flushSyncCallbacksOnlyInLegacyMode(); } } - - return root; -} -// work without treating it as a typical update that originates from an event; -// e.g. retrying a Suspense boundary isn't an update, but it does schedule work -// on a fiber. - -function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - // Update the source fiber's lanes - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); - var alternate = sourceFiber.alternate; - - if (alternate !== null) { - alternate.lanes = mergeLanes(alternate.lanes, lane); - } - - { - if ( - alternate === null && - (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags - ) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } // Walk the parent path to the root and update the child lanes. - - var node = sourceFiber; - var parent = sourceFiber.return; - - while (parent !== null) { - parent.childLanes = mergeLanes(parent.childLanes, lane); - alternate = parent.alternate; - - if (alternate !== null) { - alternate.childLanes = mergeLanes(alternate.childLanes, lane); - } else { - { - if ((parent.flags & (Placement | Hydrating)) !== NoFlags) { - warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); - } - } - } - - node = parent; - parent = parent.return; - } - - if (node.tag === HostRoot) { - var root = node.stateNode; - return root; - } else { - return null; - } } - -function isInterleavedUpdate(fiber, lane) { +function isUnsafeClassRenderPhaseUpdate(fiber) { + // Check if this is a render phase update. Only called by class components, + // which special (deprecated) behavior for UNSAFE_componentWillReceive props. return ( - // TODO: Optimize slightly by comparing to root that fiber belongs to. - // Requires some refactoring. Not a big deal though since it's rare for - // concurrent apps to have more than a single root. - (workInProgressRoot !== null || // If the interleaved updates queue hasn't been cleared yet, then - // we should treat this as an interleaved update, too. This is also a - // defensive coding measure in case a new update comes in between when - // rendering has finished and when the interleaved updates are transferred - // to the main queue. - hasInterleavedUpdates()) && - (fiber.mode & ConcurrentMode) !== NoMode && // If this is a render phase update (i.e. UNSAFE_componentWillReceiveProps), - // then don't treat this as an interleaved update. This pattern is - // accompanied by a warning but we haven't fully deprecated it yet. We can - // remove once the deferRenderPhaseUpdateToNextBatch flag is enabled. - (executionContext & RenderContext) === NoContext + // TODO: Remove outdated deferRenderPhaseUpdateToNextBatch experiment. We + // decided not to enable it. + (executionContext & RenderContext) !== NoContext ); } // Use this function to schedule a task for a root. There's only one task per // root; if a task was already scheduled, we'll check to make sure the priority @@ -21106,7 +21164,7 @@ function prepareFreshStack(root, lanes) { workInProgressRootPingedLanes = NoLanes; workInProgressRootConcurrentErrors = null; workInProgressRootRecoverableErrors = null; - enqueueInterleavedUpdates(); + finishQueueingConcurrentUpdates(); { ReactStrictModeWarnings.discardPendingWarnings(); @@ -21751,7 +21809,12 @@ function commitRootImpl( for (var i = 0; i < recoverableErrors.length; i++) { var recoverableError = recoverableErrors[i]; - onRecoverableError(recoverableError); + var componentStack = recoverableError.stack; + var digest = recoverableError.digest; + onRecoverableError(recoverableError.value, { + componentStack: componentStack, + digest: digest + }); } } @@ -21933,11 +21996,10 @@ function prepareToThrowUncaughtError(error) { var onUncaughtError = prepareToThrowUncaughtError; function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - var errorInfo = createCapturedValue(error, sourceFiber); + var errorInfo = createCapturedValueAtFiber(error, sourceFiber); var update = createRootErrorUpdate(rootFiber, errorInfo, SyncLane); - enqueueUpdate(rootFiber, update); + var root = enqueueUpdate(rootFiber, update, SyncLane); var eventTime = requestEventTime(); - var root = markUpdateLaneFromFiberToRoot(rootFiber, SyncLane); if (root !== null) { markRootUpdated(root, SyncLane, eventTime); @@ -21977,11 +22039,10 @@ function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error$1) { (typeof instance.componentDidCatch === "function" && !isAlreadyFailedLegacyErrorBoundary(instance)) ) { - var errorInfo = createCapturedValue(error$1, sourceFiber); + var errorInfo = createCapturedValueAtFiber(error$1, sourceFiber); var update = createClassErrorUpdate(fiber, errorInfo, SyncLane); - enqueueUpdate(fiber, update); + var root = enqueueUpdate(fiber, update, SyncLane); var eventTime = requestEventTime(); - var root = markUpdateLaneFromFiberToRoot(fiber, SyncLane); if (root !== null) { markRootUpdated(root, SyncLane, eventTime); @@ -22068,7 +22129,7 @@ function retryTimedOutBoundary(boundaryFiber, retryLane) { } // TODO: Special case idle priority? var eventTime = requestEventTime(); - var root = markUpdateLaneFromFiberToRoot(boundaryFiber, retryLane); + var root = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); if (root !== null) { markRootUpdated(root, retryLane, eventTime); @@ -22184,7 +22245,6 @@ function flushRenderPhaseStrictModeWarningsInDEV() { } var didWarnStateUpdateForNotYetMountedComponent = null; - function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { { if ((executionContext & RenderContext) !== NoContext) { @@ -22244,7 +22304,6 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { } } } - var beginWork$1; { @@ -22770,7 +22829,11 @@ function scheduleFibersWithFamiliesRecursively( } if (needsRemount || needsRender) { - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var _root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (_root !== null) { + scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp); + } } if (child !== null && !needsRemount) { @@ -23475,7 +23538,9 @@ function createFiberFromOffscreen(pendingProps, mode, lanes, key) { var fiber = createFiber(OffscreenComponent, pendingProps, key, mode); fiber.elementType = REACT_OFFSCREEN_TYPE; fiber.lanes = lanes; - var primaryChildInstance = {}; + var primaryChildInstance = { + isHidden: false + }; fiber.stateNode = primaryChildInstance; return fiber; } @@ -23647,7 +23712,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.2.0-next-d300cebde-20220601"; +var ReactVersion = "18.2.0-next-9e3b772b8-20220608"; function createPortal( children, @@ -23845,10 +23910,10 @@ function updateContainer(element, container, parentComponent, callback) { update.callback = callback; } - enqueueUpdate(current$1, update); - var root = scheduleUpdateOnFiber(current$1, lane, eventTime); + var root = enqueueUpdate(current$1, update, lane); if (root !== null) { + scheduleUpdateOnFiber(root, current$1, lane, eventTime); entangleTransitions(root, current$1, lane); } @@ -24008,7 +24073,11 @@ var setSuspenseHandler = null; // Shallow cloning props works as a workaround for now to bypass the bailout check. fiber.memoizedProps = assign({}, fiber.memoizedProps); - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (root !== null) { + scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + } } }; @@ -24025,7 +24094,11 @@ var setSuspenseHandler = null; // Shallow cloning props works as a workaround for now to bypass the bailout check. fiber.memoizedProps = assign({}, fiber.memoizedProps); - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (root !== null) { + scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + } } }; @@ -24042,7 +24115,11 @@ var setSuspenseHandler = null; // Shallow cloning props works as a workaround for now to bypass the bailout check. fiber.memoizedProps = assign({}, fiber.memoizedProps); - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (root !== null) { + scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + } } }; // Support DevTools props for function components, forwardRef, memo, host components, etc. @@ -24053,7 +24130,11 @@ var setSuspenseHandler = null; fiber.alternate.pendingProps = fiber.pendingProps; } - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (root !== null) { + scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + } }; overridePropsDeletePath = function(fiber, path) { @@ -24063,7 +24144,11 @@ var setSuspenseHandler = null; fiber.alternate.pendingProps = fiber.pendingProps; } - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (root !== null) { + scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + } }; overridePropsRenamePath = function(fiber, oldPath, newPath) { @@ -24073,11 +24158,19 @@ var setSuspenseHandler = null; fiber.alternate.pendingProps = fiber.pendingProps; } - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (root !== null) { + scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + } }; scheduleUpdate = function(fiber) { - scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + var root = enqueueConcurrentRenderForLane(fiber, SyncLane); + + if (root !== null) { + scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); + } }; setErrorHandler = function(newShouldErrorImpl) { diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js index 5e26abc86f4451..2bdbbc11af28f7 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js @@ -8,7 +8,7 @@ * @nolint * @providesModule ReactNativeRenderer-prod * @preventMunge - * @generated SignedSource<<9f59a543175acb00b00023e9ed7d8c38>> + * @generated SignedSource<<07cf699c0d1c149943b7a02432aa1550>> */ "use strict"; @@ -1017,7 +1017,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_225 = { +var injectedNamesToPlugins$jscomp$inline_229 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -1063,33 +1063,33 @@ var injectedNamesToPlugins$jscomp$inline_225 = { } } }, - isOrderingDirty$jscomp$inline_226 = !1, - pluginName$jscomp$inline_227; -for (pluginName$jscomp$inline_227 in injectedNamesToPlugins$jscomp$inline_225) + isOrderingDirty$jscomp$inline_230 = !1, + pluginName$jscomp$inline_231; +for (pluginName$jscomp$inline_231 in injectedNamesToPlugins$jscomp$inline_229) if ( - injectedNamesToPlugins$jscomp$inline_225.hasOwnProperty( - pluginName$jscomp$inline_227 + injectedNamesToPlugins$jscomp$inline_229.hasOwnProperty( + pluginName$jscomp$inline_231 ) ) { - var pluginModule$jscomp$inline_228 = - injectedNamesToPlugins$jscomp$inline_225[pluginName$jscomp$inline_227]; + var pluginModule$jscomp$inline_232 = + injectedNamesToPlugins$jscomp$inline_229[pluginName$jscomp$inline_231]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_227) || - namesToPlugins[pluginName$jscomp$inline_227] !== - pluginModule$jscomp$inline_228 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_231) || + namesToPlugins[pluginName$jscomp$inline_231] !== + pluginModule$jscomp$inline_232 ) { - if (namesToPlugins[pluginName$jscomp$inline_227]) + if (namesToPlugins[pluginName$jscomp$inline_231]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_227 + "`.") + (pluginName$jscomp$inline_231 + "`.") ); namesToPlugins[ - pluginName$jscomp$inline_227 - ] = pluginModule$jscomp$inline_228; - isOrderingDirty$jscomp$inline_226 = !0; + pluginName$jscomp$inline_231 + ] = pluginModule$jscomp$inline_232; + isOrderingDirty$jscomp$inline_230 = !0; } } -isOrderingDirty$jscomp$inline_226 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_230 && recomputePluginOrdering(); var instanceCache = new Map(), instanceProps = new Map(); function getInstanceFromTag(tag) { @@ -2300,8 +2300,34 @@ function readContext(context) { } else lastContextDependency = lastContextDependency.next = context; return value; } -var interleavedQueues = null, - hasForceUpdate = !1; +var concurrentQueues = null; +function pushConcurrentUpdateQueue(queue) { + null === concurrentQueues + ? (concurrentQueues = [queue]) + : concurrentQueues.push(queue); +} +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + var interleaved = queue.interleaved; + null === interleaved + ? ((update.next = update), pushConcurrentUpdateQueue(queue)) + : ((update.next = interleaved.next), (interleaved.next = update)); + queue.interleaved = update; + return markUpdateLaneFromFiberToRoot(fiber, lane); +} +function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + alternate = sourceFiber; + for (sourceFiber = sourceFiber.return; null !== sourceFiber; ) + (sourceFiber.childLanes |= lane), + (alternate = sourceFiber.alternate), + null !== alternate && (alternate.childLanes |= lane), + (alternate = sourceFiber), + (sourceFiber = sourceFiber.return); + return 3 === alternate.tag ? alternate.stateNode : null; +} +var hasForceUpdate = !1; function initializeUpdateQueue(fiber) { fiber.updateQueue = { baseState: fiber.memoizedState, @@ -2332,24 +2358,24 @@ function createUpdate(eventTime, lane) { next: null }; } -function enqueueUpdate(fiber, update) { +function enqueueUpdate(fiber, update, lane) { var updateQueue = fiber.updateQueue; - null !== updateQueue && - ((updateQueue = updateQueue.shared), - isInterleavedUpdate(fiber) - ? ((fiber = updateQueue.interleaved), - null === fiber - ? ((update.next = update), - null === interleavedQueues - ? (interleavedQueues = [updateQueue]) - : interleavedQueues.push(updateQueue)) - : ((update.next = fiber.next), (fiber.next = update)), - (updateQueue.interleaved = update)) - : ((fiber = updateQueue.pending), - null === fiber - ? (update.next = update) - : ((update.next = fiber.next), (fiber.next = update)), - (updateQueue.pending = update))); + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if (0 !== (executionContext & 2)) { + var pending = updateQueue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.pending = update; + return markUpdateLaneFromFiberToRoot(fiber, lane); + } + pending = updateQueue.interleaved; + null === pending + ? ((update.next = update), pushConcurrentUpdateQueue(updateQueue)) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.interleaved = update; + return markUpdateLaneFromFiberToRoot(fiber, lane); } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; @@ -2586,9 +2612,10 @@ var classComponentUpdater = { update = createUpdate(eventTime, lane); update.payload = payload; void 0 !== callback && null !== callback && (update.callback = callback); - enqueueUpdate(inst, update); - payload = scheduleUpdateOnFiber(inst, lane, eventTime); - null !== payload && entangleTransitions(payload, inst, lane); + payload = enqueueUpdate(inst, update, lane); + null !== payload && + (scheduleUpdateOnFiber(payload, inst, lane, eventTime), + entangleTransitions(payload, inst, lane)); }, enqueueReplaceState: function(inst, payload, callback) { inst = inst._reactInternals; @@ -2598,9 +2625,10 @@ var classComponentUpdater = { update.tag = 1; update.payload = payload; void 0 !== callback && null !== callback && (update.callback = callback); - enqueueUpdate(inst, update); - payload = scheduleUpdateOnFiber(inst, lane, eventTime); - null !== payload && entangleTransitions(payload, inst, lane); + payload = enqueueUpdate(inst, update, lane); + null !== payload && + (scheduleUpdateOnFiber(payload, inst, lane, eventTime), + entangleTransitions(payload, inst, lane)); }, enqueueForceUpdate: function(inst, callback) { inst = inst._reactInternals; @@ -2609,9 +2637,10 @@ var classComponentUpdater = { update = createUpdate(eventTime, lane); update.tag = 2; void 0 !== callback && null !== callback && (update.callback = callback); - enqueueUpdate(inst, update); - callback = scheduleUpdateOnFiber(inst, lane, eventTime); - null !== callback && entangleTransitions(callback, inst, lane); + callback = enqueueUpdate(inst, update, lane); + null !== callback && + (scheduleUpdateOnFiber(callback, inst, lane, eventTime), + entangleTransitions(callback, inst, lane)); } }; function checkShouldComponentUpdate( @@ -3716,11 +3745,11 @@ function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { function updateStoreInstance(fiber, inst, nextSnapshot, getSnapshot) { inst.value = nextSnapshot; inst.getSnapshot = getSnapshot; - checkIfSnapshotChanged(inst) && scheduleUpdateOnFiber(fiber, 1, -1); + checkIfSnapshotChanged(inst) && forceStoreRerender(fiber); } function subscribeToStore(fiber, inst, subscribe) { return subscribe(function() { - checkIfSnapshotChanged(inst) && scheduleUpdateOnFiber(fiber, 1, -1); + checkIfSnapshotChanged(inst) && forceStoreRerender(fiber); }); } function checkIfSnapshotChanged(inst) { @@ -3733,6 +3762,10 @@ function checkIfSnapshotChanged(inst) { return !0; } } +function forceStoreRerender(fiber) { + var root = markUpdateLaneFromFiberToRoot(fiber, 1); + null !== root && scheduleUpdateOnFiber(root, fiber, 1, -1); +} function mountState(initialState) { var hook = mountWorkInProgressHook(); "function" === typeof initialState && (initialState = initialState()); @@ -3903,12 +3936,15 @@ function dispatchReducerAction(fiber, queue, action) { eagerState: null, next: null }; - isRenderPhaseUpdate(fiber) - ? enqueueRenderPhaseUpdate(queue, action) - : (enqueueUpdate$1(fiber, queue, action), - (action = requestEventTime()), - (fiber = scheduleUpdateOnFiber(fiber, lane, action)), - null !== fiber && entangleTransitionUpdate(fiber, queue, lane)); + if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, action); + else if ( + ((action = enqueueConcurrentHookUpdate(fiber, queue, action, lane)), + null !== action) + ) { + var eventTime = requestEventTime(); + scheduleUpdateOnFiber(action, fiber, lane, eventTime); + entangleTransitionUpdate(action, queue, lane); + } } function dispatchSetState(fiber, queue, action) { var lane = requestUpdateLane(fiber), @@ -3921,7 +3957,6 @@ function dispatchSetState(fiber, queue, action) { }; if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, update); else { - enqueueUpdate$1(fiber, queue, update); var alternate = fiber.alternate; if ( 0 === fiber.lanes && @@ -3933,13 +3968,22 @@ function dispatchSetState(fiber, queue, action) { eagerState = alternate(currentState, action); update.hasEagerState = !0; update.eagerState = eagerState; - if (objectIs(eagerState, currentState)) return; + if (objectIs(eagerState, currentState)) { + var interleaved = queue.interleaved; + null === interleaved + ? ((update.next = update), pushConcurrentUpdateQueue(queue)) + : ((update.next = interleaved.next), (interleaved.next = update)); + queue.interleaved = update; + return; + } } catch (error) { } finally { } - action = requestEventTime(); - fiber = scheduleUpdateOnFiber(fiber, lane, action); - null !== fiber && entangleTransitionUpdate(fiber, queue, lane); + action = enqueueConcurrentHookUpdate(fiber, queue, update, lane); + null !== action && + ((update = requestEventTime()), + scheduleUpdateOnFiber(action, fiber, lane, update), + entangleTransitionUpdate(action, queue, lane)); } } function isRenderPhaseUpdate(fiber) { @@ -3957,22 +4001,6 @@ function enqueueRenderPhaseUpdate(queue, update) { : ((update.next = pending.next), (pending.next = update)); queue.pending = update; } -function enqueueUpdate$1(fiber, queue, update) { - isInterleavedUpdate(fiber) - ? ((fiber = queue.interleaved), - null === fiber - ? ((update.next = update), - null === interleavedQueues - ? (interleavedQueues = [queue]) - : interleavedQueues.push(queue)) - : ((update.next = fiber.next), (fiber.next = update)), - (queue.interleaved = update)) - : ((fiber = queue.pending), - null === fiber - ? (update.next = update) - : ((update.next = fiber.next), (fiber.next = update)), - (queue.pending = update)); -} function entangleTransitionUpdate(root, queue, lane) { if (0 !== (lane & 4194240)) { var queueLanes = queue.lanes; @@ -4168,11 +4196,20 @@ var ContextOnlyDispatcher = { useId: updateId, unstable_isNewReconciler: !1 }; -function createCapturedValue(value, source) { +function createCapturedValueAtFiber(value, source) { return { value: value, source: source, - stack: getStackByFiberInDevAndProd(source) + stack: getStackByFiberInDevAndProd(source), + digest: null + }; +} +function createCapturedValue(value, digest, stack) { + return { + value: value, + source: null, + stack: null != stack ? stack : null, + digest: null != digest ? digest : null }; } if ( @@ -4899,13 +4936,16 @@ function updateDehydratedSuspenseComponent( if (workInProgress.flags & 256) return ( (workInProgress.flags &= -257), + (suspenseState = createCapturedValue( + Error( + "There was an error while hydrating this Suspense boundary. Switched to client rendering." + ) + )), retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, - Error( - "There was an error while hydrating this Suspense boundary. Switched to client rendering." - ) + suspenseState ) ); if (null !== workInProgress.memoizedState) @@ -4950,16 +4990,19 @@ function updateDehydratedSuspenseComponent( ); if (shim()) return ( - (suspenseState = shim().errorMessage), + (suspenseState = shim().digest), + (suspenseState = createCapturedValue( + Error( + "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." + ), + suspenseState, + void 0 + )), retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, suspenseState - ? Error(suspenseState) - : Error( - "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." - ) ) ); didSuspend = 0 !== (renderLanes & current.childLanes); @@ -5002,23 +5045,27 @@ function updateDehydratedSuspenseComponent( default: didSuspend = 0; } - nextProps = + didSuspend = 0 !== (didSuspend & (nextProps.suspendedLanes | renderLanes)) ? 0 : didSuspend; - 0 !== nextProps && - nextProps !== suspenseState.retryLane && - ((suspenseState.retryLane = nextProps), - scheduleUpdateOnFiber(current, nextProps, -1)); + 0 !== didSuspend && + didSuspend !== suspenseState.retryLane && + ((suspenseState.retryLane = didSuspend), + markUpdateLaneFromFiberToRoot(current, didSuspend), + scheduleUpdateOnFiber(nextProps, current, didSuspend, -1)); } renderDidSuspendDelayIfPossible(); + suspenseState = createCapturedValue( + Error( + "This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition." + ) + ); return retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, - Error( - "This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition." - ) + suspenseState ); } if (shim()) @@ -5297,14 +5344,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$60 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$60 = lastTailNode), + for (var lastTailNode$62 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$62 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$60 + null === lastTailNode$62 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$60.sibling = null); + : (lastTailNode$62.sibling = null); } } function bubbleProperties(completedWork) { @@ -5314,19 +5361,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$61 = completedWork.child; null !== child$61; ) - (newChildLanes |= child$61.lanes | child$61.childLanes), - (subtreeFlags |= child$61.subtreeFlags & 14680064), - (subtreeFlags |= child$61.flags & 14680064), - (child$61.return = completedWork), - (child$61 = child$61.sibling); + for (var child$63 = completedWork.child; null !== child$63; ) + (newChildLanes |= child$63.lanes | child$63.childLanes), + (subtreeFlags |= child$63.subtreeFlags & 14680064), + (subtreeFlags |= child$63.flags & 14680064), + (child$63.return = completedWork), + (child$63 = child$63.sibling); else - for (child$61 = completedWork.child; null !== child$61; ) - (newChildLanes |= child$61.lanes | child$61.childLanes), - (subtreeFlags |= child$61.subtreeFlags), - (subtreeFlags |= child$61.flags), - (child$61.return = completedWork), - (child$61 = child$61.sibling); + for (child$63 = completedWork.child; null !== child$63; ) + (newChildLanes |= child$63.lanes | child$63.childLanes), + (subtreeFlags |= child$63.subtreeFlags), + (subtreeFlags |= child$63.flags), + (child$63.return = completedWork), + (child$63 = child$63.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -5824,8 +5871,8 @@ function commitHookEffectListMount(flags, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & flags) === flags) { - var create$73 = effect.create; - effect.destroy = create$73(); + var create$75 = effect.create; + effect.destroy = create$75(); } effect = effect.next; } while (effect !== finishedWork); @@ -6177,8 +6224,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$83) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$83); + } catch (error$85) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$85); } } break; @@ -6196,16 +6243,16 @@ function commitMutationEffectsOnFiber(finishedWork, root) { null !== current && safelyDetachRef(current, current.return); if (flags & 4) { - var instance$85 = finishedWork.stateNode; - if (null != instance$85) { + var instance$87 = finishedWork.stateNode; + if (null != instance$87) { var newProps = finishedWork.memoizedProps, oldProps = null !== current ? current.memoizedProps : newProps, updatePayload = finishedWork.updateQueue; finishedWork.updateQueue = null; if (null !== updatePayload) try { - var viewConfig = instance$85.viewConfig; - instanceProps.set(instance$85._nativeTag, newProps); + var viewConfig = instance$87.viewConfig; + instanceProps.set(instance$87._nativeTag, newProps); var updatePayload$jscomp$0 = diffProperties( null, oldProps, @@ -6214,15 +6261,15 @@ function commitMutationEffectsOnFiber(finishedWork, root) { ); null != updatePayload$jscomp$0 && ReactNativePrivateInterface.UIManager.updateView( - instance$85._nativeTag, + instance$87._nativeTag, viewConfig.uiViewClassName, updatePayload$jscomp$0 ); - } catch (error$86) { + } catch (error$88) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$86 + error$88 ); } } @@ -6244,8 +6291,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { "RCTRawText", { text: updatePayload$jscomp$0 } ); - } catch (error$87) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$87); + } catch (error$89) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$89); } } break; @@ -6262,10 +6309,12 @@ function commitMutationEffectsOnFiber(finishedWork, root) { commitReconciliationEffects(finishedWork); viewConfig = finishedWork.child; viewConfig.flags & 8192 && - null !== viewConfig.memoizedState && - (null === viewConfig.alternate || - null === viewConfig.alternate.memoizedState) && - (globalMostRecentFallbackTime = now()); + ((updatePayload$jscomp$0 = null !== viewConfig.memoizedState), + (viewConfig.stateNode.isHidden = updatePayload$jscomp$0), + !updatePayload$jscomp$0 || + (null !== viewConfig.alternate && + null !== viewConfig.alternate.memoizedState) || + (globalMostRecentFallbackTime = now())); flags & 4 && attachSuspenseRetryListeners(finishedWork); break; case 22: @@ -6274,6 +6323,7 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (flags & 8192) a: for ( viewConfig = null !== finishedWork.memoizedState, + finishedWork.stateNode.isHidden = viewConfig, updatePayload$jscomp$0 = null, current = finishedWork; ; @@ -6283,8 +6333,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === updatePayload$jscomp$0) { updatePayload$jscomp$0 = current; try { - if (((instance$85 = current.stateNode), viewConfig)) - (newProps = instance$85.viewConfig), + if (((instance$87 = current.stateNode), viewConfig)) + (newProps = instance$87.viewConfig), (oldProps = diffProperties( null, emptyObject, @@ -6292,7 +6342,7 @@ function commitMutationEffectsOnFiber(finishedWork, root) { newProps.validAttributes )), ReactNativePrivateInterface.UIManager.updateView( - instance$85._nativeTag, + instance$87._nativeTag, newProps.uiViewClassName, oldProps ); @@ -6327,11 +6377,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === updatePayload$jscomp$0) try { throw Error("Not yet implemented."); - } catch (error$78) { + } catch (error$80) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$78 + error$80 ); } } else if ( @@ -6395,12 +6445,12 @@ function commitReconciliationEffects(finishedWork) { break; case 3: case 4: - var parent$79 = JSCompiler_inline_result.stateNode.containerInfo, - before$80 = getHostSibling(finishedWork); + var parent$81 = JSCompiler_inline_result.stateNode.containerInfo, + before$82 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$80, - parent$79 + before$82, + parent$81 ); break; default: @@ -6457,8 +6507,8 @@ function commitLayoutEffects(finishedWork) { commitUpdateQueue(firstChild, updateQueue, instance); break; case 3: - var updateQueue$74 = firstChild.updateQueue; - if (null !== updateQueue$74) { + var updateQueue$76 = firstChild.updateQueue; + if (null !== updateQueue$76) { current = null; if (null !== firstChild.child) switch (firstChild.child.tag) { @@ -6468,7 +6518,7 @@ function commitLayoutEffects(finishedWork) { case 1: current = firstChild.child.stateNode; } - commitUpdateQueue(firstChild, updateQueue$74, current); + commitUpdateQueue(firstChild, updateQueue$76, current); } break; case 5: @@ -6578,15 +6628,13 @@ function requestUpdateLane(fiber) { fiber = currentUpdatePriority; return 0 !== fiber ? fiber : 16; } -function scheduleUpdateOnFiber(fiber, lane, eventTime) { +function scheduleUpdateOnFiber(root, fiber, lane, eventTime) { if (50 < nestedUpdateCount) throw ((nestedUpdateCount = 0), (rootWithNestedUpdates = null), Error( "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." )); - var root = markUpdateLaneFromFiberToRoot(fiber, lane); - if (null === root) return null; markRootUpdated(root, lane, eventTime); if (0 === (executionContext & 2) || root !== workInProgressRoot) root === workInProgressRoot && @@ -6600,27 +6648,6 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { 0 === (fiber.mode & 1) && ((workInProgressRootRenderTargetTime = now() + 500), includesLegacySyncCallbacks && flushSyncCallbacks()); - return root; -} -function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - sourceFiber.lanes |= lane; - var alternate = sourceFiber.alternate; - null !== alternate && (alternate.lanes |= lane); - alternate = sourceFiber; - for (sourceFiber = sourceFiber.return; null !== sourceFiber; ) - (sourceFiber.childLanes |= lane), - (alternate = sourceFiber.alternate), - null !== alternate && (alternate.childLanes |= lane), - (alternate = sourceFiber), - (sourceFiber = sourceFiber.return); - return 3 === alternate.tag ? alternate.stateNode : null; -} -function isInterleavedUpdate(fiber) { - return ( - (null !== workInProgressRoot || null !== interleavedQueues) && - 0 !== (fiber.mode & 1) && - 0 === (executionContext & 2) - ); } function ensureRootIsScheduled(root, currentTime) { for ( @@ -7025,10 +7052,10 @@ function prepareFreshStack(root, lanes) { workInProgressRootFatalError = null; workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null; - if (null !== interleavedQueues) { - for (lanes = 0; lanes < interleavedQueues.length; lanes++) + if (null !== concurrentQueues) { + for (lanes = 0; lanes < concurrentQueues.length; lanes++) if ( - ((timeoutHandle = interleavedQueues[lanes]), + ((timeoutHandle = concurrentQueues[lanes]), (interruptedWork = timeoutHandle.interleaved), null !== interruptedWork) ) { @@ -7042,7 +7069,7 @@ function prepareFreshStack(root, lanes) { } timeoutHandle.pending = interruptedWork; } - interleavedQueues = null; + concurrentQueues = null; } return root; } @@ -7138,7 +7165,7 @@ function handleError(root$jscomp$0, thrownValue) { else { var update = createUpdate(-1, 1); update.tag = 2; - enqueueUpdate(sourceFiber, update); + enqueueUpdate(sourceFiber, update, 1); } sourceFiber.lanes |= 1; } @@ -7165,13 +7192,12 @@ function handleError(root$jscomp$0, thrownValue) { ); } } - root = value; + root = value = createCapturedValueAtFiber(value, sourceFiber); 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2); null === workInProgressRootConcurrentErrors ? (workInProgressRootConcurrentErrors = [root]) : workInProgressRootConcurrentErrors.push(root); - value = createCapturedValue(value, sourceFiber); root = returnFiber; do { switch (root.tag) { @@ -7403,7 +7429,11 @@ function commitRootImpl( transitions < recoverableErrors.length; transitions++ ) - renderPriorityLevel(recoverableErrors[transitions]); + (lanes = recoverableErrors[transitions]), + renderPriorityLevel(lanes.value, { + componentStack: lanes.stack, + digest: lanes.digest + }); if (hasUncaughtError) throw ((hasUncaughtError = !1), (root = firstUncaughtError), @@ -7567,11 +7597,10 @@ function flushPassiveEffects() { return !1; } function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - sourceFiber = createCapturedValue(error, sourceFiber); + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 1); - enqueueUpdate(rootFiber, sourceFiber); + rootFiber = enqueueUpdate(rootFiber, sourceFiber, 1); sourceFiber = requestEventTime(); - rootFiber = markUpdateLaneFromFiberToRoot(rootFiber, 1); null !== rootFiber && (markRootUpdated(rootFiber, 1, sourceFiber), ensureRootIsScheduled(rootFiber, sourceFiber)); @@ -7601,18 +7630,18 @@ function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { (null === legacyErrorBoundariesThatAlreadyFailed || !legacyErrorBoundariesThatAlreadyFailed.has(instance))) ) { - sourceFiber = createCapturedValue(error, sourceFiber); + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); sourceFiber = createClassErrorUpdate( nearestMountedAncestor, sourceFiber, 1 ); - enqueueUpdate(nearestMountedAncestor, sourceFiber); - sourceFiber = requestEventTime(); - nearestMountedAncestor = markUpdateLaneFromFiberToRoot( + nearestMountedAncestor = enqueueUpdate( nearestMountedAncestor, + sourceFiber, 1 ); + sourceFiber = requestEventTime(); null !== nearestMountedAncestor && (markRootUpdated(nearestMountedAncestor, 1, sourceFiber), ensureRootIsScheduled(nearestMountedAncestor, sourceFiber)); @@ -8267,7 +8296,7 @@ function createFiberFromOffscreen(pendingProps, mode, lanes, key) { pendingProps = createFiber(22, pendingProps, key, mode); pendingProps.elementType = REACT_OFFSCREEN_TYPE; pendingProps.lanes = lanes; - pendingProps.stateNode = {}; + pendingProps.stateNode = { isHidden: !1 }; return pendingProps; } function createFiberFromText(content, mode, lanes) { @@ -8389,9 +8418,10 @@ function updateContainer(element, container, parentComponent, callback) { container.payload = { element: element }; callback = void 0 === callback ? null : callback; null !== callback && (container.callback = callback); - enqueueUpdate(current, container); - element = scheduleUpdateOnFiber(current, lane, eventTime); - null !== element && entangleTransitions(element, current, lane); + element = enqueueUpdate(current, container, lane); + null !== element && + (scheduleUpdateOnFiber(element, current, lane, eventTime), + entangleTransitions(element, current, lane)); return lane; } function emptyFindFiberByHostInstance() { @@ -8433,10 +8463,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_967 = { + devToolsConfig$jscomp$inline_979 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.2.0-next-d300cebde-20220601", + version: "18.2.0-next-9e3b772b8-20220608", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8451,11 +8481,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1239 = { - bundleType: devToolsConfig$jscomp$inline_967.bundleType, - version: devToolsConfig$jscomp$inline_967.version, - rendererPackageName: devToolsConfig$jscomp$inline_967.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_967.rendererConfig, +var internals$jscomp$inline_1247 = { + bundleType: devToolsConfig$jscomp$inline_979.bundleType, + version: devToolsConfig$jscomp$inline_979.version, + rendererPackageName: devToolsConfig$jscomp$inline_979.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_979.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8471,26 +8501,26 @@ var internals$jscomp$inline_1239 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_967.findFiberByHostInstance || + devToolsConfig$jscomp$inline_979.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.2.0-next-d300cebde-20220601" + reconcilerVersion: "18.2.0-next-9e3b772b8-20220608" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1240 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1248 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1240.isDisabled && - hook$jscomp$inline_1240.supportsFiber + !hook$jscomp$inline_1248.isDisabled && + hook$jscomp$inline_1248.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1240.inject( - internals$jscomp$inline_1239 + (rendererID = hook$jscomp$inline_1248.inject( + internals$jscomp$inline_1247 )), - (injectedHook = hook$jscomp$inline_1240); + (injectedHook = hook$jscomp$inline_1248); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js index 3a9a2679c42a49..04ceb304db503c 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js @@ -8,7 +8,7 @@ * @nolint * @providesModule ReactNativeRenderer-profiling * @preventMunge - * @generated SignedSource<<2bf865cebf1e47b3fc0284498b4571db>> + * @generated SignedSource<<380a53922e2dcceb4a32c98acc12f578>> */ @@ -1028,7 +1028,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_236 = { +var injectedNamesToPlugins$jscomp$inline_240 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -1074,33 +1074,33 @@ var injectedNamesToPlugins$jscomp$inline_236 = { } } }, - isOrderingDirty$jscomp$inline_237 = !1, - pluginName$jscomp$inline_238; -for (pluginName$jscomp$inline_238 in injectedNamesToPlugins$jscomp$inline_236) + isOrderingDirty$jscomp$inline_241 = !1, + pluginName$jscomp$inline_242; +for (pluginName$jscomp$inline_242 in injectedNamesToPlugins$jscomp$inline_240) if ( - injectedNamesToPlugins$jscomp$inline_236.hasOwnProperty( - pluginName$jscomp$inline_238 + injectedNamesToPlugins$jscomp$inline_240.hasOwnProperty( + pluginName$jscomp$inline_242 ) ) { - var pluginModule$jscomp$inline_239 = - injectedNamesToPlugins$jscomp$inline_236[pluginName$jscomp$inline_238]; + var pluginModule$jscomp$inline_243 = + injectedNamesToPlugins$jscomp$inline_240[pluginName$jscomp$inline_242]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_238) || - namesToPlugins[pluginName$jscomp$inline_238] !== - pluginModule$jscomp$inline_239 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_242) || + namesToPlugins[pluginName$jscomp$inline_242] !== + pluginModule$jscomp$inline_243 ) { - if (namesToPlugins[pluginName$jscomp$inline_238]) + if (namesToPlugins[pluginName$jscomp$inline_242]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_238 + "`.") + (pluginName$jscomp$inline_242 + "`.") ); namesToPlugins[ - pluginName$jscomp$inline_238 - ] = pluginModule$jscomp$inline_239; - isOrderingDirty$jscomp$inline_237 = !0; + pluginName$jscomp$inline_242 + ] = pluginModule$jscomp$inline_243; + isOrderingDirty$jscomp$inline_241 = !0; } } -isOrderingDirty$jscomp$inline_237 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_241 && recomputePluginOrdering(); var instanceCache = new Map(), instanceProps = new Map(); function getInstanceFromTag(tag) { @@ -2359,8 +2359,34 @@ function readContext(context) { } else lastContextDependency = lastContextDependency.next = context; return value; } -var interleavedQueues = null, - hasForceUpdate = !1; +var concurrentQueues = null; +function pushConcurrentUpdateQueue(queue) { + null === concurrentQueues + ? (concurrentQueues = [queue]) + : concurrentQueues.push(queue); +} +function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { + var interleaved = queue.interleaved; + null === interleaved + ? ((update.next = update), pushConcurrentUpdateQueue(queue)) + : ((update.next = interleaved.next), (interleaved.next = update)); + queue.interleaved = update; + return markUpdateLaneFromFiberToRoot(fiber, lane); +} +function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + sourceFiber.lanes |= lane; + var alternate = sourceFiber.alternate; + null !== alternate && (alternate.lanes |= lane); + alternate = sourceFiber; + for (sourceFiber = sourceFiber.return; null !== sourceFiber; ) + (sourceFiber.childLanes |= lane), + (alternate = sourceFiber.alternate), + null !== alternate && (alternate.childLanes |= lane), + (alternate = sourceFiber), + (sourceFiber = sourceFiber.return); + return 3 === alternate.tag ? alternate.stateNode : null; +} +var hasForceUpdate = !1; function initializeUpdateQueue(fiber) { fiber.updateQueue = { baseState: fiber.memoizedState, @@ -2391,24 +2417,24 @@ function createUpdate(eventTime, lane) { next: null }; } -function enqueueUpdate(fiber, update) { +function enqueueUpdate(fiber, update, lane) { var updateQueue = fiber.updateQueue; - null !== updateQueue && - ((updateQueue = updateQueue.shared), - isInterleavedUpdate(fiber) - ? ((fiber = updateQueue.interleaved), - null === fiber - ? ((update.next = update), - null === interleavedQueues - ? (interleavedQueues = [updateQueue]) - : interleavedQueues.push(updateQueue)) - : ((update.next = fiber.next), (fiber.next = update)), - (updateQueue.interleaved = update)) - : ((fiber = updateQueue.pending), - null === fiber - ? (update.next = update) - : ((update.next = fiber.next), (fiber.next = update)), - (updateQueue.pending = update))); + if (null === updateQueue) return null; + updateQueue = updateQueue.shared; + if (0 !== (executionContext & 2)) { + var pending = updateQueue.pending; + null === pending + ? (update.next = update) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.pending = update; + return markUpdateLaneFromFiberToRoot(fiber, lane); + } + pending = updateQueue.interleaved; + null === pending + ? ((update.next = update), pushConcurrentUpdateQueue(updateQueue)) + : ((update.next = pending.next), (pending.next = update)); + updateQueue.interleaved = update; + return markUpdateLaneFromFiberToRoot(fiber, lane); } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; @@ -2645,9 +2671,10 @@ var classComponentUpdater = { update = createUpdate(eventTime, lane); update.payload = payload; void 0 !== callback && null !== callback && (update.callback = callback); - enqueueUpdate(inst, update); - payload = scheduleUpdateOnFiber(inst, lane, eventTime); - null !== payload && entangleTransitions(payload, inst, lane); + payload = enqueueUpdate(inst, update, lane); + null !== payload && + (scheduleUpdateOnFiber(payload, inst, lane, eventTime), + entangleTransitions(payload, inst, lane)); }, enqueueReplaceState: function(inst, payload, callback) { inst = inst._reactInternals; @@ -2657,9 +2684,10 @@ var classComponentUpdater = { update.tag = 1; update.payload = payload; void 0 !== callback && null !== callback && (update.callback = callback); - enqueueUpdate(inst, update); - payload = scheduleUpdateOnFiber(inst, lane, eventTime); - null !== payload && entangleTransitions(payload, inst, lane); + payload = enqueueUpdate(inst, update, lane); + null !== payload && + (scheduleUpdateOnFiber(payload, inst, lane, eventTime), + entangleTransitions(payload, inst, lane)); }, enqueueForceUpdate: function(inst, callback) { inst = inst._reactInternals; @@ -2668,9 +2696,10 @@ var classComponentUpdater = { update = createUpdate(eventTime, lane); update.tag = 2; void 0 !== callback && null !== callback && (update.callback = callback); - enqueueUpdate(inst, update); - callback = scheduleUpdateOnFiber(inst, lane, eventTime); - null !== callback && entangleTransitions(callback, inst, lane); + callback = enqueueUpdate(inst, update, lane); + null !== callback && + (scheduleUpdateOnFiber(callback, inst, lane, eventTime), + entangleTransitions(callback, inst, lane)); } }; function checkShouldComponentUpdate( @@ -3775,11 +3804,11 @@ function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { function updateStoreInstance(fiber, inst, nextSnapshot, getSnapshot) { inst.value = nextSnapshot; inst.getSnapshot = getSnapshot; - checkIfSnapshotChanged(inst) && scheduleUpdateOnFiber(fiber, 1, -1); + checkIfSnapshotChanged(inst) && forceStoreRerender(fiber); } function subscribeToStore(fiber, inst, subscribe) { return subscribe(function() { - checkIfSnapshotChanged(inst) && scheduleUpdateOnFiber(fiber, 1, -1); + checkIfSnapshotChanged(inst) && forceStoreRerender(fiber); }); } function checkIfSnapshotChanged(inst) { @@ -3792,6 +3821,10 @@ function checkIfSnapshotChanged(inst) { return !0; } } +function forceStoreRerender(fiber) { + var root = markUpdateLaneFromFiberToRoot(fiber, 1); + null !== root && scheduleUpdateOnFiber(root, fiber, 1, -1); +} function mountState(initialState) { var hook = mountWorkInProgressHook(); "function" === typeof initialState && (initialState = initialState()); @@ -3962,12 +3995,15 @@ function dispatchReducerAction(fiber, queue, action) { eagerState: null, next: null }; - isRenderPhaseUpdate(fiber) - ? enqueueRenderPhaseUpdate(queue, action) - : (enqueueUpdate$1(fiber, queue, action), - (action = requestEventTime()), - (fiber = scheduleUpdateOnFiber(fiber, lane, action)), - null !== fiber && entangleTransitionUpdate(fiber, queue, lane)); + if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, action); + else if ( + ((action = enqueueConcurrentHookUpdate(fiber, queue, action, lane)), + null !== action) + ) { + var eventTime = requestEventTime(); + scheduleUpdateOnFiber(action, fiber, lane, eventTime); + entangleTransitionUpdate(action, queue, lane); + } } function dispatchSetState(fiber, queue, action) { var lane = requestUpdateLane(fiber), @@ -3980,7 +4016,6 @@ function dispatchSetState(fiber, queue, action) { }; if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, update); else { - enqueueUpdate$1(fiber, queue, update); var alternate = fiber.alternate; if ( 0 === fiber.lanes && @@ -3992,13 +4027,22 @@ function dispatchSetState(fiber, queue, action) { eagerState = alternate(currentState, action); update.hasEagerState = !0; update.eagerState = eagerState; - if (objectIs(eagerState, currentState)) return; + if (objectIs(eagerState, currentState)) { + var interleaved = queue.interleaved; + null === interleaved + ? ((update.next = update), pushConcurrentUpdateQueue(queue)) + : ((update.next = interleaved.next), (interleaved.next = update)); + queue.interleaved = update; + return; + } } catch (error) { } finally { } - action = requestEventTime(); - fiber = scheduleUpdateOnFiber(fiber, lane, action); - null !== fiber && entangleTransitionUpdate(fiber, queue, lane); + action = enqueueConcurrentHookUpdate(fiber, queue, update, lane); + null !== action && + ((update = requestEventTime()), + scheduleUpdateOnFiber(action, fiber, lane, update), + entangleTransitionUpdate(action, queue, lane)); } } function isRenderPhaseUpdate(fiber) { @@ -4016,22 +4060,6 @@ function enqueueRenderPhaseUpdate(queue, update) { : ((update.next = pending.next), (pending.next = update)); queue.pending = update; } -function enqueueUpdate$1(fiber, queue, update) { - isInterleavedUpdate(fiber) - ? ((fiber = queue.interleaved), - null === fiber - ? ((update.next = update), - null === interleavedQueues - ? (interleavedQueues = [queue]) - : interleavedQueues.push(queue)) - : ((update.next = fiber.next), (fiber.next = update)), - (queue.interleaved = update)) - : ((fiber = queue.pending), - null === fiber - ? (update.next = update) - : ((update.next = fiber.next), (fiber.next = update)), - (queue.pending = update)); -} function entangleTransitionUpdate(root, queue, lane) { if (0 !== (lane & 4194240)) { var queueLanes = queue.lanes; @@ -4285,11 +4313,20 @@ function transferActualDuration(fiber) { for (var child = fiber.child; child; ) (fiber.actualDuration += child.actualDuration), (child = child.sibling); } -function createCapturedValue(value, source) { +function createCapturedValueAtFiber(value, source) { return { value: value, source: source, - stack: getStackByFiberInDevAndProd(source) + stack: getStackByFiberInDevAndProd(source), + digest: null + }; +} +function createCapturedValue(value, digest, stack) { + return { + value: value, + source: null, + stack: null != stack ? stack : null, + digest: null != digest ? digest : null }; } if ( @@ -5031,13 +5068,16 @@ function updateDehydratedSuspenseComponent( if (workInProgress.flags & 256) return ( (workInProgress.flags &= -257), + (suspenseState = createCapturedValue( + Error( + "There was an error while hydrating this Suspense boundary. Switched to client rendering." + ) + )), retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, - Error( - "There was an error while hydrating this Suspense boundary. Switched to client rendering." - ) + suspenseState ) ); if (null !== workInProgress.memoizedState) @@ -5082,16 +5122,19 @@ function updateDehydratedSuspenseComponent( ); if (shim()) return ( - (suspenseState = shim().errorMessage), + (suspenseState = shim().digest), + (suspenseState = createCapturedValue( + Error( + "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." + ), + suspenseState, + void 0 + )), retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, suspenseState - ? Error(suspenseState) - : Error( - "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." - ) ) ); didSuspend = 0 !== (renderLanes & current.childLanes); @@ -5134,23 +5177,27 @@ function updateDehydratedSuspenseComponent( default: didSuspend = 0; } - nextProps = + didSuspend = 0 !== (didSuspend & (nextProps.suspendedLanes | renderLanes)) ? 0 : didSuspend; - 0 !== nextProps && - nextProps !== suspenseState.retryLane && - ((suspenseState.retryLane = nextProps), - scheduleUpdateOnFiber(current, nextProps, -1)); + 0 !== didSuspend && + didSuspend !== suspenseState.retryLane && + ((suspenseState.retryLane = didSuspend), + markUpdateLaneFromFiberToRoot(current, didSuspend), + scheduleUpdateOnFiber(nextProps, current, didSuspend, -1)); } renderDidSuspendDelayIfPossible(); + suspenseState = createCapturedValue( + Error( + "This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition." + ) + ); return retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, - Error( - "This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition." - ) + suspenseState ); } if (shim()) @@ -5437,14 +5484,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$63 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$63 = lastTailNode), + for (var lastTailNode$65 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$65 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$63 + null === lastTailNode$65 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$63.sibling = null); + : (lastTailNode$65.sibling = null); } } function bubbleProperties(completedWork) { @@ -5456,53 +5503,53 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$65 = completedWork.selfBaseDuration, - child$66 = completedWork.child; - null !== child$66; + var treeBaseDuration$67 = completedWork.selfBaseDuration, + child$68 = completedWork.child; + null !== child$68; ) - (newChildLanes |= child$66.lanes | child$66.childLanes), - (subtreeFlags |= child$66.subtreeFlags & 14680064), - (subtreeFlags |= child$66.flags & 14680064), - (treeBaseDuration$65 += child$66.treeBaseDuration), - (child$66 = child$66.sibling); - completedWork.treeBaseDuration = treeBaseDuration$65; + (newChildLanes |= child$68.lanes | child$68.childLanes), + (subtreeFlags |= child$68.subtreeFlags & 14680064), + (subtreeFlags |= child$68.flags & 14680064), + (treeBaseDuration$67 += child$68.treeBaseDuration), + (child$68 = child$68.sibling); + completedWork.treeBaseDuration = treeBaseDuration$67; } else for ( - treeBaseDuration$65 = completedWork.child; - null !== treeBaseDuration$65; + treeBaseDuration$67 = completedWork.child; + null !== treeBaseDuration$67; ) (newChildLanes |= - treeBaseDuration$65.lanes | treeBaseDuration$65.childLanes), - (subtreeFlags |= treeBaseDuration$65.subtreeFlags & 14680064), - (subtreeFlags |= treeBaseDuration$65.flags & 14680064), - (treeBaseDuration$65.return = completedWork), - (treeBaseDuration$65 = treeBaseDuration$65.sibling); + treeBaseDuration$67.lanes | treeBaseDuration$67.childLanes), + (subtreeFlags |= treeBaseDuration$67.subtreeFlags & 14680064), + (subtreeFlags |= treeBaseDuration$67.flags & 14680064), + (treeBaseDuration$67.return = completedWork), + (treeBaseDuration$67 = treeBaseDuration$67.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$65 = completedWork.actualDuration; - child$66 = completedWork.selfBaseDuration; + treeBaseDuration$67 = completedWork.actualDuration; + child$68 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$65 += child.actualDuration), - (child$66 += child.treeBaseDuration), + (treeBaseDuration$67 += child.actualDuration), + (child$68 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$65; - completedWork.treeBaseDuration = child$66; + completedWork.actualDuration = treeBaseDuration$67; + completedWork.treeBaseDuration = child$68; } else for ( - treeBaseDuration$65 = completedWork.child; - null !== treeBaseDuration$65; + treeBaseDuration$67 = completedWork.child; + null !== treeBaseDuration$67; ) (newChildLanes |= - treeBaseDuration$65.lanes | treeBaseDuration$65.childLanes), - (subtreeFlags |= treeBaseDuration$65.subtreeFlags), - (subtreeFlags |= treeBaseDuration$65.flags), - (treeBaseDuration$65.return = completedWork), - (treeBaseDuration$65 = treeBaseDuration$65.sibling); + treeBaseDuration$67.lanes | treeBaseDuration$67.childLanes), + (subtreeFlags |= treeBaseDuration$67.subtreeFlags), + (subtreeFlags |= treeBaseDuration$67.flags), + (treeBaseDuration$67.return = completedWork), + (treeBaseDuration$67 = treeBaseDuration$67.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -6033,8 +6080,8 @@ function commitHookEffectListMount(flags, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & flags) === flags) { - var create$81 = effect.create; - effect.destroy = create$81(); + var create$83 = effect.create; + effect.destroy = create$83(); } effect = effect.next; } while (effect !== finishedWork); @@ -6419,22 +6466,22 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { startLayoutEffectTimer(), commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$93) { + } catch (error$95) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$93 + error$95 ); } recordLayoutEffectDuration(finishedWork); } else try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$94) { + } catch (error$96) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$94 + error$96 ); } } @@ -6453,16 +6500,16 @@ function commitMutationEffectsOnFiber(finishedWork, root) { null !== current && safelyDetachRef(current, current.return); if (flags & 4) { - var instance$96 = finishedWork.stateNode; - if (null != instance$96) { + var instance$98 = finishedWork.stateNode; + if (null != instance$98) { var newProps = finishedWork.memoizedProps, oldProps = null !== current ? current.memoizedProps : newProps, updatePayload = finishedWork.updateQueue; finishedWork.updateQueue = null; if (null !== updatePayload) try { - var viewConfig = instance$96.viewConfig; - instanceProps.set(instance$96._nativeTag, newProps); + var viewConfig = instance$98.viewConfig; + instanceProps.set(instance$98._nativeTag, newProps); var updatePayload$jscomp$0 = diffProperties( null, oldProps, @@ -6471,15 +6518,15 @@ function commitMutationEffectsOnFiber(finishedWork, root) { ); null != updatePayload$jscomp$0 && ReactNativePrivateInterface.UIManager.updateView( - instance$96._nativeTag, + instance$98._nativeTag, viewConfig.uiViewClassName, updatePayload$jscomp$0 ); - } catch (error$97) { + } catch (error$99) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$97 + error$99 ); } } @@ -6501,8 +6548,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { "RCTRawText", { text: updatePayload$jscomp$0 } ); - } catch (error$98) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$98); + } catch (error$100) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$100); } } break; @@ -6519,10 +6566,12 @@ function commitMutationEffectsOnFiber(finishedWork, root) { commitReconciliationEffects(finishedWork); viewConfig = finishedWork.child; viewConfig.flags & 8192 && - null !== viewConfig.memoizedState && - (null === viewConfig.alternate || - null === viewConfig.alternate.memoizedState) && - (globalMostRecentFallbackTime = now()); + ((updatePayload$jscomp$0 = null !== viewConfig.memoizedState), + (viewConfig.stateNode.isHidden = updatePayload$jscomp$0), + !updatePayload$jscomp$0 || + (null !== viewConfig.alternate && + null !== viewConfig.alternate.memoizedState) || + (globalMostRecentFallbackTime = now())); flags & 4 && attachSuspenseRetryListeners(finishedWork); break; case 22: @@ -6531,6 +6580,7 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (flags & 8192) a: for ( viewConfig = null !== finishedWork.memoizedState, + finishedWork.stateNode.isHidden = viewConfig, updatePayload$jscomp$0 = null, current = finishedWork; ; @@ -6540,8 +6590,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === updatePayload$jscomp$0) { updatePayload$jscomp$0 = current; try { - if (((instance$96 = current.stateNode), viewConfig)) - (newProps = instance$96.viewConfig), + if (((instance$98 = current.stateNode), viewConfig)) + (newProps = instance$98.viewConfig), (oldProps = diffProperties( null, emptyObject, @@ -6549,7 +6599,7 @@ function commitMutationEffectsOnFiber(finishedWork, root) { newProps.validAttributes )), ReactNativePrivateInterface.UIManager.updateView( - instance$96._nativeTag, + instance$98._nativeTag, newProps.uiViewClassName, oldProps ); @@ -6584,11 +6634,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === updatePayload$jscomp$0) try { throw Error("Not yet implemented."); - } catch (error$88) { + } catch (error$90) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$88 + error$90 ); } } else if ( @@ -6652,12 +6702,12 @@ function commitReconciliationEffects(finishedWork) { break; case 3: case 4: - var parent$89 = JSCompiler_inline_result.stateNode.containerInfo, - before$90 = getHostSibling(finishedWork); + var parent$91 = JSCompiler_inline_result.stateNode.containerInfo, + before$92 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$90, - parent$89 + before$92, + parent$91 ); break; default: @@ -6746,21 +6796,21 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { commitUpdateQueue(committedLanes, updateQueue, instance); break; case 3: - var updateQueue$83 = committedLanes.updateQueue; - if (null !== updateQueue$83) { - var instance$84 = null; + var updateQueue$85 = committedLanes.updateQueue; + if (null !== updateQueue$85) { + var instance$86 = null; if (null !== committedLanes.child) switch (committedLanes.child.tag) { case 5: - instance$84 = committedLanes.child.stateNode; + instance$86 = committedLanes.child.stateNode; break; case 1: - instance$84 = committedLanes.child.stateNode; + instance$86 = committedLanes.child.stateNode; } commitUpdateQueue( committedLanes, - updateQueue$83, - instance$84 + updateQueue$85, + instance$86 ); } break; @@ -6775,7 +6825,7 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { onCommit = _finishedWork$memoize2.onCommit, onRender = _finishedWork$memoize2.onRender, effectDuration = committedLanes.stateNode.effectDuration; - instance$84 = commitTime; + instance$86 = commitTime; current = null === current ? "mount" : "update"; currentUpdateIsNested && (current = "nested-update"); "function" === typeof onRender && @@ -6785,14 +6835,14 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { committedLanes.actualDuration, committedLanes.treeBaseDuration, committedLanes.actualStartTime, - instance$84 + instance$86 ); "function" === typeof onCommit && onCommit( committedLanes.memoizedProps.id, current, effectDuration, - instance$84 + instance$86 ); enqueuePendingPassiveProfilerEffect(committedLanes); var parentFiber = committedLanes.return; @@ -6823,27 +6873,27 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { ); } if (committedLanes.flags & 512) { - instance$84 = void 0; + instance$86 = void 0; current = committedLanes; var ref = current.ref; if (null !== ref) { var instance$jscomp$0 = current.stateNode; switch (current.tag) { case 5: - instance$84 = instance$jscomp$0; + instance$86 = instance$jscomp$0; break; default: - instance$84 = instance$jscomp$0; + instance$86 = instance$jscomp$0; } if ("function" === typeof ref) if (current.mode & 2) try { - startLayoutEffectTimer(), ref(instance$84); + startLayoutEffectTimer(), ref(instance$86); } finally { recordLayoutEffectDuration(current); } - else ref(instance$84); - else ref.current = instance$84; + else ref(instance$86); + else ref.current = instance$86; } } } catch (error) { @@ -6858,10 +6908,10 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { nextEffect = null; break; } - instance$84 = committedLanes.sibling; - if (null !== instance$84) { - instance$84.return = committedLanes.return; - nextEffect = instance$84; + instance$86 = committedLanes.sibling; + if (null !== instance$86) { + instance$86.return = committedLanes.return; + nextEffect = instance$86; break; } nextEffect = committedLanes.return; @@ -6919,15 +6969,13 @@ function requestUpdateLane(fiber) { fiber = currentUpdatePriority; return 0 !== fiber ? fiber : 16; } -function scheduleUpdateOnFiber(fiber, lane, eventTime) { +function scheduleUpdateOnFiber(root, fiber, lane, eventTime) { if (50 < nestedUpdateCount) throw ((nestedUpdateCount = 0), (rootWithNestedUpdates = null), Error( "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." )); - var root = markUpdateLaneFromFiberToRoot(fiber, lane); - if (null === root) return null; markRootUpdated(root, lane, eventTime); if (0 === (executionContext & 2) || root !== workInProgressRoot) isDevToolsPresent && addFiberToLanesMap(root, fiber, lane), @@ -6942,27 +6990,6 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { 0 === (fiber.mode & 1) && ((workInProgressRootRenderTargetTime = now() + 500), includesLegacySyncCallbacks && flushSyncCallbacks()); - return root; -} -function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { - sourceFiber.lanes |= lane; - var alternate = sourceFiber.alternate; - null !== alternate && (alternate.lanes |= lane); - alternate = sourceFiber; - for (sourceFiber = sourceFiber.return; null !== sourceFiber; ) - (sourceFiber.childLanes |= lane), - (alternate = sourceFiber.alternate), - null !== alternate && (alternate.childLanes |= lane), - (alternate = sourceFiber), - (sourceFiber = sourceFiber.return); - return 3 === alternate.tag ? alternate.stateNode : null; -} -function isInterleavedUpdate(fiber) { - return ( - (null !== workInProgressRoot || null !== interleavedQueues) && - 0 !== (fiber.mode & 1) && - 0 === (executionContext & 2) - ); } function ensureRootIsScheduled(root, currentTime) { for ( @@ -7378,10 +7405,10 @@ function prepareFreshStack(root, lanes) { workInProgressRootFatalError = null; workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null; - if (null !== interleavedQueues) { - for (lanes = 0; lanes < interleavedQueues.length; lanes++) + if (null !== concurrentQueues) { + for (lanes = 0; lanes < concurrentQueues.length; lanes++) if ( - ((timeoutHandle = interleavedQueues[lanes]), + ((timeoutHandle = concurrentQueues[lanes]), (interruptedWork = timeoutHandle.interleaved), null !== interruptedWork) ) { @@ -7395,7 +7422,7 @@ function prepareFreshStack(root, lanes) { } timeoutHandle.pending = interruptedWork; } - interleavedQueues = null; + concurrentQueues = null; } return root; } @@ -7494,7 +7521,7 @@ function handleError(root$jscomp$0, thrownValue) { else { var update = createUpdate(-1, 1); update.tag = 2; - enqueueUpdate(sourceFiber, update); + enqueueUpdate(sourceFiber, update, 1); } sourceFiber.lanes |= 1; } @@ -7521,13 +7548,12 @@ function handleError(root$jscomp$0, thrownValue) { ); } } - root = value; + root = value = createCapturedValueAtFiber(value, sourceFiber); 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2); null === workInProgressRootConcurrentErrors ? (workInProgressRootConcurrentErrors = [root]) : workInProgressRootConcurrentErrors.push(root); - value = createCapturedValue(value, sourceFiber); root = returnFiber; do { switch (root.tag) { @@ -7791,7 +7817,11 @@ function commitRootImpl( transitions < recoverableErrors.length; transitions++ ) - renderPriorityLevel(recoverableErrors[transitions]); + (lanes = recoverableErrors[transitions]), + renderPriorityLevel(lanes.value, { + componentStack: lanes.stack, + digest: lanes.digest + }); if (hasUncaughtError) throw ((hasUncaughtError = !1), (root = firstUncaughtError), @@ -8021,11 +8051,10 @@ function enqueuePendingPassiveProfilerEffect(fiber) { })); } function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - sourceFiber = createCapturedValue(error, sourceFiber); + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 1); - enqueueUpdate(rootFiber, sourceFiber); + rootFiber = enqueueUpdate(rootFiber, sourceFiber, 1); sourceFiber = requestEventTime(); - rootFiber = markUpdateLaneFromFiberToRoot(rootFiber, 1); null !== rootFiber && (markRootUpdated(rootFiber, 1, sourceFiber), ensureRootIsScheduled(rootFiber, sourceFiber)); @@ -8055,18 +8084,18 @@ function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { (null === legacyErrorBoundariesThatAlreadyFailed || !legacyErrorBoundariesThatAlreadyFailed.has(instance))) ) { - sourceFiber = createCapturedValue(error, sourceFiber); + sourceFiber = createCapturedValueAtFiber(error, sourceFiber); sourceFiber = createClassErrorUpdate( nearestMountedAncestor, sourceFiber, 1 ); - enqueueUpdate(nearestMountedAncestor, sourceFiber); - sourceFiber = requestEventTime(); - nearestMountedAncestor = markUpdateLaneFromFiberToRoot( + nearestMountedAncestor = enqueueUpdate( nearestMountedAncestor, + sourceFiber, 1 ); + sourceFiber = requestEventTime(); null !== nearestMountedAncestor && (markRootUpdated(nearestMountedAncestor, 1, sourceFiber), ensureRootIsScheduled(nearestMountedAncestor, sourceFiber)); @@ -8739,7 +8768,7 @@ function createFiberFromOffscreen(pendingProps, mode, lanes, key) { pendingProps = createFiber(22, pendingProps, key, mode); pendingProps.elementType = REACT_OFFSCREEN_TYPE; pendingProps.lanes = lanes; - pendingProps.stateNode = {}; + pendingProps.stateNode = { isHidden: !1 }; return pendingProps; } function createFiberFromText(content, mode, lanes) { @@ -8865,9 +8894,10 @@ function updateContainer(element, container, parentComponent, callback) { container.payload = { element: element }; callback = void 0 === callback ? null : callback; null !== callback && (container.callback = callback); - enqueueUpdate(current, container); - element = scheduleUpdateOnFiber(current, lane, eventTime); - null !== element && entangleTransitions(element, current, lane); + element = enqueueUpdate(current, container, lane); + null !== element && + (scheduleUpdateOnFiber(element, current, lane, eventTime), + entangleTransitions(element, current, lane)); return lane; } function emptyFindFiberByHostInstance() { @@ -8909,10 +8939,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1010 = { + devToolsConfig$jscomp$inline_1022 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.2.0-next-d300cebde-20220601", + version: "18.2.0-next-9e3b772b8-20220608", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8927,11 +8957,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1302 = { - bundleType: devToolsConfig$jscomp$inline_1010.bundleType, - version: devToolsConfig$jscomp$inline_1010.version, - rendererPackageName: devToolsConfig$jscomp$inline_1010.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1010.rendererConfig, +var internals$jscomp$inline_1310 = { + bundleType: devToolsConfig$jscomp$inline_1022.bundleType, + version: devToolsConfig$jscomp$inline_1022.version, + rendererPackageName: devToolsConfig$jscomp$inline_1022.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1022.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8947,26 +8977,26 @@ var internals$jscomp$inline_1302 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1010.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1022.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.2.0-next-d300cebde-20220601" + reconcilerVersion: "18.2.0-next-9e3b772b8-20220608" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1303 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1311 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1303.isDisabled && - hook$jscomp$inline_1303.supportsFiber + !hook$jscomp$inline_1311.isDisabled && + hook$jscomp$inline_1311.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1303.inject( - internals$jscomp$inline_1302 + (rendererID = hook$jscomp$inline_1311.inject( + internals$jscomp$inline_1310 )), - (injectedHook = hook$jscomp$inline_1303); + (injectedHook = hook$jscomp$inline_1311); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { diff --git a/package.json b/package.json index 4c8971a4f46ffd..4ace8dc8a1536b 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "repo-config" ], "peerDependencies": { - "react": "18.1.0" + "react": "18.2.0" }, "dependencies": { "@jest/create-cache-key-function": "^27.0.1", @@ -129,7 +129,7 @@ "react-refresh": "^0.4.0", "react-shallow-renderer": "^16.15.0", "regenerator-runtime": "^0.13.2", - "scheduler": "^0.22.0", + "scheduler": "^0.23.0", "stacktrace-parser": "^0.1.3", "use-sync-external-store": "^1.0.0", "whatwg-fetch": "^3.0.0", @@ -138,8 +138,8 @@ "devDependencies": { "flow-bin": "^0.184.0", "hermes-eslint": "0.8.0", - "react": "18.1.0", - "react-test-renderer": "^18.1.0" + "react": "18.2.0", + "react-test-renderer": "^18.2.0" }, "codegenConfig": { "libraries": [ diff --git a/packages/rn-tester/package.json b/packages/rn-tester/package.json index c201f167c2eb7d..ea04438644f126 100644 --- a/packages/rn-tester/package.json +++ b/packages/rn-tester/package.json @@ -23,7 +23,7 @@ "nullthrows": "^1.1.1" }, "peerDependencies": { - "react": "18.1.0", + "react": "18.2.0", "react-native": "*" }, "devDependencies": { diff --git a/repo-config/package.json b/repo-config/package.json index a52ffc790a3558..9b4f7df2b2376d 100644 --- a/repo-config/package.json +++ b/repo-config/package.json @@ -41,9 +41,9 @@ "metro-memory-fs": "0.72.0", "mkdirp": "^0.5.1", "prettier": "^2.4.1", - "react": "18.1.0", + "react": "18.2.0", "react-native-codegen": "^0.71.0", - "react-test-renderer": "18.1.0", + "react-test-renderer": "18.2.0", "shelljs": "^0.8.5", "signedsource": "^1.0.0", "ws": "^6.1.4", diff --git a/template/package.json b/template/package.json index a051967a7d9710..6f0af67eb6db8d 100644 --- a/template/package.json +++ b/template/package.json @@ -10,7 +10,7 @@ "lint": "eslint ." }, "dependencies": { - "react": "18.1.0", + "react": "18.2.0", "react-native": "1000.0.0" }, "devDependencies": { @@ -21,7 +21,7 @@ "eslint": "^8.19.0", "jest": "^26.6.3", "metro-react-native-babel-preset": "^0.72.0", - "react-test-renderer": "18.1.0" + "react-test-renderer": "18.2.0" }, "jest": { "preset": "react-native" diff --git a/yarn.lock b/yarn.lock index b59611d4a706c7..6b1724262b0a78 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5884,7 +5884,7 @@ react-devtools-core@4.24.0: shell-quote "^1.6.1" ws "^7" -"react-is@^16.12.0 || ^17.0.0 || ^18.0.0", react-is@^18.1.0: +"react-is@^16.12.0 || ^17.0.0 || ^18.0.0": version "18.1.0" resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.1.0.tgz#61aaed3096d30eacf2a2127118b5b41387d32a67" integrity sha512-Fl7FuabXsJnV5Q1qIOQwx/sagGF18kogb4gpfcG4gjLBWO0WDiiz1ko/ExayuxE7InyQkBLkxRFG5oxY6Uu3Kg== @@ -5899,6 +5899,11 @@ react-is@^17.0.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== +react-is@^18.2.0: + version "18.2.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" + integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== + react-refresh@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.4.0.tgz#d421f9bd65e0e4b9822a399f14ac56bda9c92292" @@ -5912,19 +5917,19 @@ react-shallow-renderer@^16.15.0: object-assign "^4.1.1" react-is "^16.12.0 || ^17.0.0 || ^18.0.0" -react-test-renderer@18.1.0, react-test-renderer@^18.1.0: - version "18.1.0" - resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-18.1.0.tgz#35b75754834cf9ab517b6813db94aee0a6b545c3" - integrity sha512-OfuueprJFW7h69GN+kr4Ywin7stcuqaYAt1g7airM5cUgP0BoF5G5CXsPGmXeDeEkncb2fqYNECO4y18sSqphg== +react-test-renderer@18.2.0, react-test-renderer@^18.2.0: + version "18.2.0" + resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-18.2.0.tgz#1dd912bd908ff26da5b9fca4fd1c489b9523d37e" + integrity sha512-JWD+aQ0lh2gvh4NM3bBM42Kx+XybOxCpgYK7F8ugAlpaTSnWsX+39Z4XkOykGZAHrjwwTZT3x3KxswVWxHPUqA== dependencies: - react-is "^18.1.0" + react-is "^18.2.0" react-shallow-renderer "^16.15.0" - scheduler "^0.22.0" + scheduler "^0.23.0" -react@18.1.0: - version "18.1.0" - resolved "https://registry.yarnpkg.com/react/-/react-18.1.0.tgz#6f8620382decb17fdc5cc223a115e2adbf104890" - integrity sha512-4oL8ivCz5ZEPyclFQXaNksK3adutVS8l2xzZU0cqEFrE9Sb7fC0EFK5uEk74wIreL1DERyjvsU915j1pcT2uEQ== +react@18.2.0: + version "18.2.0" + resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5" + integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== dependencies: loose-envify "^1.1.0" @@ -6262,10 +6267,10 @@ saxes@^5.0.1: dependencies: xmlchars "^2.2.0" -scheduler@^0.22.0: - version "0.22.0" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.22.0.tgz#83a5d63594edf074add9a7198b1bae76c3db01b8" - integrity sha512-6QAm1BgQI88NPYymgGQLCZgvep4FyePDWFpXVK+zNSUgHwlqpJy8VEh8Et0KxTACS4VWwMousBElAZOH9nkkoQ== +scheduler@^0.23.0: + version "0.23.0" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe" + integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw== dependencies: loose-envify "^1.1.0"