From b08f05614fe966037677357e89ace15881be8402 Mon Sep 17 00:00:00 2001 From: acdlite Date: Tue, 21 Mar 2023 14:30:43 +0000 Subject: [PATCH] Don't prerender siblings of suspended component (#26380) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Today if something suspends, React will continue rendering the siblings of that component. Our original rationale for prerendering the siblings of a suspended component was to initiate any lazy fetches that they might contain. This was when we were more bullish about lazy fetching being a good idea some of the time (when combined with prefetching), as opposed to our latest thinking, which is that it's almost always a bad idea. Another rationale for the original behavior was that the render was I/O bound, anyway, so we might as do some extra work in the meantime. But this was before we had the concept of instant loading states: when navigating to a new screen, it's better to show a loading state as soon as you can (often a skeleton UI), rather than delay the transition. (There are still cases where we block the render, when a suitable loading state is not available; it's just not _all_ cases where something suspends.) So the biggest issue with our existing implementation is that the prerendering of the siblings happens within the same render pass as the one that suspended — _before_ the loading state appears. What we should do instead is immediately unwind the stack as soon as something suspends, to unblock the loading state. If we want to preserve the ability to prerender the siblings, what we could do is schedule special render pass immediately after the fallback is displayed. This is likely what we'll do in the future. However, in the new implementation of `use`, there's another reason we don't prerender siblings: so we can preserve the state of the stack when something suspends, and resume where we left of when the promise resolves without replaying the parents. The only way to do this currently is to suspend the entire work loop. Fiber does not currently support rendering multiple siblings in "parallel". Once you move onto the next sibling, the stack of the previous sibling is discarded and cannot be restored. We do plan to implement this feature, but it will require a not-insignificant refactor. Given that lazy data fetching is already bad for performance, the best trade off for now seems to be to disable prerendering of siblings. This gives us the best performance characteristics when you're following best practices (i.e. hoist data fetches to Server Components or route loaders), at the expense of making an already bad pattern a bit worse. Later, when we implement resumable context stacks, we can reenable sibling prerendering. Though even then the use case will mostly be to prerender the CPU-bound work, not lazy fetches. DiffTrain build for [12a1d140e366aa8d95338e4412117f16da79a078](https://github.com/facebook/react/commit/12a1d140e366aa8d95338e4412117f16da79a078) --- compiled/facebook-www/REVISION | 2 +- compiled/facebook-www/React-dev.modern.js | 2 +- compiled/facebook-www/ReactART-dev.classic.js | 216 +++++++++----- compiled/facebook-www/ReactART-dev.modern.js | 216 +++++++++----- .../facebook-www/ReactART-prod.classic.js | 111 ++++--- compiled/facebook-www/ReactART-prod.modern.js | 111 ++++--- compiled/facebook-www/ReactDOM-dev.classic.js | 214 ++++++++----- compiled/facebook-www/ReactDOM-dev.modern.js | 214 ++++++++----- .../facebook-www/ReactDOM-prod.classic.js | 201 +++++++------ compiled/facebook-www/ReactDOM-prod.modern.js | 257 ++++++++-------- .../ReactDOM-profiling.classic.js | 204 +++++++------ .../facebook-www/ReactDOM-profiling.modern.js | 262 ++++++++-------- .../ReactDOMTesting-dev.classic.js | 214 ++++++++----- .../ReactDOMTesting-dev.modern.js | 214 ++++++++----- .../ReactDOMTesting-prod.classic.js | 281 ++++++++++-------- .../ReactDOMTesting-prod.modern.js | 257 ++++++++-------- .../ReactTestRenderer-dev.classic.js | 186 +++++++----- .../ReactTestRenderer-dev.modern.js | 186 +++++++----- compiled/facebook-www/WARNINGS | 1 + 19 files changed, 2006 insertions(+), 1343 deletions(-) diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index 172a07ee6f862..3ce6272131916 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -77ba1618a528787baaa8e007fadaff93a86fb675 +12a1d140e366aa8d95338e4412117f16da79a078 diff --git a/compiled/facebook-www/React-dev.modern.js b/compiled/facebook-www/React-dev.modern.js index c96fd5e14e315..e26a3f043f2b7 100644 --- a/compiled/facebook-www/React-dev.modern.js +++ b/compiled/facebook-www/React-dev.modern.js @@ -27,7 +27,7 @@ if ( } "use strict"; -var ReactVersion = "18.3.0-www-modern-1423f459"; +var ReactVersion = "18.3.0-www-modern-0d5680f8"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled/facebook-www/ReactART-dev.classic.js b/compiled/facebook-www/ReactART-dev.classic.js index b68bb27ecf45f..879eb1c2c28c2 100644 --- a/compiled/facebook-www/ReactART-dev.classic.js +++ b/compiled/facebook-www/ReactART-dev.classic.js @@ -69,7 +69,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = "18.3.0-www-classic-26dea44b"; +var ReactVersion = "18.3.0-www-classic-f4456f06"; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -165,7 +165,9 @@ var ReactSharedInternals = // Re-export dynamic flags from the www version. var dynamicFeatureFlags = require("ReactFeatureFlags"); -var replayFailedUnitOfWorkWithInvokeGuardedCallback = +var revertRemovalOfSiblingPrerendering = + dynamicFeatureFlags.revertRemovalOfSiblingPrerendering, + replayFailedUnitOfWorkWithInvokeGuardedCallback = dynamicFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback, deferRenderPhaseUpdateToNextBatch = dynamicFeatureFlags.deferRenderPhaseUpdateToNextBatch, @@ -24762,10 +24764,10 @@ function renderRootSync(root, lanes) { } default: { - // Continue with the normal work loop. + // Unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } } @@ -24872,7 +24874,7 @@ function renderRootConcurrent(root, lanes) { // Unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -24937,7 +24939,7 @@ function renderRootConcurrent(root, lanes) { // Otherwise, unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); } break; @@ -25002,7 +25004,7 @@ function renderRootConcurrent(root, lanes) { workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -25013,7 +25015,7 @@ function renderRootConcurrent(root, lanes) { // always unwind. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -25216,7 +25218,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { ReactCurrentOwner.current = null; } -function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { // This is a fork of performUnitOfWork specifcally for unwinding a fiber // that threw an exception. // @@ -25259,9 +25261,23 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { // To prevent an infinite loop, bubble the error up to the next parent. workInProgress = returnFiber; throw error; - } // Return to the normal work loop. + } - completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & Incomplete) { + // Unwind the stack until we reach the nearest boundary. + unwindUnitOfWork(unitOfWork); + } else { + // Although the fiber suspended, we're intentionally going to commit it in + // an inconsistent state. We can do this safely in cases where we know the + // inconsistent tree will be hidden. + // + // This currently only applies to Legacy Suspense implementation, but we may + // port a version of this to concurrent roots, too, when performing a + // synchronous render. Because that will allow us to mutate the tree as we + // go instead of buffering mutations until the end. Though it's unclear if + // this particular path is how that would be implemented. + completeUnitOfWork(unitOfWork); + } } function completeUnitOfWork(unitOfWork) { @@ -25270,75 +25286,53 @@ function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { - // The current, flushed, state of this fiber is the alternate. Ideally - // nothing should rely on this, but relying on it here means that we don't - // need an additional field on the work in progress. - var current = completedWork.alternate; - var returnFiber = completedWork.return; // Check if the work completed or if something threw. - - if ((completedWork.flags & Incomplete) === NoFlags$1) { - setCurrentFiber(completedWork); - var next = void 0; - - if ((completedWork.mode & ProfileMode) === NoMode) { - next = completeWork(current, completedWork, renderLanes); - } else { - startProfilerTimer(completedWork); - next = completeWork(current, completedWork, renderLanes); // Update render duration assuming we didn't error. - - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); - } - - resetCurrentFiber(); - - if (next !== null) { - // Completing this fiber spawned new work. Work on that next. - workInProgress = next; + if (revertRemovalOfSiblingPrerendering) { + if ((completedWork.flags & Incomplete) !== NoFlags$1) { + // This fiber did not complete, because one of its children did not + // complete. Switch to unwinding the stack instead of completing it. + // + // The reason "unwind" and "complete" is interleaved is because when + // something suspends, we continue rendering the siblings even though + // they will be replaced by a fallback. + // TODO: Disable sibling prerendering, then remove this branch. + unwindUnitOfWork(completedWork); return; } } else { - // This fiber did not complete because something threw. Pop values off - // the stack without entering the complete phase. If this is a boundary, - // capture values if possible. - var _next = unwindWork(current, completedWork); // Because this fiber did not complete, don't reset its lanes. - - if (_next !== null) { - // If completing this work spawned new work, do that next. We'll come - // back here again. - // Since we're restarting, remove anything that is not a host effect - // from the effect tag. - _next.flags &= HostEffectMask; - workInProgress = _next; - return; + { + if ((completedWork.flags & Incomplete) !== NoFlags$1) { + // NOTE: If we re-enable sibling prerendering in some cases, this branch + // is where we would switch to the unwinding path. + error( + "Internal React error: Expected this fiber to be complete, but " + + "it isn't. It should have been unwound. This is a bug in React." + ); + } } + } // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. - if ((completedWork.mode & ProfileMode) !== NoMode) { - // Record the render duration for the fiber that errored. - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing. + var current = completedWork.alternate; + var returnFiber = completedWork.return; + setCurrentFiber(completedWork); + var next = void 0; - var actualDuration = completedWork.actualDuration; - var child = completedWork.child; + if ((completedWork.mode & ProfileMode) === NoMode) { + next = completeWork(current, completedWork, renderLanes); + } else { + startProfilerTimer(completedWork); + next = completeWork(current, completedWork, renderLanes); // Update render duration assuming we didn't error. - while (child !== null) { - // $FlowFixMe[unsafe-addition] addition with possible null/undefined value - actualDuration += child.actualDuration; - child = child.sibling; - } + stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); + } - completedWork.actualDuration = actualDuration; - } + resetCurrentFiber(); - if (returnFiber !== null) { - // Mark the parent fiber as incomplete and clear its subtree flags. - returnFiber.flags |= Incomplete; - returnFiber.subtreeFlags = NoFlags$1; - returnFiber.deletions = null; - } else { - // We've unwound all the way to the root. - workInProgressRootExitStatus = RootDidNotComplete; - workInProgress = null; - return; - } + if (next !== null) { + // Completing this fiber spawned new work. Work on that next. + workInProgress = next; + return; } var siblingFiber = completedWork.sibling; @@ -25360,6 +25354,86 @@ function completeUnitOfWork(unitOfWork) { } } +function unwindUnitOfWork(unitOfWork) { + var incompleteWork = unitOfWork; + + do { + // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. + var current = incompleteWork.alternate; // This fiber did not complete because something threw. Pop values off + // the stack without entering the complete phase. If this is a boundary, + // capture values if possible. + + var next = unwindWork(current, incompleteWork); // Because this fiber did not complete, don't reset its lanes. + + if (next !== null) { + // Found a boundary that can handle this exception. Re-renter the + // begin phase. This branch will return us to the normal work loop. + // + // Since we're restarting, remove anything that is not a host effect + // from the effect tag. + next.flags &= HostEffectMask; + workInProgress = next; + return; + } // Keep unwinding until we reach either a boundary or the root. + + if ((incompleteWork.mode & ProfileMode) !== NoMode) { + // Record the render duration for the fiber that errored. + stopProfilerTimerIfRunningAndRecordDelta(incompleteWork, false); // Include the time spent working on failed children before continuing. + + var actualDuration = incompleteWork.actualDuration; + var child = incompleteWork.child; + + while (child !== null) { + // $FlowFixMe[unsafe-addition] addition with possible null/undefined value + actualDuration += child.actualDuration; + child = child.sibling; + } + + incompleteWork.actualDuration = actualDuration; + } // TODO: Once we stop prerendering siblings, instead of resetting the parent + // of the node being unwound, we should be able to reset node itself as we + // unwind the stack. Saves an additional null check. + + var returnFiber = incompleteWork.return; + + if (returnFiber !== null) { + // Mark the parent fiber as incomplete and clear its subtree flags. + // TODO: Once we stop prerendering siblings, we may be able to get rid of + // the Incomplete flag because unwinding to the nearest boundary will + // happen synchronously. + returnFiber.flags |= Incomplete; + returnFiber.subtreeFlags = NoFlags$1; + returnFiber.deletions = null; + } + + if (revertRemovalOfSiblingPrerendering) { + // If there are siblings, work on them now even though they're going to be + // replaced by a fallback. We're "prerendering" them. Historically our + // rationale for this behavior has been to initiate any lazy data requests + // in the siblings, and also to warm up the CPU cache. + // TODO: Don't prerender siblings. With `use`, we suspend the work loop + // until the data has resolved, anyway. + var siblingFiber = incompleteWork.sibling; + + if (siblingFiber !== null) { + // This branch will return us to the normal work loop. + workInProgress = siblingFiber; + return; + } + } // Otherwise, return to the parent + // $FlowFixMe[incompatible-type] we bail out when we get a null + + incompleteWork = returnFiber; // Update the next thing we're working on in case something throws. + + workInProgress = incompleteWork; + } while (incompleteWork !== null); // We've unwound all the way to the root. + + workInProgressRootExitStatus = RootDidNotComplete; + workInProgress = null; +} + function commitRoot(root, recoverableErrors, transitions) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. diff --git a/compiled/facebook-www/ReactART-dev.modern.js b/compiled/facebook-www/ReactART-dev.modern.js index c6403305c797a..073c67ea13a62 100644 --- a/compiled/facebook-www/ReactART-dev.modern.js +++ b/compiled/facebook-www/ReactART-dev.modern.js @@ -69,7 +69,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = "18.3.0-www-modern-faee710c"; +var ReactVersion = "18.3.0-www-modern-d114403d"; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -165,7 +165,9 @@ var ReactSharedInternals = // Re-export dynamic flags from the www version. var dynamicFeatureFlags = require("ReactFeatureFlags"); -var replayFailedUnitOfWorkWithInvokeGuardedCallback = +var revertRemovalOfSiblingPrerendering = + dynamicFeatureFlags.revertRemovalOfSiblingPrerendering, + replayFailedUnitOfWorkWithInvokeGuardedCallback = dynamicFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback, deferRenderPhaseUpdateToNextBatch = dynamicFeatureFlags.deferRenderPhaseUpdateToNextBatch, @@ -24422,10 +24424,10 @@ function renderRootSync(root, lanes) { } default: { - // Continue with the normal work loop. + // Unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } } @@ -24532,7 +24534,7 @@ function renderRootConcurrent(root, lanes) { // Unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -24597,7 +24599,7 @@ function renderRootConcurrent(root, lanes) { // Otherwise, unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); } break; @@ -24662,7 +24664,7 @@ function renderRootConcurrent(root, lanes) { workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -24673,7 +24675,7 @@ function renderRootConcurrent(root, lanes) { // always unwind. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -24876,7 +24878,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { ReactCurrentOwner.current = null; } -function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { // This is a fork of performUnitOfWork specifcally for unwinding a fiber // that threw an exception. // @@ -24919,9 +24921,23 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { // To prevent an infinite loop, bubble the error up to the next parent. workInProgress = returnFiber; throw error; - } // Return to the normal work loop. + } - completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & Incomplete) { + // Unwind the stack until we reach the nearest boundary. + unwindUnitOfWork(unitOfWork); + } else { + // Although the fiber suspended, we're intentionally going to commit it in + // an inconsistent state. We can do this safely in cases where we know the + // inconsistent tree will be hidden. + // + // This currently only applies to Legacy Suspense implementation, but we may + // port a version of this to concurrent roots, too, when performing a + // synchronous render. Because that will allow us to mutate the tree as we + // go instead of buffering mutations until the end. Though it's unclear if + // this particular path is how that would be implemented. + completeUnitOfWork(unitOfWork); + } } function completeUnitOfWork(unitOfWork) { @@ -24930,75 +24946,53 @@ function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { - // The current, flushed, state of this fiber is the alternate. Ideally - // nothing should rely on this, but relying on it here means that we don't - // need an additional field on the work in progress. - var current = completedWork.alternate; - var returnFiber = completedWork.return; // Check if the work completed or if something threw. - - if ((completedWork.flags & Incomplete) === NoFlags$1) { - setCurrentFiber(completedWork); - var next = void 0; - - if ((completedWork.mode & ProfileMode) === NoMode) { - next = completeWork(current, completedWork, renderLanes); - } else { - startProfilerTimer(completedWork); - next = completeWork(current, completedWork, renderLanes); // Update render duration assuming we didn't error. - - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); - } - - resetCurrentFiber(); - - if (next !== null) { - // Completing this fiber spawned new work. Work on that next. - workInProgress = next; + if (revertRemovalOfSiblingPrerendering) { + if ((completedWork.flags & Incomplete) !== NoFlags$1) { + // This fiber did not complete, because one of its children did not + // complete. Switch to unwinding the stack instead of completing it. + // + // The reason "unwind" and "complete" is interleaved is because when + // something suspends, we continue rendering the siblings even though + // they will be replaced by a fallback. + // TODO: Disable sibling prerendering, then remove this branch. + unwindUnitOfWork(completedWork); return; } } else { - // This fiber did not complete because something threw. Pop values off - // the stack without entering the complete phase. If this is a boundary, - // capture values if possible. - var _next = unwindWork(current, completedWork); // Because this fiber did not complete, don't reset its lanes. - - if (_next !== null) { - // If completing this work spawned new work, do that next. We'll come - // back here again. - // Since we're restarting, remove anything that is not a host effect - // from the effect tag. - _next.flags &= HostEffectMask; - workInProgress = _next; - return; + { + if ((completedWork.flags & Incomplete) !== NoFlags$1) { + // NOTE: If we re-enable sibling prerendering in some cases, this branch + // is where we would switch to the unwinding path. + error( + "Internal React error: Expected this fiber to be complete, but " + + "it isn't. It should have been unwound. This is a bug in React." + ); + } } + } // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. - if ((completedWork.mode & ProfileMode) !== NoMode) { - // Record the render duration for the fiber that errored. - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing. + var current = completedWork.alternate; + var returnFiber = completedWork.return; + setCurrentFiber(completedWork); + var next = void 0; - var actualDuration = completedWork.actualDuration; - var child = completedWork.child; + if ((completedWork.mode & ProfileMode) === NoMode) { + next = completeWork(current, completedWork, renderLanes); + } else { + startProfilerTimer(completedWork); + next = completeWork(current, completedWork, renderLanes); // Update render duration assuming we didn't error. - while (child !== null) { - // $FlowFixMe[unsafe-addition] addition with possible null/undefined value - actualDuration += child.actualDuration; - child = child.sibling; - } + stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); + } - completedWork.actualDuration = actualDuration; - } + resetCurrentFiber(); - if (returnFiber !== null) { - // Mark the parent fiber as incomplete and clear its subtree flags. - returnFiber.flags |= Incomplete; - returnFiber.subtreeFlags = NoFlags$1; - returnFiber.deletions = null; - } else { - // We've unwound all the way to the root. - workInProgressRootExitStatus = RootDidNotComplete; - workInProgress = null; - return; - } + if (next !== null) { + // Completing this fiber spawned new work. Work on that next. + workInProgress = next; + return; } var siblingFiber = completedWork.sibling; @@ -25020,6 +25014,86 @@ function completeUnitOfWork(unitOfWork) { } } +function unwindUnitOfWork(unitOfWork) { + var incompleteWork = unitOfWork; + + do { + // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. + var current = incompleteWork.alternate; // This fiber did not complete because something threw. Pop values off + // the stack without entering the complete phase. If this is a boundary, + // capture values if possible. + + var next = unwindWork(current, incompleteWork); // Because this fiber did not complete, don't reset its lanes. + + if (next !== null) { + // Found a boundary that can handle this exception. Re-renter the + // begin phase. This branch will return us to the normal work loop. + // + // Since we're restarting, remove anything that is not a host effect + // from the effect tag. + next.flags &= HostEffectMask; + workInProgress = next; + return; + } // Keep unwinding until we reach either a boundary or the root. + + if ((incompleteWork.mode & ProfileMode) !== NoMode) { + // Record the render duration for the fiber that errored. + stopProfilerTimerIfRunningAndRecordDelta(incompleteWork, false); // Include the time spent working on failed children before continuing. + + var actualDuration = incompleteWork.actualDuration; + var child = incompleteWork.child; + + while (child !== null) { + // $FlowFixMe[unsafe-addition] addition with possible null/undefined value + actualDuration += child.actualDuration; + child = child.sibling; + } + + incompleteWork.actualDuration = actualDuration; + } // TODO: Once we stop prerendering siblings, instead of resetting the parent + // of the node being unwound, we should be able to reset node itself as we + // unwind the stack. Saves an additional null check. + + var returnFiber = incompleteWork.return; + + if (returnFiber !== null) { + // Mark the parent fiber as incomplete and clear its subtree flags. + // TODO: Once we stop prerendering siblings, we may be able to get rid of + // the Incomplete flag because unwinding to the nearest boundary will + // happen synchronously. + returnFiber.flags |= Incomplete; + returnFiber.subtreeFlags = NoFlags$1; + returnFiber.deletions = null; + } + + if (revertRemovalOfSiblingPrerendering) { + // If there are siblings, work on them now even though they're going to be + // replaced by a fallback. We're "prerendering" them. Historically our + // rationale for this behavior has been to initiate any lazy data requests + // in the siblings, and also to warm up the CPU cache. + // TODO: Don't prerender siblings. With `use`, we suspend the work loop + // until the data has resolved, anyway. + var siblingFiber = incompleteWork.sibling; + + if (siblingFiber !== null) { + // This branch will return us to the normal work loop. + workInProgress = siblingFiber; + return; + } + } // Otherwise, return to the parent + // $FlowFixMe[incompatible-type] we bail out when we get a null + + incompleteWork = returnFiber; // Update the next thing we're working on in case something throws. + + workInProgress = incompleteWork; + } while (incompleteWork !== null); // We've unwound all the way to the root. + + workInProgressRootExitStatus = RootDidNotComplete; + workInProgress = null; +} + function commitRoot(root, recoverableErrors, transitions) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. diff --git a/compiled/facebook-www/ReactART-prod.classic.js b/compiled/facebook-www/ReactART-prod.classic.js index e85a63b14ce67..58033a16a696e 100644 --- a/compiled/facebook-www/ReactART-prod.classic.js +++ b/compiled/facebook-www/ReactART-prod.classic.js @@ -63,6 +63,8 @@ function formatProdErrorMessage(code) { var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, dynamicFeatureFlags = require("ReactFeatureFlags"), + revertRemovalOfSiblingPrerendering = + dynamicFeatureFlags.revertRemovalOfSiblingPrerendering, deferRenderPhaseUpdateToNextBatch = dynamicFeatureFlags.deferRenderPhaseUpdateToNextBatch, enableDebugTracing = dynamicFeatureFlags.enableDebugTracing, @@ -8306,7 +8308,7 @@ function renderRootSync(root, lanes) { default: (workInProgressSuspendedReason = 0), (workInProgressThrownValue = null), - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); } } workLoopSync(); @@ -8346,7 +8348,7 @@ function renderRootConcurrent(root, lanes) { case 1: workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 2: if (isThenableResolved(thrownValue)) { @@ -8376,7 +8378,7 @@ function renderRootConcurrent(root, lanes) { replaySuspendedUnitOfWork(lanes)) : ((workInProgressSuspendedReason = 0), (workInProgressThrownValue = null), - unwindSuspendedUnitOfWork(lanes, thrownValue)); + throwAndUnwindWorkLoop(lanes, thrownValue)); break; case 5: switch (workInProgress.tag) { @@ -8399,12 +8401,12 @@ function renderRootConcurrent(root, lanes) { } workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 6: workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 8: resetWorkInProgressStack(); @@ -8482,7 +8484,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { : (workInProgress = current); ReactCurrentOwner.current = null; } -function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { resetContextDependencies(); resetHooksOnUnwind(); thenableState$1 = null; @@ -8653,38 +8655,30 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { } catch (error) { throw ((workInProgress = returnFiber), error); } - completeUnitOfWork(unitOfWork); + unitOfWork.flags & 32768 + ? unwindUnitOfWork(unitOfWork) + : completeUnitOfWork(unitOfWork); } } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { - var current = completedWork.alternate; + if ( + revertRemovalOfSiblingPrerendering && + 0 !== (completedWork.flags & 32768) + ) { + unwindUnitOfWork(completedWork); + return; + } unitOfWork = completedWork.return; - if (0 === (completedWork.flags & 32768)) { - if ( - ((current = completeWork(current, completedWork, renderLanes)), - null !== current) - ) { - workInProgress = current; - return; - } - } else { - current = unwindWork(current, completedWork); - if (null !== current) { - current.flags &= 32767; - workInProgress = current; - return; - } - if (null !== unitOfWork) - (unitOfWork.flags |= 32768), - (unitOfWork.subtreeFlags = 0), - (unitOfWork.deletions = null); - else { - workInProgressRootExitStatus = 6; - workInProgress = null; - return; - } + var next = completeWork( + completedWork.alternate, + completedWork, + renderLanes + ); + if (null !== next) { + workInProgress = next; + return; } completedWork = completedWork.sibling; if (null !== completedWork) { @@ -8695,6 +8689,29 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } +function unwindUnitOfWork(unitOfWork) { + do { + var next = unwindWork(unitOfWork.alternate, unitOfWork); + if (null !== next) { + next.flags &= 32767; + workInProgress = next; + return; + } + next = unitOfWork.return; + null !== next && + ((next.flags |= 32768), (next.subtreeFlags = 0), (next.deletions = null)); + if ( + revertRemovalOfSiblingPrerendering && + ((unitOfWork = unitOfWork.sibling), null !== unitOfWork) + ) { + workInProgress = unitOfWork; + return; + } + workInProgress = unitOfWork = next; + } while (null !== unitOfWork); + workInProgressRootExitStatus = 6; + workInProgress = null; +} function commitRoot(root, recoverableErrors, transitions) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig.transition; @@ -9940,19 +9957,19 @@ var slice = Array.prototype.slice, }; return Text; })(React.Component), - devToolsConfig$jscomp$inline_1158 = { + devToolsConfig$jscomp$inline_1157 = { findFiberByHostInstance: function () { return null; }, bundleType: 0, - version: "18.3.0-www-classic-12f727b0", + version: "18.3.0-www-classic-f03f0ae3", rendererPackageName: "react-art" }; -var internals$jscomp$inline_1333 = { - bundleType: devToolsConfig$jscomp$inline_1158.bundleType, - version: devToolsConfig$jscomp$inline_1158.version, - rendererPackageName: devToolsConfig$jscomp$inline_1158.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1158.rendererConfig, +var internals$jscomp$inline_1332 = { + bundleType: devToolsConfig$jscomp$inline_1157.bundleType, + version: devToolsConfig$jscomp$inline_1157.version, + rendererPackageName: devToolsConfig$jscomp$inline_1157.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1157.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -9969,26 +9986,26 @@ var internals$jscomp$inline_1333 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1158.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1157.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-12f727b0" + reconcilerVersion: "18.3.0-www-classic-f03f0ae3" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1334 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1333 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1334.isDisabled && - hook$jscomp$inline_1334.supportsFiber + !hook$jscomp$inline_1333.isDisabled && + hook$jscomp$inline_1333.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1334.inject( - internals$jscomp$inline_1333 + (rendererID = hook$jscomp$inline_1333.inject( + internals$jscomp$inline_1332 )), - (injectedHook = hook$jscomp$inline_1334); + (injectedHook = hook$jscomp$inline_1333); } catch (err) {} } var Path = Mode$1.Path; diff --git a/compiled/facebook-www/ReactART-prod.modern.js b/compiled/facebook-www/ReactART-prod.modern.js index ea8a203a2439d..6a3ee426daf25 100644 --- a/compiled/facebook-www/ReactART-prod.modern.js +++ b/compiled/facebook-www/ReactART-prod.modern.js @@ -63,6 +63,8 @@ function formatProdErrorMessage(code) { var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, dynamicFeatureFlags = require("ReactFeatureFlags"), + revertRemovalOfSiblingPrerendering = + dynamicFeatureFlags.revertRemovalOfSiblingPrerendering, deferRenderPhaseUpdateToNextBatch = dynamicFeatureFlags.deferRenderPhaseUpdateToNextBatch, enableDebugTracing = dynamicFeatureFlags.enableDebugTracing, @@ -8038,7 +8040,7 @@ function renderRootSync(root, lanes) { default: (workInProgressSuspendedReason = 0), (workInProgressThrownValue = null), - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); } } workLoopSync(); @@ -8078,7 +8080,7 @@ function renderRootConcurrent(root, lanes) { case 1: workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 2: if (isThenableResolved(thrownValue)) { @@ -8108,7 +8110,7 @@ function renderRootConcurrent(root, lanes) { replaySuspendedUnitOfWork(lanes)) : ((workInProgressSuspendedReason = 0), (workInProgressThrownValue = null), - unwindSuspendedUnitOfWork(lanes, thrownValue)); + throwAndUnwindWorkLoop(lanes, thrownValue)); break; case 5: switch (workInProgress.tag) { @@ -8131,12 +8133,12 @@ function renderRootConcurrent(root, lanes) { } workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 6: workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 8: resetWorkInProgressStack(); @@ -8214,7 +8216,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { : (workInProgress = current); ReactCurrentOwner.current = null; } -function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { resetContextDependencies(); resetHooksOnUnwind(); thenableState$1 = null; @@ -8385,38 +8387,30 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { } catch (error) { throw ((workInProgress = returnFiber), error); } - completeUnitOfWork(unitOfWork); + unitOfWork.flags & 32768 + ? unwindUnitOfWork(unitOfWork) + : completeUnitOfWork(unitOfWork); } } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { - var current = completedWork.alternate; + if ( + revertRemovalOfSiblingPrerendering && + 0 !== (completedWork.flags & 32768) + ) { + unwindUnitOfWork(completedWork); + return; + } unitOfWork = completedWork.return; - if (0 === (completedWork.flags & 32768)) { - if ( - ((current = completeWork(current, completedWork, renderLanes)), - null !== current) - ) { - workInProgress = current; - return; - } - } else { - current = unwindWork(current, completedWork); - if (null !== current) { - current.flags &= 32767; - workInProgress = current; - return; - } - if (null !== unitOfWork) - (unitOfWork.flags |= 32768), - (unitOfWork.subtreeFlags = 0), - (unitOfWork.deletions = null); - else { - workInProgressRootExitStatus = 6; - workInProgress = null; - return; - } + var next = completeWork( + completedWork.alternate, + completedWork, + renderLanes + ); + if (null !== next) { + workInProgress = next; + return; } completedWork = completedWork.sibling; if (null !== completedWork) { @@ -8427,6 +8421,29 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } +function unwindUnitOfWork(unitOfWork) { + do { + var next = unwindWork(unitOfWork.alternate, unitOfWork); + if (null !== next) { + next.flags &= 32767; + workInProgress = next; + return; + } + next = unitOfWork.return; + null !== next && + ((next.flags |= 32768), (next.subtreeFlags = 0), (next.deletions = null)); + if ( + revertRemovalOfSiblingPrerendering && + ((unitOfWork = unitOfWork.sibling), null !== unitOfWork) + ) { + workInProgress = unitOfWork; + return; + } + workInProgress = unitOfWork = next; + } while (null !== unitOfWork); + workInProgressRootExitStatus = 6; + workInProgress = null; +} function commitRoot(root, recoverableErrors, transitions) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig.transition; @@ -9605,19 +9622,19 @@ var slice = Array.prototype.slice, }; return Text; })(React.Component), - devToolsConfig$jscomp$inline_1138 = { + devToolsConfig$jscomp$inline_1137 = { findFiberByHostInstance: function () { return null; }, bundleType: 0, - version: "18.3.0-www-modern-86a50993", + version: "18.3.0-www-modern-05e288bd", rendererPackageName: "react-art" }; -var internals$jscomp$inline_1313 = { - bundleType: devToolsConfig$jscomp$inline_1138.bundleType, - version: devToolsConfig$jscomp$inline_1138.version, - rendererPackageName: devToolsConfig$jscomp$inline_1138.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1138.rendererConfig, +var internals$jscomp$inline_1312 = { + bundleType: devToolsConfig$jscomp$inline_1137.bundleType, + version: devToolsConfig$jscomp$inline_1137.version, + rendererPackageName: devToolsConfig$jscomp$inline_1137.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1137.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -9634,26 +9651,26 @@ var internals$jscomp$inline_1313 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1138.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1137.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-86a50993" + reconcilerVersion: "18.3.0-www-modern-05e288bd" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1314 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1313 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1314.isDisabled && - hook$jscomp$inline_1314.supportsFiber + !hook$jscomp$inline_1313.isDisabled && + hook$jscomp$inline_1313.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1314.inject( - internals$jscomp$inline_1313 + (rendererID = hook$jscomp$inline_1313.inject( + internals$jscomp$inline_1312 )), - (injectedHook = hook$jscomp$inline_1314); + (injectedHook = hook$jscomp$inline_1313); } catch (err) {} } var Path = Mode$1.Path; diff --git a/compiled/facebook-www/ReactDOM-dev.classic.js b/compiled/facebook-www/ReactDOM-dev.classic.js index e9065a3ad7894..d813bc54f9f70 100644 --- a/compiled/facebook-www/ReactDOM-dev.classic.js +++ b/compiled/facebook-www/ReactDOM-dev.classic.js @@ -40,6 +40,8 @@ var disableInputAttributeSyncing = disableIEWorkarounds = dynamicFeatureFlags.disableIEWorkarounds, enableTrustedTypesIntegration = dynamicFeatureFlags.enableTrustedTypesIntegration, + revertRemovalOfSiblingPrerendering = + dynamicFeatureFlags.revertRemovalOfSiblingPrerendering, replayFailedUnitOfWorkWithInvokeGuardedCallback = dynamicFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback, enableLegacyFBSupport = dynamicFeatureFlags.enableLegacyFBSupport, @@ -35843,10 +35845,10 @@ function renderRootSync(root, lanes) { } default: { - // Continue with the normal work loop. + // Unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } } @@ -35953,7 +35955,7 @@ function renderRootConcurrent(root, lanes) { // Unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -36018,7 +36020,7 @@ function renderRootConcurrent(root, lanes) { // Otherwise, unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); } break; @@ -36083,7 +36085,7 @@ function renderRootConcurrent(root, lanes) { workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -36094,7 +36096,7 @@ function renderRootConcurrent(root, lanes) { // always unwind. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -36297,7 +36299,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { ReactCurrentOwner$1.current = null; } -function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { // This is a fork of performUnitOfWork specifcally for unwinding a fiber // that threw an exception. // @@ -36340,9 +36342,23 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { // To prevent an infinite loop, bubble the error up to the next parent. workInProgress = returnFiber; throw error; - } // Return to the normal work loop. + } - completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & Incomplete) { + // Unwind the stack until we reach the nearest boundary. + unwindUnitOfWork(unitOfWork); + } else { + // Although the fiber suspended, we're intentionally going to commit it in + // an inconsistent state. We can do this safely in cases where we know the + // inconsistent tree will be hidden. + // + // This currently only applies to Legacy Suspense implementation, but we may + // port a version of this to concurrent roots, too, when performing a + // synchronous render. Because that will allow us to mutate the tree as we + // go instead of buffering mutations until the end. Though it's unclear if + // this particular path is how that would be implemented. + completeUnitOfWork(unitOfWork); + } } function completeUnitOfWork(unitOfWork) { @@ -36351,75 +36367,53 @@ function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { - // The current, flushed, state of this fiber is the alternate. Ideally - // nothing should rely on this, but relying on it here means that we don't - // need an additional field on the work in progress. - var current = completedWork.alternate; - var returnFiber = completedWork.return; // Check if the work completed or if something threw. - - if ((completedWork.flags & Incomplete) === NoFlags$1) { - setCurrentFiber(completedWork); - var next = void 0; - - if ((completedWork.mode & ProfileMode) === NoMode) { - next = completeWork(current, completedWork, renderLanes); - } else { - startProfilerTimer(completedWork); - next = completeWork(current, completedWork, renderLanes); // Update render duration assuming we didn't error. - - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); - } - - resetCurrentFiber(); - - if (next !== null) { - // Completing this fiber spawned new work. Work on that next. - workInProgress = next; + if (revertRemovalOfSiblingPrerendering) { + if ((completedWork.flags & Incomplete) !== NoFlags$1) { + // This fiber did not complete, because one of its children did not + // complete. Switch to unwinding the stack instead of completing it. + // + // The reason "unwind" and "complete" is interleaved is because when + // something suspends, we continue rendering the siblings even though + // they will be replaced by a fallback. + // TODO: Disable sibling prerendering, then remove this branch. + unwindUnitOfWork(completedWork); return; } } else { - // This fiber did not complete because something threw. Pop values off - // the stack without entering the complete phase. If this is a boundary, - // capture values if possible. - var _next = unwindWork(current, completedWork); // Because this fiber did not complete, don't reset its lanes. - - if (_next !== null) { - // If completing this work spawned new work, do that next. We'll come - // back here again. - // Since we're restarting, remove anything that is not a host effect - // from the effect tag. - _next.flags &= HostEffectMask; - workInProgress = _next; - return; + { + if ((completedWork.flags & Incomplete) !== NoFlags$1) { + // NOTE: If we re-enable sibling prerendering in some cases, this branch + // is where we would switch to the unwinding path. + error( + "Internal React error: Expected this fiber to be complete, but " + + "it isn't. It should have been unwound. This is a bug in React." + ); + } } + } // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. - if ((completedWork.mode & ProfileMode) !== NoMode) { - // Record the render duration for the fiber that errored. - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing. + var current = completedWork.alternate; + var returnFiber = completedWork.return; + setCurrentFiber(completedWork); + var next = void 0; - var actualDuration = completedWork.actualDuration; - var child = completedWork.child; + if ((completedWork.mode & ProfileMode) === NoMode) { + next = completeWork(current, completedWork, renderLanes); + } else { + startProfilerTimer(completedWork); + next = completeWork(current, completedWork, renderLanes); // Update render duration assuming we didn't error. - while (child !== null) { - // $FlowFixMe[unsafe-addition] addition with possible null/undefined value - actualDuration += child.actualDuration; - child = child.sibling; - } + stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); + } - completedWork.actualDuration = actualDuration; - } + resetCurrentFiber(); - if (returnFiber !== null) { - // Mark the parent fiber as incomplete and clear its subtree flags. - returnFiber.flags |= Incomplete; - returnFiber.subtreeFlags = NoFlags$1; - returnFiber.deletions = null; - } else { - // We've unwound all the way to the root. - workInProgressRootExitStatus = RootDidNotComplete; - workInProgress = null; - return; - } + if (next !== null) { + // Completing this fiber spawned new work. Work on that next. + workInProgress = next; + return; } var siblingFiber = completedWork.sibling; @@ -36441,6 +36435,86 @@ function completeUnitOfWork(unitOfWork) { } } +function unwindUnitOfWork(unitOfWork) { + var incompleteWork = unitOfWork; + + do { + // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. + var current = incompleteWork.alternate; // This fiber did not complete because something threw. Pop values off + // the stack without entering the complete phase. If this is a boundary, + // capture values if possible. + + var next = unwindWork(current, incompleteWork); // Because this fiber did not complete, don't reset its lanes. + + if (next !== null) { + // Found a boundary that can handle this exception. Re-renter the + // begin phase. This branch will return us to the normal work loop. + // + // Since we're restarting, remove anything that is not a host effect + // from the effect tag. + next.flags &= HostEffectMask; + workInProgress = next; + return; + } // Keep unwinding until we reach either a boundary or the root. + + if ((incompleteWork.mode & ProfileMode) !== NoMode) { + // Record the render duration for the fiber that errored. + stopProfilerTimerIfRunningAndRecordDelta(incompleteWork, false); // Include the time spent working on failed children before continuing. + + var actualDuration = incompleteWork.actualDuration; + var child = incompleteWork.child; + + while (child !== null) { + // $FlowFixMe[unsafe-addition] addition with possible null/undefined value + actualDuration += child.actualDuration; + child = child.sibling; + } + + incompleteWork.actualDuration = actualDuration; + } // TODO: Once we stop prerendering siblings, instead of resetting the parent + // of the node being unwound, we should be able to reset node itself as we + // unwind the stack. Saves an additional null check. + + var returnFiber = incompleteWork.return; + + if (returnFiber !== null) { + // Mark the parent fiber as incomplete and clear its subtree flags. + // TODO: Once we stop prerendering siblings, we may be able to get rid of + // the Incomplete flag because unwinding to the nearest boundary will + // happen synchronously. + returnFiber.flags |= Incomplete; + returnFiber.subtreeFlags = NoFlags$1; + returnFiber.deletions = null; + } + + if (revertRemovalOfSiblingPrerendering) { + // If there are siblings, work on them now even though they're going to be + // replaced by a fallback. We're "prerendering" them. Historically our + // rationale for this behavior has been to initiate any lazy data requests + // in the siblings, and also to warm up the CPU cache. + // TODO: Don't prerender siblings. With `use`, we suspend the work loop + // until the data has resolved, anyway. + var siblingFiber = incompleteWork.sibling; + + if (siblingFiber !== null) { + // This branch will return us to the normal work loop. + workInProgress = siblingFiber; + return; + } + } // Otherwise, return to the parent + // $FlowFixMe[incompatible-type] we bail out when we get a null + + incompleteWork = returnFiber; // Update the next thing we're working on in case something throws. + + workInProgress = incompleteWork; + } while (incompleteWork !== null); // We've unwound all the way to the root. + + workInProgressRootExitStatus = RootDidNotComplete; + workInProgress = null; +} + function commitRoot(root, recoverableErrors, transitions) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. @@ -39067,7 +39141,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-1e6d53e8"; +var ReactVersion = "18.3.0-www-classic-877581fc"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOM-dev.modern.js b/compiled/facebook-www/ReactDOM-dev.modern.js index 95618cce8e728..5c78f7a79f353 100644 --- a/compiled/facebook-www/ReactDOM-dev.modern.js +++ b/compiled/facebook-www/ReactDOM-dev.modern.js @@ -144,6 +144,8 @@ var disableInputAttributeSyncing = disableIEWorkarounds = dynamicFeatureFlags.disableIEWorkarounds, enableTrustedTypesIntegration = dynamicFeatureFlags.enableTrustedTypesIntegration, + revertRemovalOfSiblingPrerendering = + dynamicFeatureFlags.revertRemovalOfSiblingPrerendering, replayFailedUnitOfWorkWithInvokeGuardedCallback = dynamicFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback, enableLegacyFBSupport = dynamicFeatureFlags.enableLegacyFBSupport, @@ -30209,10 +30211,10 @@ function renderRootSync(root, lanes) { } default: { - // Continue with the normal work loop. + // Unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } } @@ -30319,7 +30321,7 @@ function renderRootConcurrent(root, lanes) { // Unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -30384,7 +30386,7 @@ function renderRootConcurrent(root, lanes) { // Otherwise, unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); } break; @@ -30449,7 +30451,7 @@ function renderRootConcurrent(root, lanes) { workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -30460,7 +30462,7 @@ function renderRootConcurrent(root, lanes) { // always unwind. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -30663,7 +30665,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { ReactCurrentOwner.current = null; } -function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { // This is a fork of performUnitOfWork specifcally for unwinding a fiber // that threw an exception. // @@ -30706,9 +30708,23 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { // To prevent an infinite loop, bubble the error up to the next parent. workInProgress = returnFiber; throw error; - } // Return to the normal work loop. + } - completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & Incomplete) { + // Unwind the stack until we reach the nearest boundary. + unwindUnitOfWork(unitOfWork); + } else { + // Although the fiber suspended, we're intentionally going to commit it in + // an inconsistent state. We can do this safely in cases where we know the + // inconsistent tree will be hidden. + // + // This currently only applies to Legacy Suspense implementation, but we may + // port a version of this to concurrent roots, too, when performing a + // synchronous render. Because that will allow us to mutate the tree as we + // go instead of buffering mutations until the end. Though it's unclear if + // this particular path is how that would be implemented. + completeUnitOfWork(unitOfWork); + } } function completeUnitOfWork(unitOfWork) { @@ -30717,75 +30733,53 @@ function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { - // The current, flushed, state of this fiber is the alternate. Ideally - // nothing should rely on this, but relying on it here means that we don't - // need an additional field on the work in progress. - var current = completedWork.alternate; - var returnFiber = completedWork.return; // Check if the work completed or if something threw. - - if ((completedWork.flags & Incomplete) === NoFlags$1) { - setCurrentFiber(completedWork); - var next = void 0; - - if ((completedWork.mode & ProfileMode) === NoMode) { - next = completeWork(current, completedWork, renderLanes); - } else { - startProfilerTimer(completedWork); - next = completeWork(current, completedWork, renderLanes); // Update render duration assuming we didn't error. - - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); - } - - resetCurrentFiber(); - - if (next !== null) { - // Completing this fiber spawned new work. Work on that next. - workInProgress = next; + if (revertRemovalOfSiblingPrerendering) { + if ((completedWork.flags & Incomplete) !== NoFlags$1) { + // This fiber did not complete, because one of its children did not + // complete. Switch to unwinding the stack instead of completing it. + // + // The reason "unwind" and "complete" is interleaved is because when + // something suspends, we continue rendering the siblings even though + // they will be replaced by a fallback. + // TODO: Disable sibling prerendering, then remove this branch. + unwindUnitOfWork(completedWork); return; } } else { - // This fiber did not complete because something threw. Pop values off - // the stack without entering the complete phase. If this is a boundary, - // capture values if possible. - var _next = unwindWork(current, completedWork); // Because this fiber did not complete, don't reset its lanes. - - if (_next !== null) { - // If completing this work spawned new work, do that next. We'll come - // back here again. - // Since we're restarting, remove anything that is not a host effect - // from the effect tag. - _next.flags &= HostEffectMask; - workInProgress = _next; - return; + { + if ((completedWork.flags & Incomplete) !== NoFlags$1) { + // NOTE: If we re-enable sibling prerendering in some cases, this branch + // is where we would switch to the unwinding path. + error( + "Internal React error: Expected this fiber to be complete, but " + + "it isn't. It should have been unwound. This is a bug in React." + ); + } } + } // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. - if ((completedWork.mode & ProfileMode) !== NoMode) { - // Record the render duration for the fiber that errored. - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing. + var current = completedWork.alternate; + var returnFiber = completedWork.return; + setCurrentFiber(completedWork); + var next = void 0; - var actualDuration = completedWork.actualDuration; - var child = completedWork.child; + if ((completedWork.mode & ProfileMode) === NoMode) { + next = completeWork(current, completedWork, renderLanes); + } else { + startProfilerTimer(completedWork); + next = completeWork(current, completedWork, renderLanes); // Update render duration assuming we didn't error. - while (child !== null) { - // $FlowFixMe[unsafe-addition] addition with possible null/undefined value - actualDuration += child.actualDuration; - child = child.sibling; - } + stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); + } - completedWork.actualDuration = actualDuration; - } + resetCurrentFiber(); - if (returnFiber !== null) { - // Mark the parent fiber as incomplete and clear its subtree flags. - returnFiber.flags |= Incomplete; - returnFiber.subtreeFlags = NoFlags$1; - returnFiber.deletions = null; - } else { - // We've unwound all the way to the root. - workInProgressRootExitStatus = RootDidNotComplete; - workInProgress = null; - return; - } + if (next !== null) { + // Completing this fiber spawned new work. Work on that next. + workInProgress = next; + return; } var siblingFiber = completedWork.sibling; @@ -30807,6 +30801,86 @@ function completeUnitOfWork(unitOfWork) { } } +function unwindUnitOfWork(unitOfWork) { + var incompleteWork = unitOfWork; + + do { + // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. + var current = incompleteWork.alternate; // This fiber did not complete because something threw. Pop values off + // the stack without entering the complete phase. If this is a boundary, + // capture values if possible. + + var next = unwindWork(current, incompleteWork); // Because this fiber did not complete, don't reset its lanes. + + if (next !== null) { + // Found a boundary that can handle this exception. Re-renter the + // begin phase. This branch will return us to the normal work loop. + // + // Since we're restarting, remove anything that is not a host effect + // from the effect tag. + next.flags &= HostEffectMask; + workInProgress = next; + return; + } // Keep unwinding until we reach either a boundary or the root. + + if ((incompleteWork.mode & ProfileMode) !== NoMode) { + // Record the render duration for the fiber that errored. + stopProfilerTimerIfRunningAndRecordDelta(incompleteWork, false); // Include the time spent working on failed children before continuing. + + var actualDuration = incompleteWork.actualDuration; + var child = incompleteWork.child; + + while (child !== null) { + // $FlowFixMe[unsafe-addition] addition with possible null/undefined value + actualDuration += child.actualDuration; + child = child.sibling; + } + + incompleteWork.actualDuration = actualDuration; + } // TODO: Once we stop prerendering siblings, instead of resetting the parent + // of the node being unwound, we should be able to reset node itself as we + // unwind the stack. Saves an additional null check. + + var returnFiber = incompleteWork.return; + + if (returnFiber !== null) { + // Mark the parent fiber as incomplete and clear its subtree flags. + // TODO: Once we stop prerendering siblings, we may be able to get rid of + // the Incomplete flag because unwinding to the nearest boundary will + // happen synchronously. + returnFiber.flags |= Incomplete; + returnFiber.subtreeFlags = NoFlags$1; + returnFiber.deletions = null; + } + + if (revertRemovalOfSiblingPrerendering) { + // If there are siblings, work on them now even though they're going to be + // replaced by a fallback. We're "prerendering" them. Historically our + // rationale for this behavior has been to initiate any lazy data requests + // in the siblings, and also to warm up the CPU cache. + // TODO: Don't prerender siblings. With `use`, we suspend the work loop + // until the data has resolved, anyway. + var siblingFiber = incompleteWork.sibling; + + if (siblingFiber !== null) { + // This branch will return us to the normal work loop. + workInProgress = siblingFiber; + return; + } + } // Otherwise, return to the parent + // $FlowFixMe[incompatible-type] we bail out when we get a null + + incompleteWork = returnFiber; // Update the next thing we're working on in case something throws. + + workInProgress = incompleteWork; + } while (incompleteWork !== null); // We've unwound all the way to the root. + + workInProgressRootExitStatus = RootDidNotComplete; + workInProgress = null; +} + function commitRoot(root, recoverableErrors, transitions) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. @@ -33433,7 +33507,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-86a50993"; +var ReactVersion = "18.3.0-www-modern-05e288bd"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOM-prod.classic.js b/compiled/facebook-www/ReactDOM-prod.classic.js index f5d2154eccdf3..e9d862a06e651 100644 --- a/compiled/facebook-www/ReactDOM-prod.classic.js +++ b/compiled/facebook-www/ReactDOM-prod.classic.js @@ -23,6 +23,8 @@ var Scheduler = require("scheduler"), disableIEWorkarounds = dynamicFeatureFlags.disableIEWorkarounds, enableTrustedTypesIntegration = dynamicFeatureFlags.enableTrustedTypesIntegration, + revertRemovalOfSiblingPrerendering = + dynamicFeatureFlags.revertRemovalOfSiblingPrerendering, enableLegacyFBSupport = dynamicFeatureFlags.enableLegacyFBSupport, deferRenderPhaseUpdateToNextBatch = dynamicFeatureFlags.deferRenderPhaseUpdateToNextBatch, @@ -11520,7 +11522,7 @@ function renderRootSync(root, lanes) { default: (workInProgressSuspendedReason = 0), (workInProgressThrownValue = null), - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); } } workLoopSync(); @@ -11562,7 +11564,7 @@ function renderRootConcurrent(root, lanes) { case 1: workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 2: if (isThenableResolved(thrownValue)) { @@ -11592,7 +11594,7 @@ function renderRootConcurrent(root, lanes) { replaySuspendedUnitOfWork(lanes)) : ((workInProgressSuspendedReason = 0), (workInProgressThrownValue = null), - unwindSuspendedUnitOfWork(lanes, thrownValue)); + throwAndUnwindWorkLoop(lanes, thrownValue)); break; case 5: switch (workInProgress.tag) { @@ -11615,12 +11617,12 @@ function renderRootConcurrent(root, lanes) { } workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 6: workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 8: resetWorkInProgressStack(); @@ -11700,7 +11702,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { : (workInProgress = current); ReactCurrentOwner.current = null; } -function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { resetContextDependencies(); resetHooksOnUnwind(); thenableState$1 = null; @@ -11870,38 +11872,30 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { } catch (error) { throw ((workInProgress = returnFiber), error); } - completeUnitOfWork(unitOfWork); + unitOfWork.flags & 32768 + ? unwindUnitOfWork(unitOfWork) + : completeUnitOfWork(unitOfWork); } } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { - var current = completedWork.alternate; + if ( + revertRemovalOfSiblingPrerendering && + 0 !== (completedWork.flags & 32768) + ) { + unwindUnitOfWork(completedWork); + return; + } unitOfWork = completedWork.return; - if (0 === (completedWork.flags & 32768)) { - if ( - ((current = completeWork(current, completedWork, renderLanes)), - null !== current) - ) { - workInProgress = current; - return; - } - } else { - current = unwindWork(current, completedWork); - if (null !== current) { - current.flags &= 32767; - workInProgress = current; - return; - } - if (null !== unitOfWork) - (unitOfWork.flags |= 32768), - (unitOfWork.subtreeFlags = 0), - (unitOfWork.deletions = null); - else { - workInProgressRootExitStatus = 6; - workInProgress = null; - return; - } + var next = completeWork( + completedWork.alternate, + completedWork, + renderLanes + ); + if (null !== next) { + workInProgress = next; + return; } completedWork = completedWork.sibling; if (null !== completedWork) { @@ -11912,6 +11906,29 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } +function unwindUnitOfWork(unitOfWork) { + do { + var next = unwindWork(unitOfWork.alternate, unitOfWork); + if (null !== next) { + next.flags &= 32767; + workInProgress = next; + return; + } + next = unitOfWork.return; + null !== next && + ((next.flags |= 32768), (next.subtreeFlags = 0), (next.deletions = null)); + if ( + revertRemovalOfSiblingPrerendering && + ((unitOfWork = unitOfWork.sibling), null !== unitOfWork) + ) { + workInProgress = unitOfWork; + return; + } + workInProgress = unitOfWork = next; + } while (null !== unitOfWork); + workInProgressRootExitStatus = 6; + workInProgress = null; +} function commitRoot(root, recoverableErrors, transitions) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig$1.transition; @@ -11973,12 +11990,12 @@ function commitRootImpl( var prevExecutionContext = executionContext; executionContext |= 4; ReactCurrentOwner.current = null; - var shouldFireAfterActiveInstanceBlur$211 = commitBeforeMutationEffects( + var shouldFireAfterActiveInstanceBlur$210 = commitBeforeMutationEffects( root, finishedWork ); commitMutationEffectsOnFiber(finishedWork, root); - shouldFireAfterActiveInstanceBlur$211 && + shouldFireAfterActiveInstanceBlur$210 && ((_enabled = !0), dispatchAfterDetachedBlur(selectionInformation.focusedElem), (_enabled = !1)); @@ -12057,7 +12074,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects() { if (null !== rootWithPendingPassiveEffects) { - var root$212 = rootWithPendingPassiveEffects, + var root$211 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes); @@ -12073,7 +12090,7 @@ function flushPassiveEffects() { } finally { (currentUpdatePriority = previousPriority), (ReactCurrentBatchConfig$1.transition = prevTransition), - releaseRootPooledCache(root$212, remainingLanes); + releaseRootPooledCache(root$211, remainingLanes); } } return !1; @@ -13380,12 +13397,12 @@ function getPublicRootInstance(container) { function attemptSynchronousHydration(fiber) { switch (fiber.tag) { case 3: - var root$214 = fiber.stateNode; - if (root$214.current.memoizedState.isDehydrated) { - var lanes = getHighestPriorityLanes(root$214.pendingLanes); + var root$213 = fiber.stateNode; + if (root$213.current.memoizedState.isDehydrated) { + var lanes = getHighestPriorityLanes(root$213.pendingLanes); 0 !== lanes && - (markRootEntangled(root$214, lanes | 2), - ensureRootIsScheduled(root$214, now()), + (markRootEntangled(root$213, lanes | 2), + ensureRootIsScheduled(root$213, now()), 0 === (executionContext & 6) && ((workInProgressRootRenderTargetTime = now() + 500), flushSyncCallbacks())); @@ -13957,19 +13974,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$316; + var JSCompiler_inline_result$jscomp$315; if (canUseDOM) { - var isSupported$jscomp$inline_1607 = "oninput" in document; - if (!isSupported$jscomp$inline_1607) { - var element$jscomp$inline_1608 = document.createElement("div"); - element$jscomp$inline_1608.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1607 = - "function" === typeof element$jscomp$inline_1608.oninput; + var isSupported$jscomp$inline_1606 = "oninput" in document; + if (!isSupported$jscomp$inline_1606) { + var element$jscomp$inline_1607 = document.createElement("div"); + element$jscomp$inline_1607.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1606 = + "function" === typeof element$jscomp$inline_1607.oninput; } - JSCompiler_inline_result$jscomp$316 = isSupported$jscomp$inline_1607; - } else JSCompiler_inline_result$jscomp$316 = !1; + JSCompiler_inline_result$jscomp$315 = isSupported$jscomp$inline_1606; + } else JSCompiler_inline_result$jscomp$315 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$316 && + JSCompiler_inline_result$jscomp$315 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -14107,20 +14124,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1620 = 0; - i$jscomp$inline_1620 < simpleEventPluginEvents.length; - i$jscomp$inline_1620++ + var i$jscomp$inline_1619 = 0; + i$jscomp$inline_1619 < simpleEventPluginEvents.length; + i$jscomp$inline_1619++ ) { - var eventName$jscomp$inline_1621 = - simpleEventPluginEvents[i$jscomp$inline_1620], - domEventName$jscomp$inline_1622 = - eventName$jscomp$inline_1621.toLowerCase(), - capitalizedEvent$jscomp$inline_1623 = - eventName$jscomp$inline_1621[0].toUpperCase() + - eventName$jscomp$inline_1621.slice(1); + var eventName$jscomp$inline_1620 = + simpleEventPluginEvents[i$jscomp$inline_1619], + domEventName$jscomp$inline_1621 = + eventName$jscomp$inline_1620.toLowerCase(), + capitalizedEvent$jscomp$inline_1622 = + eventName$jscomp$inline_1620[0].toUpperCase() + + eventName$jscomp$inline_1620.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1622, - "on" + capitalizedEvent$jscomp$inline_1623 + domEventName$jscomp$inline_1621, + "on" + capitalizedEvent$jscomp$inline_1622 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -15699,11 +15716,11 @@ function legacyCreateRootFromDOMContainer( if ("function" === typeof callback) { var originalCallback = callback; callback = function () { - var instance = getPublicRootInstance(root$229); + var instance = getPublicRootInstance(root$228); originalCallback.call(instance); }; } - var root$229 = createHydrationContainer( + var root$228 = createHydrationContainer( initialChildren, callback, container, @@ -15715,23 +15732,23 @@ function legacyCreateRootFromDOMContainer( noopOnRecoverableError, null ); - container._reactRootContainer = root$229; - container[internalContainerInstanceKey] = root$229.current; + container._reactRootContainer = root$228; + container[internalContainerInstanceKey] = root$228.current; listenToAllSupportedEvents( 8 === container.nodeType ? container.parentNode : container ); flushSync$1(); - return root$229; + return root$228; } clearContainer(container); if ("function" === typeof callback) { - var originalCallback$230 = callback; + var originalCallback$229 = callback; callback = function () { - var instance = getPublicRootInstance(root$231); - originalCallback$230.call(instance); + var instance = getPublicRootInstance(root$230); + originalCallback$229.call(instance); }; } - var root$231 = createFiberRoot( + var root$230 = createFiberRoot( container, 0, !1, @@ -15743,15 +15760,15 @@ function legacyCreateRootFromDOMContainer( noopOnRecoverableError, null ); - container._reactRootContainer = root$231; - container[internalContainerInstanceKey] = root$231.current; + container._reactRootContainer = root$230; + container[internalContainerInstanceKey] = root$230.current; listenToAllSupportedEvents( 8 === container.nodeType ? container.parentNode : container ); flushSync$1(function () { - updateContainer(initialChildren, root$231, parentComponent, callback); + updateContainer(initialChildren, root$230, parentComponent, callback); }); - return root$231; + return root$230; } function legacyRenderSubtreeIntoContainer( parentComponent, @@ -15810,17 +15827,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1776 = { +var devToolsConfig$jscomp$inline_1775 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-51aa2339", + version: "18.3.0-www-classic-e2239d71", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2156 = { - bundleType: devToolsConfig$jscomp$inline_1776.bundleType, - version: devToolsConfig$jscomp$inline_1776.version, - rendererPackageName: devToolsConfig$jscomp$inline_1776.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1776.rendererConfig, +var internals$jscomp$inline_2155 = { + bundleType: devToolsConfig$jscomp$inline_1775.bundleType, + version: devToolsConfig$jscomp$inline_1775.version, + rendererPackageName: devToolsConfig$jscomp$inline_1775.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1775.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -15836,26 +15853,26 @@ var internals$jscomp$inline_2156 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1776.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1775.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-51aa2339" + reconcilerVersion: "18.3.0-www-classic-e2239d71" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2157 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2156 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2157.isDisabled && - hook$jscomp$inline_2157.supportsFiber + !hook$jscomp$inline_2156.isDisabled && + hook$jscomp$inline_2156.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2157.inject( - internals$jscomp$inline_2156 + (rendererID = hook$jscomp$inline_2156.inject( + internals$jscomp$inline_2155 )), - (injectedHook = hook$jscomp$inline_2157); + (injectedHook = hook$jscomp$inline_2156); } catch (err) {} } assign(Internals, { @@ -16083,4 +16100,4 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-classic-51aa2339"; +exports.version = "18.3.0-www-classic-e2239d71"; diff --git a/compiled/facebook-www/ReactDOM-prod.modern.js b/compiled/facebook-www/ReactDOM-prod.modern.js index 4a3a9c60b2170..f5eada7e6af5a 100644 --- a/compiled/facebook-www/ReactDOM-prod.modern.js +++ b/compiled/facebook-www/ReactDOM-prod.modern.js @@ -43,6 +43,8 @@ var dynamicFeatureFlags = require("ReactFeatureFlags"), disableIEWorkarounds = dynamicFeatureFlags.disableIEWorkarounds, enableTrustedTypesIntegration = dynamicFeatureFlags.enableTrustedTypesIntegration, + revertRemovalOfSiblingPrerendering = + dynamicFeatureFlags.revertRemovalOfSiblingPrerendering, enableLegacyFBSupport = dynamicFeatureFlags.enableLegacyFBSupport, deferRenderPhaseUpdateToNextBatch = dynamicFeatureFlags.deferRenderPhaseUpdateToNextBatch, @@ -7260,7 +7262,7 @@ function commitBeforeMutationEffects(root, firstChild) { selection = selection.focusOffset; try { JSCompiler_temp.nodeType, focusNode.nodeType; - } catch (e$189) { + } catch (e$188) { JSCompiler_temp = null; break a; } @@ -10135,7 +10137,7 @@ function renderRootSync(root, lanes) { default: (workInProgressSuspendedReason = 0), (workInProgressThrownValue = null), - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); } } workLoopSync(); @@ -10177,7 +10179,7 @@ function renderRootConcurrent(root, lanes) { case 1: workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 2: if (isThenableResolved(thrownValue)) { @@ -10207,7 +10209,7 @@ function renderRootConcurrent(root, lanes) { replaySuspendedUnitOfWork(lanes)) : ((workInProgressSuspendedReason = 0), (workInProgressThrownValue = null), - unwindSuspendedUnitOfWork(lanes, thrownValue)); + throwAndUnwindWorkLoop(lanes, thrownValue)); break; case 5: switch (workInProgress.tag) { @@ -10230,12 +10232,12 @@ function renderRootConcurrent(root, lanes) { } workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 6: workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 8: resetWorkInProgressStack(); @@ -10315,7 +10317,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { : (workInProgress = current); ReactCurrentOwner.current = null; } -function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { resetContextDependencies(); resetHooksOnUnwind(); thenableState$1 = null; @@ -10485,38 +10487,30 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { } catch (error) { throw ((workInProgress = returnFiber), error); } - completeUnitOfWork(unitOfWork); + unitOfWork.flags & 32768 + ? unwindUnitOfWork(unitOfWork) + : completeUnitOfWork(unitOfWork); } } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { - var current = completedWork.alternate; + if ( + revertRemovalOfSiblingPrerendering && + 0 !== (completedWork.flags & 32768) + ) { + unwindUnitOfWork(completedWork); + return; + } unitOfWork = completedWork.return; - if (0 === (completedWork.flags & 32768)) { - if ( - ((current = completeWork(current, completedWork, renderLanes)), - null !== current) - ) { - workInProgress = current; - return; - } - } else { - current = unwindWork(current, completedWork); - if (null !== current) { - current.flags &= 32767; - workInProgress = current; - return; - } - if (null !== unitOfWork) - (unitOfWork.flags |= 32768), - (unitOfWork.subtreeFlags = 0), - (unitOfWork.deletions = null); - else { - workInProgressRootExitStatus = 6; - workInProgress = null; - return; - } + var next = completeWork( + completedWork.alternate, + completedWork, + renderLanes + ); + if (null !== next) { + workInProgress = next; + return; } completedWork = completedWork.sibling; if (null !== completedWork) { @@ -10527,6 +10521,29 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } +function unwindUnitOfWork(unitOfWork) { + do { + var next = unwindWork(unitOfWork.alternate, unitOfWork); + if (null !== next) { + next.flags &= 32767; + workInProgress = next; + return; + } + next = unitOfWork.return; + null !== next && + ((next.flags |= 32768), (next.subtreeFlags = 0), (next.deletions = null)); + if ( + revertRemovalOfSiblingPrerendering && + ((unitOfWork = unitOfWork.sibling), null !== unitOfWork) + ) { + workInProgress = unitOfWork; + return; + } + workInProgress = unitOfWork = next; + } while (null !== unitOfWork); + workInProgressRootExitStatus = 6; + workInProgress = null; +} function commitRoot(root, recoverableErrors, transitions) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig$1.transition; @@ -10588,12 +10605,12 @@ function commitRootImpl( var prevExecutionContext = executionContext; executionContext |= 4; ReactCurrentOwner.current = null; - var shouldFireAfterActiveInstanceBlur$178 = commitBeforeMutationEffects( + var shouldFireAfterActiveInstanceBlur$177 = commitBeforeMutationEffects( root, finishedWork ); commitMutationEffectsOnFiber(finishedWork, root); - shouldFireAfterActiveInstanceBlur$178 && + shouldFireAfterActiveInstanceBlur$177 && ((_enabled = !0), dispatchAfterDetachedBlur(selectionInformation.focusedElem), (_enabled = !1)); @@ -10672,7 +10689,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects() { if (null !== rootWithPendingPassiveEffects) { - var root$179 = rootWithPendingPassiveEffects, + var root$178 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes); @@ -10688,7 +10705,7 @@ function flushPassiveEffects() { } finally { (currentUpdatePriority = previousPriority), (ReactCurrentBatchConfig$1.transition = prevTransition), - releaseRootPooledCache(root$179, remainingLanes); + releaseRootPooledCache(root$178, remainingLanes); } } return !1; @@ -11881,12 +11898,12 @@ function updateContainer(element, container, parentComponent, callback) { function attemptSynchronousHydration(fiber) { switch (fiber.tag) { case 3: - var root$181 = fiber.stateNode; - if (root$181.current.memoizedState.isDehydrated) { - var lanes = getHighestPriorityLanes(root$181.pendingLanes); + var root$180 = fiber.stateNode; + if (root$180.current.memoizedState.isDehydrated) { + var lanes = getHighestPriorityLanes(root$180.pendingLanes); 0 !== lanes && - (markRootEntangled(root$181, lanes | 2), - ensureRootIsScheduled(root$181, now()), + (markRootEntangled(root$180, lanes | 2), + ensureRootIsScheduled(root$180, now()), 0 === (executionContext & 6) && ((workInProgressRootRenderTargetTime = now() + 500), flushSyncCallbacks())); @@ -13160,19 +13177,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$299; + var JSCompiler_inline_result$jscomp$298; if (canUseDOM) { - var isSupported$jscomp$inline_1526 = "oninput" in document; - if (!isSupported$jscomp$inline_1526) { - var element$jscomp$inline_1527 = document.createElement("div"); - element$jscomp$inline_1527.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1526 = - "function" === typeof element$jscomp$inline_1527.oninput; + var isSupported$jscomp$inline_1525 = "oninput" in document; + if (!isSupported$jscomp$inline_1525) { + var element$jscomp$inline_1526 = document.createElement("div"); + element$jscomp$inline_1526.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1525 = + "function" === typeof element$jscomp$inline_1526.oninput; } - JSCompiler_inline_result$jscomp$299 = isSupported$jscomp$inline_1526; - } else JSCompiler_inline_result$jscomp$299 = !1; + JSCompiler_inline_result$jscomp$298 = isSupported$jscomp$inline_1525; + } else JSCompiler_inline_result$jscomp$298 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$299 && + JSCompiler_inline_result$jscomp$298 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -13481,20 +13498,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1567 = 0; - i$jscomp$inline_1567 < simpleEventPluginEvents.length; - i$jscomp$inline_1567++ + var i$jscomp$inline_1566 = 0; + i$jscomp$inline_1566 < simpleEventPluginEvents.length; + i$jscomp$inline_1566++ ) { - var eventName$jscomp$inline_1568 = - simpleEventPluginEvents[i$jscomp$inline_1567], - domEventName$jscomp$inline_1569 = - eventName$jscomp$inline_1568.toLowerCase(), - capitalizedEvent$jscomp$inline_1570 = - eventName$jscomp$inline_1568[0].toUpperCase() + - eventName$jscomp$inline_1568.slice(1); + var eventName$jscomp$inline_1567 = + simpleEventPluginEvents[i$jscomp$inline_1566], + domEventName$jscomp$inline_1568 = + eventName$jscomp$inline_1567.toLowerCase(), + capitalizedEvent$jscomp$inline_1569 = + eventName$jscomp$inline_1567[0].toUpperCase() + + eventName$jscomp$inline_1567.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1569, - "on" + capitalizedEvent$jscomp$inline_1570 + domEventName$jscomp$inline_1568, + "on" + capitalizedEvent$jscomp$inline_1569 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -14685,12 +14702,12 @@ function preinit$1(href, options) { switch (as) { case "style": as = getResourcesFromRoot(resourceRoot).hoistableStyles; - var key$201 = getStyleKey(href), + var key$200 = getStyleKey(href), precedence = options.precedence || "default", - resource = as.get(key$201); + resource = as.get(key$200); if (resource) break; resource = resourceRoot.querySelector( - getStylesheetSelectorFromKey(key$201) + getStylesheetSelectorFromKey(key$200) ); resource || ((href = { @@ -14699,7 +14716,7 @@ function preinit$1(href, options) { "data-precedence": precedence, crossOrigin: options.crossOrigin }), - (options = preloadPropsMap.get(key$201)) && + (options = preloadPropsMap.get(key$200)) && adoptPreloadPropsForStylesheet(href, options), (resource = ( resourceRoot.ownerDocument || resourceRoot @@ -14708,15 +14725,15 @@ function preinit$1(href, options) { setInitialProperties(resource, "link", href), insertStylesheet(resource, precedence, resourceRoot)); resource = { type: "stylesheet", instance: resource, count: 1 }; - as.set(key$201, resource); + as.set(key$200, resource); break; case "script": (as = getResourcesFromRoot(resourceRoot).hoistableScripts), - (key$201 = getScriptKey(href)), - (precedence = as.get(key$201)), + (key$200 = getScriptKey(href)), + (precedence = as.get(key$200)), precedence || ((precedence = resourceRoot.querySelector( - "script[async]" + key$201 + "script[async]" + key$200 )), precedence || ((href = { @@ -14725,7 +14742,7 @@ function preinit$1(href, options) { crossOrigin: options.crossOrigin, integrity: options.integrity }), - (options = preloadPropsMap.get(key$201)) && + (options = preloadPropsMap.get(key$200)) && adoptPreloadPropsForScript(href, options), (options = resourceRoot.ownerDocument || resourceRoot), (precedence = options.createElement("script")), @@ -14733,13 +14750,13 @@ function preinit$1(href, options) { setInitialProperties(precedence, "link", href), options.head.appendChild(precedence)), (precedence = { type: "script", instance: precedence, count: 1 }), - as.set(key$201, precedence)); + as.set(key$200, precedence)); } else if ("style" === as || "script" === as) if ((resourceRoot = getDocumentForPreloads())) { - key$201 = escapeSelectorAttributeValueInsideDoubleQuotes(href); - precedence = key$201 = - 'link[rel="preload"][as="' + as + '"][href="' + key$201 + '"]'; + key$200 = escapeSelectorAttributeValueInsideDoubleQuotes(href); + precedence = key$200 = + 'link[rel="preload"][as="' + as + '"][href="' + key$200 + '"]'; switch (as) { case "style": precedence = getStyleKey(href); @@ -14756,7 +14773,7 @@ function preinit$1(href, options) { integrity: options.integrity }), preloadPropsMap.set(precedence, href), - null === resourceRoot.querySelector(key$201) && + null === resourceRoot.querySelector(key$200) && ((options = resourceRoot.createElement("link")), setInitialProperties(options, "link", href), markNodeAsHoistable(options), @@ -14788,14 +14805,14 @@ function getResource(type, currentProps, pendingProps) { "string" === typeof pendingProps.href && "string" === typeof pendingProps.precedence ) { - var key$208 = getStyleKey(pendingProps.href), - styles$209 = getResourcesFromRoot(currentProps).hoistableStyles; - type = styles$209.get(key$208); + var key$207 = getStyleKey(pendingProps.href), + styles$208 = getResourcesFromRoot(currentProps).hoistableStyles; + type = styles$208.get(key$207); type || ((currentProps = currentProps.ownerDocument || currentProps), (type = { type: "stylesheet", instance: null, count: 0 }), - styles$209.set(key$208, type), - preloadPropsMap.has(key$208) || + styles$208.set(key$207, type), + preloadPropsMap.has(key$207) || ((pendingProps = { rel: "preload", as: "style", @@ -14806,16 +14823,16 @@ function getResource(type, currentProps, pendingProps) { hrefLang: pendingProps.hrefLang, referrerPolicy: pendingProps.referrerPolicy }), - preloadPropsMap.set(key$208, pendingProps), - currentProps.querySelector(getStylesheetSelectorFromKey(key$208)) || + preloadPropsMap.set(key$207, pendingProps), + currentProps.querySelector(getStylesheetSelectorFromKey(key$207)) || null !== currentProps.querySelector( - 'link[rel="preload"][as="style"][' + key$208 + "]" + 'link[rel="preload"][as="style"][' + key$207 + "]" ) || - ((key$208 = currentProps.createElement("link")), - setInitialProperties(key$208, "link", pendingProps), - markNodeAsHoistable(key$208), - currentProps.head.appendChild(key$208)))); + ((key$207 = currentProps.createElement("link")), + setInitialProperties(key$207, "link", pendingProps), + markNodeAsHoistable(key$207), + currentProps.head.appendChild(key$207)))); return type; } return null; @@ -14865,14 +14882,14 @@ function acquireResource(hoistableRoot, resource, props) { return (resource.instance = key); case "stylesheet": styleProps = getStyleKey(props.href); - var instance$216 = hoistableRoot.querySelector( + var instance$215 = hoistableRoot.querySelector( getStylesheetSelectorFromKey(styleProps) ); - if (instance$216) + if (instance$215) return ( - (resource.instance = instance$216), - markNodeAsHoistable(instance$216), - instance$216 + (resource.instance = instance$215), + markNodeAsHoistable(instance$215), + instance$215 ); key = assign({}, props, { "data-precedence": props.precedence, @@ -14880,11 +14897,11 @@ function acquireResource(hoistableRoot, resource, props) { }); (styleProps = preloadPropsMap.get(styleProps)) && adoptPreloadPropsForStylesheet(key, styleProps); - instance$216 = ( + instance$215 = ( hoistableRoot.ownerDocument || hoistableRoot ).createElement("link"); - markNodeAsHoistable(instance$216); - var linkInstance = instance$216; + markNodeAsHoistable(instance$215); + var linkInstance = instance$215; linkInstance._p = new Promise(function (resolve, reject) { linkInstance.onload = resolve; linkInstance.onerror = reject; @@ -14896,14 +14913,14 @@ function acquireResource(hoistableRoot, resource, props) { return (linkInstance._p.s = "e"); } ); - setInitialProperties(instance$216, "link", key); - insertStylesheet(instance$216, props.precedence, hoistableRoot); - return (resource.instance = instance$216); + setInitialProperties(instance$215, "link", key); + insertStylesheet(instance$215, props.precedence, hoistableRoot); + return (resource.instance = instance$215); case "script": - instance$216 = getScriptKey(props.src); + instance$215 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - "script[async]" + instance$216 + "script[async]" + instance$215 )) ) return ( @@ -14912,7 +14929,7 @@ function acquireResource(hoistableRoot, resource, props) { styleProps ); key = props; - if ((styleProps = preloadPropsMap.get(instance$216))) + if ((styleProps = preloadPropsMap.get(instance$215))) (key = assign({}, props)), adoptPreloadPropsForScript(key, styleProps); hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot; @@ -15333,17 +15350,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1746 = { +var devToolsConfig$jscomp$inline_1745 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-549fc09d", + version: "18.3.0-www-modern-e27de617", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2144 = { - bundleType: devToolsConfig$jscomp$inline_1746.bundleType, - version: devToolsConfig$jscomp$inline_1746.version, - rendererPackageName: devToolsConfig$jscomp$inline_1746.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1746.rendererConfig, +var internals$jscomp$inline_2143 = { + bundleType: devToolsConfig$jscomp$inline_1745.bundleType, + version: devToolsConfig$jscomp$inline_1745.version, + rendererPackageName: devToolsConfig$jscomp$inline_1745.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1745.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -15360,26 +15377,26 @@ var internals$jscomp$inline_2144 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1746.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1745.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-549fc09d" + reconcilerVersion: "18.3.0-www-modern-e27de617" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2145 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2144 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2145.isDisabled && - hook$jscomp$inline_2145.supportsFiber + !hook$jscomp$inline_2144.isDisabled && + hook$jscomp$inline_2144.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2145.inject( - internals$jscomp$inline_2144 + (rendererID = hook$jscomp$inline_2144.inject( + internals$jscomp$inline_2143 )), - (injectedHook = hook$jscomp$inline_2145); + (injectedHook = hook$jscomp$inline_2144); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; @@ -15536,4 +15553,4 @@ exports.unstable_createEventHandle = function (type, options) { return eventHandle; }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-modern-549fc09d"; +exports.version = "18.3.0-www-modern-e27de617"; diff --git a/compiled/facebook-www/ReactDOM-profiling.classic.js b/compiled/facebook-www/ReactDOM-profiling.classic.js index 41881d64f5399..583c3a0dd98e1 100644 --- a/compiled/facebook-www/ReactDOM-profiling.classic.js +++ b/compiled/facebook-www/ReactDOM-profiling.classic.js @@ -34,6 +34,8 @@ var Scheduler = require("scheduler"), disableIEWorkarounds = dynamicFeatureFlags.disableIEWorkarounds, enableTrustedTypesIntegration = dynamicFeatureFlags.enableTrustedTypesIntegration, + revertRemovalOfSiblingPrerendering = + dynamicFeatureFlags.revertRemovalOfSiblingPrerendering, enableLegacyFBSupport = dynamicFeatureFlags.enableLegacyFBSupport, deferRenderPhaseUpdateToNextBatch = dynamicFeatureFlags.deferRenderPhaseUpdateToNextBatch, @@ -12166,7 +12168,7 @@ function renderRootSync(root, lanes) { default: (workInProgressSuspendedReason = 0), (workInProgressThrownValue = null), - unwindSuspendedUnitOfWork(lanes, memoizedUpdaters); + throwAndUnwindWorkLoop(lanes, memoizedUpdaters); } workLoopSync(); break; @@ -12219,7 +12221,7 @@ function renderRootConcurrent(root, lanes) { case 1: workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, memoizedUpdaters); + throwAndUnwindWorkLoop(lanes, memoizedUpdaters); break; case 2: if (isThenableResolved(memoizedUpdaters)) { @@ -12249,7 +12251,7 @@ function renderRootConcurrent(root, lanes) { replaySuspendedUnitOfWork(lanes)) : ((workInProgressSuspendedReason = 0), (workInProgressThrownValue = null), - unwindSuspendedUnitOfWork(lanes, memoizedUpdaters)); + throwAndUnwindWorkLoop(lanes, memoizedUpdaters)); break; case 5: switch (workInProgress.tag) { @@ -12272,12 +12274,12 @@ function renderRootConcurrent(root, lanes) { } workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, memoizedUpdaters); + throwAndUnwindWorkLoop(lanes, memoizedUpdaters); break; case 6: workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, memoizedUpdaters); + throwAndUnwindWorkLoop(lanes, memoizedUpdaters); break; case 8: resetWorkInProgressStack(); @@ -12375,7 +12377,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { : (workInProgress = current); ReactCurrentOwner.current = null; } -function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { resetContextDependencies(); resetHooksOnUnwind(); thenableState$1 = null; @@ -12546,49 +12548,31 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { } catch (error) { throw ((workInProgress = returnFiber), error); } - completeUnitOfWork(unitOfWork); + unitOfWork.flags & 32768 + ? unwindUnitOfWork(unitOfWork) + : completeUnitOfWork(unitOfWork); } } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { + if ( + revertRemovalOfSiblingPrerendering && + 0 !== (completedWork.flags & 32768) + ) { + unwindUnitOfWork(completedWork); + return; + } var current = completedWork.alternate; unitOfWork = completedWork.return; - if (0 === (completedWork.flags & 32768)) { - if ( - (0 === (completedWork.mode & 2) - ? (current = completeWork(current, completedWork, renderLanes)) - : (startProfilerTimer(completedWork), - (current = completeWork(current, completedWork, renderLanes)), - stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1)), - null !== current) - ) { - workInProgress = current; - return; - } - } else { - current = unwindWork(current, completedWork); - if (null !== current) { - current.flags &= 32767; - workInProgress = current; - return; - } - if (0 !== (completedWork.mode & 2)) { - stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1); - current = completedWork.actualDuration; - for (var child = completedWork.child; null !== child; ) - (current += child.actualDuration), (child = child.sibling); - completedWork.actualDuration = current; - } - if (null !== unitOfWork) - (unitOfWork.flags |= 32768), - (unitOfWork.subtreeFlags = 0), - (unitOfWork.deletions = null); - else { - workInProgressRootExitStatus = 6; - workInProgress = null; - return; - } + 0 === (completedWork.mode & 2) + ? (current = completeWork(current, completedWork, renderLanes)) + : (startProfilerTimer(completedWork), + (current = completeWork(current, completedWork, renderLanes)), + stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1)); + if (null !== current) { + workInProgress = current; + return; } completedWork = completedWork.sibling; if (null !== completedWork) { @@ -12599,6 +12583,36 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } +function unwindUnitOfWork(unitOfWork) { + do { + var next = unwindWork(unitOfWork.alternate, unitOfWork); + if (null !== next) { + next.flags &= 32767; + workInProgress = next; + return; + } + if (0 !== (unitOfWork.mode & 2)) { + stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !1); + next = unitOfWork.actualDuration; + for (var child = unitOfWork.child; null !== child; ) + (next += child.actualDuration), (child = child.sibling); + unitOfWork.actualDuration = next; + } + next = unitOfWork.return; + null !== next && + ((next.flags |= 32768), (next.subtreeFlags = 0), (next.deletions = null)); + if ( + revertRemovalOfSiblingPrerendering && + ((unitOfWork = unitOfWork.sibling), null !== unitOfWork) + ) { + workInProgress = unitOfWork; + return; + } + workInProgress = unitOfWork = next; + } while (null !== unitOfWork); + workInProgressRootExitStatus = 6; + workInProgress = null; +} function commitRoot(root, recoverableErrors, transitions) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig$1.transition; @@ -12666,7 +12680,7 @@ function commitRootImpl( var prevExecutionContext = executionContext; executionContext |= 4; ReactCurrentOwner.current = null; - var shouldFireAfterActiveInstanceBlur$231 = commitBeforeMutationEffects( + var shouldFireAfterActiveInstanceBlur$230 = commitBeforeMutationEffects( root, finishedWork ); @@ -12674,7 +12688,7 @@ function commitRootImpl( enableProfilerNestedUpdateScheduledHook && (rootCommittingMutationOrLayoutEffects = root); commitMutationEffects(root, finishedWork, lanes); - shouldFireAfterActiveInstanceBlur$231 && + shouldFireAfterActiveInstanceBlur$230 && ((_enabled = !0), dispatchAfterDetachedBlur(selectionInformation.focusedElem), (_enabled = !1)); @@ -12768,7 +12782,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects() { if (null !== rootWithPendingPassiveEffects) { - var root$232 = rootWithPendingPassiveEffects, + var root$231 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes); @@ -12784,7 +12798,7 @@ function flushPassiveEffects() { } finally { (currentUpdatePriority = previousPriority), (ReactCurrentBatchConfig$1.transition = prevTransition), - releaseRootPooledCache(root$232, remainingLanes); + releaseRootPooledCache(root$231, remainingLanes); } } return !1; @@ -14154,12 +14168,12 @@ function getPublicRootInstance(container) { function attemptSynchronousHydration(fiber) { switch (fiber.tag) { case 3: - var root$235 = fiber.stateNode; - if (root$235.current.memoizedState.isDehydrated) { - var lanes = getHighestPriorityLanes(root$235.pendingLanes); + var root$234 = fiber.stateNode; + if (root$234.current.memoizedState.isDehydrated) { + var lanes = getHighestPriorityLanes(root$234.pendingLanes); 0 !== lanes && - (markRootEntangled(root$235, lanes | 2), - ensureRootIsScheduled(root$235, now$1()), + (markRootEntangled(root$234, lanes | 2), + ensureRootIsScheduled(root$234, now$1()), 0 === (executionContext & 6) && ((workInProgressRootRenderTargetTime = now$1() + 500), flushSyncCallbacks())); @@ -14731,19 +14745,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$337; + var JSCompiler_inline_result$jscomp$336; if (canUseDOM) { - var isSupported$jscomp$inline_1687 = "oninput" in document; - if (!isSupported$jscomp$inline_1687) { - var element$jscomp$inline_1688 = document.createElement("div"); - element$jscomp$inline_1688.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1687 = - "function" === typeof element$jscomp$inline_1688.oninput; + var isSupported$jscomp$inline_1686 = "oninput" in document; + if (!isSupported$jscomp$inline_1686) { + var element$jscomp$inline_1687 = document.createElement("div"); + element$jscomp$inline_1687.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1686 = + "function" === typeof element$jscomp$inline_1687.oninput; } - JSCompiler_inline_result$jscomp$337 = isSupported$jscomp$inline_1687; - } else JSCompiler_inline_result$jscomp$337 = !1; + JSCompiler_inline_result$jscomp$336 = isSupported$jscomp$inline_1686; + } else JSCompiler_inline_result$jscomp$336 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$337 && + JSCompiler_inline_result$jscomp$336 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -14881,20 +14895,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1700 = 0; - i$jscomp$inline_1700 < simpleEventPluginEvents.length; - i$jscomp$inline_1700++ + var i$jscomp$inline_1699 = 0; + i$jscomp$inline_1699 < simpleEventPluginEvents.length; + i$jscomp$inline_1699++ ) { - var eventName$jscomp$inline_1701 = - simpleEventPluginEvents[i$jscomp$inline_1700], - domEventName$jscomp$inline_1702 = - eventName$jscomp$inline_1701.toLowerCase(), - capitalizedEvent$jscomp$inline_1703 = - eventName$jscomp$inline_1701[0].toUpperCase() + - eventName$jscomp$inline_1701.slice(1); + var eventName$jscomp$inline_1700 = + simpleEventPluginEvents[i$jscomp$inline_1699], + domEventName$jscomp$inline_1701 = + eventName$jscomp$inline_1700.toLowerCase(), + capitalizedEvent$jscomp$inline_1702 = + eventName$jscomp$inline_1700[0].toUpperCase() + + eventName$jscomp$inline_1700.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1702, - "on" + capitalizedEvent$jscomp$inline_1703 + domEventName$jscomp$inline_1701, + "on" + capitalizedEvent$jscomp$inline_1702 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16473,11 +16487,11 @@ function legacyCreateRootFromDOMContainer( if ("function" === typeof callback) { var originalCallback = callback; callback = function () { - var instance = getPublicRootInstance(root$250); + var instance = getPublicRootInstance(root$249); originalCallback.call(instance); }; } - var root$250 = createHydrationContainer( + var root$249 = createHydrationContainer( initialChildren, callback, container, @@ -16489,23 +16503,23 @@ function legacyCreateRootFromDOMContainer( noopOnRecoverableError, null ); - container._reactRootContainer = root$250; - container[internalContainerInstanceKey] = root$250.current; + container._reactRootContainer = root$249; + container[internalContainerInstanceKey] = root$249.current; listenToAllSupportedEvents( 8 === container.nodeType ? container.parentNode : container ); flushSync$1(); - return root$250; + return root$249; } clearContainer(container); if ("function" === typeof callback) { - var originalCallback$251 = callback; + var originalCallback$250 = callback; callback = function () { - var instance = getPublicRootInstance(root$252); - originalCallback$251.call(instance); + var instance = getPublicRootInstance(root$251); + originalCallback$250.call(instance); }; } - var root$252 = createFiberRoot( + var root$251 = createFiberRoot( container, 0, !1, @@ -16517,15 +16531,15 @@ function legacyCreateRootFromDOMContainer( noopOnRecoverableError, null ); - container._reactRootContainer = root$252; - container[internalContainerInstanceKey] = root$252.current; + container._reactRootContainer = root$251; + container[internalContainerInstanceKey] = root$251.current; listenToAllSupportedEvents( 8 === container.nodeType ? container.parentNode : container ); flushSync$1(function () { - updateContainer(initialChildren, root$252, parentComponent, callback); + updateContainer(initialChildren, root$251, parentComponent, callback); }); - return root$252; + return root$251; } function legacyRenderSubtreeIntoContainer( parentComponent, @@ -16584,10 +16598,10 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1856 = { +var devToolsConfig$jscomp$inline_1855 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-9681b897", + version: "18.3.0-www-classic-5ece29ae", rendererPackageName: "react-dom" }; (function (internals) { @@ -16605,10 +16619,10 @@ var devToolsConfig$jscomp$inline_1856 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1856.bundleType, - version: devToolsConfig$jscomp$inline_1856.version, - rendererPackageName: devToolsConfig$jscomp$inline_1856.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1856.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1855.bundleType, + version: devToolsConfig$jscomp$inline_1855.version, + rendererPackageName: devToolsConfig$jscomp$inline_1855.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1855.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16624,14 +16638,14 @@ var devToolsConfig$jscomp$inline_1856 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1856.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1855.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-9681b897" + reconcilerVersion: "18.3.0-www-classic-5ece29ae" }); assign(Internals, { ReactBrowserEventEmitter: { @@ -16858,7 +16872,7 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-classic-9681b897"; +exports.version = "18.3.0-www-classic-5ece29ae"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOM-profiling.modern.js b/compiled/facebook-www/ReactDOM-profiling.modern.js index 3363319641f00..e7994bfc5ee1c 100644 --- a/compiled/facebook-www/ReactDOM-profiling.modern.js +++ b/compiled/facebook-www/ReactDOM-profiling.modern.js @@ -54,6 +54,8 @@ var dynamicFeatureFlags = require("ReactFeatureFlags"), disableIEWorkarounds = dynamicFeatureFlags.disableIEWorkarounds, enableTrustedTypesIntegration = dynamicFeatureFlags.enableTrustedTypesIntegration, + revertRemovalOfSiblingPrerendering = + dynamicFeatureFlags.revertRemovalOfSiblingPrerendering, enableLegacyFBSupport = dynamicFeatureFlags.enableLegacyFBSupport, deferRenderPhaseUpdateToNextBatch = dynamicFeatureFlags.deferRenderPhaseUpdateToNextBatch, @@ -7604,7 +7606,7 @@ function commitBeforeMutationEffects(root, firstChild) { selection = selection.focusOffset; try { JSCompiler_temp.nodeType, focusNode.nodeType; - } catch (e$210) { + } catch (e$209) { JSCompiler_temp = null; break a; } @@ -10779,7 +10781,7 @@ function renderRootSync(root, lanes) { default: (workInProgressSuspendedReason = 0), (workInProgressThrownValue = null), - unwindSuspendedUnitOfWork(lanes, memoizedUpdaters); + throwAndUnwindWorkLoop(lanes, memoizedUpdaters); } workLoopSync(); break; @@ -10832,7 +10834,7 @@ function renderRootConcurrent(root, lanes) { case 1: workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, memoizedUpdaters); + throwAndUnwindWorkLoop(lanes, memoizedUpdaters); break; case 2: if (isThenableResolved(memoizedUpdaters)) { @@ -10862,7 +10864,7 @@ function renderRootConcurrent(root, lanes) { replaySuspendedUnitOfWork(lanes)) : ((workInProgressSuspendedReason = 0), (workInProgressThrownValue = null), - unwindSuspendedUnitOfWork(lanes, memoizedUpdaters)); + throwAndUnwindWorkLoop(lanes, memoizedUpdaters)); break; case 5: switch (workInProgress.tag) { @@ -10885,12 +10887,12 @@ function renderRootConcurrent(root, lanes) { } workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, memoizedUpdaters); + throwAndUnwindWorkLoop(lanes, memoizedUpdaters); break; case 6: workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, memoizedUpdaters); + throwAndUnwindWorkLoop(lanes, memoizedUpdaters); break; case 8: resetWorkInProgressStack(); @@ -10988,7 +10990,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { : (workInProgress = current); ReactCurrentOwner.current = null; } -function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { resetContextDependencies(); resetHooksOnUnwind(); thenableState$1 = null; @@ -11159,49 +11161,31 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { } catch (error) { throw ((workInProgress = returnFiber), error); } - completeUnitOfWork(unitOfWork); + unitOfWork.flags & 32768 + ? unwindUnitOfWork(unitOfWork) + : completeUnitOfWork(unitOfWork); } } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { + if ( + revertRemovalOfSiblingPrerendering && + 0 !== (completedWork.flags & 32768) + ) { + unwindUnitOfWork(completedWork); + return; + } var current = completedWork.alternate; unitOfWork = completedWork.return; - if (0 === (completedWork.flags & 32768)) { - if ( - (0 === (completedWork.mode & 2) - ? (current = completeWork(current, completedWork, renderLanes)) - : (startProfilerTimer(completedWork), - (current = completeWork(current, completedWork, renderLanes)), - stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1)), - null !== current) - ) { - workInProgress = current; - return; - } - } else { - current = unwindWork(current, completedWork); - if (null !== current) { - current.flags &= 32767; - workInProgress = current; - return; - } - if (0 !== (completedWork.mode & 2)) { - stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1); - current = completedWork.actualDuration; - for (var child = completedWork.child; null !== child; ) - (current += child.actualDuration), (child = child.sibling); - completedWork.actualDuration = current; - } - if (null !== unitOfWork) - (unitOfWork.flags |= 32768), - (unitOfWork.subtreeFlags = 0), - (unitOfWork.deletions = null); - else { - workInProgressRootExitStatus = 6; - workInProgress = null; - return; - } + 0 === (completedWork.mode & 2) + ? (current = completeWork(current, completedWork, renderLanes)) + : (startProfilerTimer(completedWork), + (current = completeWork(current, completedWork, renderLanes)), + stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1)); + if (null !== current) { + workInProgress = current; + return; } completedWork = completedWork.sibling; if (null !== completedWork) { @@ -11212,6 +11196,36 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } +function unwindUnitOfWork(unitOfWork) { + do { + var next = unwindWork(unitOfWork.alternate, unitOfWork); + if (null !== next) { + next.flags &= 32767; + workInProgress = next; + return; + } + if (0 !== (unitOfWork.mode & 2)) { + stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !1); + next = unitOfWork.actualDuration; + for (var child = unitOfWork.child; null !== child; ) + (next += child.actualDuration), (child = child.sibling); + unitOfWork.actualDuration = next; + } + next = unitOfWork.return; + null !== next && + ((next.flags |= 32768), (next.subtreeFlags = 0), (next.deletions = null)); + if ( + revertRemovalOfSiblingPrerendering && + ((unitOfWork = unitOfWork.sibling), null !== unitOfWork) + ) { + workInProgress = unitOfWork; + return; + } + workInProgress = unitOfWork = next; + } while (null !== unitOfWork); + workInProgressRootExitStatus = 6; + workInProgress = null; +} function commitRoot(root, recoverableErrors, transitions) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig$1.transition; @@ -11279,7 +11293,7 @@ function commitRootImpl( var prevExecutionContext = executionContext; executionContext |= 4; ReactCurrentOwner.current = null; - var shouldFireAfterActiveInstanceBlur$198 = commitBeforeMutationEffects( + var shouldFireAfterActiveInstanceBlur$197 = commitBeforeMutationEffects( root, finishedWork ); @@ -11287,7 +11301,7 @@ function commitRootImpl( enableProfilerNestedUpdateScheduledHook && (rootCommittingMutationOrLayoutEffects = root); commitMutationEffects(root, finishedWork, lanes); - shouldFireAfterActiveInstanceBlur$198 && + shouldFireAfterActiveInstanceBlur$197 && ((_enabled = !0), dispatchAfterDetachedBlur(selectionInformation.focusedElem), (_enabled = !1)); @@ -11381,7 +11395,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects() { if (null !== rootWithPendingPassiveEffects) { - var root$199 = rootWithPendingPassiveEffects, + var root$198 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes); @@ -11397,7 +11411,7 @@ function flushPassiveEffects() { } finally { (currentUpdatePriority = previousPriority), (ReactCurrentBatchConfig$1.transition = prevTransition), - releaseRootPooledCache(root$199, remainingLanes); + releaseRootPooledCache(root$198, remainingLanes); } } return !1; @@ -12653,12 +12667,12 @@ function updateContainer(element, container, parentComponent, callback) { function attemptSynchronousHydration(fiber) { switch (fiber.tag) { case 3: - var root$202 = fiber.stateNode; - if (root$202.current.memoizedState.isDehydrated) { - var lanes = getHighestPriorityLanes(root$202.pendingLanes); + var root$201 = fiber.stateNode; + if (root$201.current.memoizedState.isDehydrated) { + var lanes = getHighestPriorityLanes(root$201.pendingLanes); 0 !== lanes && - (markRootEntangled(root$202, lanes | 2), - ensureRootIsScheduled(root$202, now$1()), + (markRootEntangled(root$201, lanes | 2), + ensureRootIsScheduled(root$201, now$1()), 0 === (executionContext & 6) && ((workInProgressRootRenderTargetTime = now$1() + 500), flushSyncCallbacks())); @@ -13932,19 +13946,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$320; + var JSCompiler_inline_result$jscomp$319; if (canUseDOM) { - var isSupported$jscomp$inline_1606 = "oninput" in document; - if (!isSupported$jscomp$inline_1606) { - var element$jscomp$inline_1607 = document.createElement("div"); - element$jscomp$inline_1607.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1606 = - "function" === typeof element$jscomp$inline_1607.oninput; - } - JSCompiler_inline_result$jscomp$320 = isSupported$jscomp$inline_1606; - } else JSCompiler_inline_result$jscomp$320 = !1; + var isSupported$jscomp$inline_1605 = "oninput" in document; + if (!isSupported$jscomp$inline_1605) { + var element$jscomp$inline_1606 = document.createElement("div"); + element$jscomp$inline_1606.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1605 = + "function" === typeof element$jscomp$inline_1606.oninput; + } + JSCompiler_inline_result$jscomp$319 = isSupported$jscomp$inline_1605; + } else JSCompiler_inline_result$jscomp$319 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$320 && + JSCompiler_inline_result$jscomp$319 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -14253,20 +14267,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1647 = 0; - i$jscomp$inline_1647 < simpleEventPluginEvents.length; - i$jscomp$inline_1647++ + var i$jscomp$inline_1646 = 0; + i$jscomp$inline_1646 < simpleEventPluginEvents.length; + i$jscomp$inline_1646++ ) { - var eventName$jscomp$inline_1648 = - simpleEventPluginEvents[i$jscomp$inline_1647], - domEventName$jscomp$inline_1649 = - eventName$jscomp$inline_1648.toLowerCase(), - capitalizedEvent$jscomp$inline_1650 = - eventName$jscomp$inline_1648[0].toUpperCase() + - eventName$jscomp$inline_1648.slice(1); + var eventName$jscomp$inline_1647 = + simpleEventPluginEvents[i$jscomp$inline_1646], + domEventName$jscomp$inline_1648 = + eventName$jscomp$inline_1647.toLowerCase(), + capitalizedEvent$jscomp$inline_1649 = + eventName$jscomp$inline_1647[0].toUpperCase() + + eventName$jscomp$inline_1647.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1649, - "on" + capitalizedEvent$jscomp$inline_1650 + domEventName$jscomp$inline_1648, + "on" + capitalizedEvent$jscomp$inline_1649 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -15457,12 +15471,12 @@ function preinit$1(href, options) { switch (as) { case "style": as = getResourcesFromRoot(resourceRoot).hoistableStyles; - var key$222 = getStyleKey(href), + var key$221 = getStyleKey(href), precedence = options.precedence || "default", - resource = as.get(key$222); + resource = as.get(key$221); if (resource) break; resource = resourceRoot.querySelector( - getStylesheetSelectorFromKey(key$222) + getStylesheetSelectorFromKey(key$221) ); resource || ((href = { @@ -15471,7 +15485,7 @@ function preinit$1(href, options) { "data-precedence": precedence, crossOrigin: options.crossOrigin }), - (options = preloadPropsMap.get(key$222)) && + (options = preloadPropsMap.get(key$221)) && adoptPreloadPropsForStylesheet(href, options), (resource = ( resourceRoot.ownerDocument || resourceRoot @@ -15480,15 +15494,15 @@ function preinit$1(href, options) { setInitialProperties(resource, "link", href), insertStylesheet(resource, precedence, resourceRoot)); resource = { type: "stylesheet", instance: resource, count: 1 }; - as.set(key$222, resource); + as.set(key$221, resource); break; case "script": (as = getResourcesFromRoot(resourceRoot).hoistableScripts), - (key$222 = getScriptKey(href)), - (precedence = as.get(key$222)), + (key$221 = getScriptKey(href)), + (precedence = as.get(key$221)), precedence || ((precedence = resourceRoot.querySelector( - "script[async]" + key$222 + "script[async]" + key$221 )), precedence || ((href = { @@ -15497,7 +15511,7 @@ function preinit$1(href, options) { crossOrigin: options.crossOrigin, integrity: options.integrity }), - (options = preloadPropsMap.get(key$222)) && + (options = preloadPropsMap.get(key$221)) && adoptPreloadPropsForScript(href, options), (options = resourceRoot.ownerDocument || resourceRoot), (precedence = options.createElement("script")), @@ -15505,13 +15519,13 @@ function preinit$1(href, options) { setInitialProperties(precedence, "link", href), options.head.appendChild(precedence)), (precedence = { type: "script", instance: precedence, count: 1 }), - as.set(key$222, precedence)); + as.set(key$221, precedence)); } else if ("style" === as || "script" === as) if ((resourceRoot = getDocumentForPreloads())) { - key$222 = escapeSelectorAttributeValueInsideDoubleQuotes(href); - precedence = key$222 = - 'link[rel="preload"][as="' + as + '"][href="' + key$222 + '"]'; + key$221 = escapeSelectorAttributeValueInsideDoubleQuotes(href); + precedence = key$221 = + 'link[rel="preload"][as="' + as + '"][href="' + key$221 + '"]'; switch (as) { case "style": precedence = getStyleKey(href); @@ -15528,7 +15542,7 @@ function preinit$1(href, options) { integrity: options.integrity }), preloadPropsMap.set(precedence, href), - null === resourceRoot.querySelector(key$222) && + null === resourceRoot.querySelector(key$221) && ((options = resourceRoot.createElement("link")), setInitialProperties(options, "link", href), markNodeAsHoistable(options), @@ -15560,14 +15574,14 @@ function getResource(type, currentProps, pendingProps) { "string" === typeof pendingProps.href && "string" === typeof pendingProps.precedence ) { - var key$229 = getStyleKey(pendingProps.href), - styles$230 = getResourcesFromRoot(currentProps).hoistableStyles; - type = styles$230.get(key$229); + var key$228 = getStyleKey(pendingProps.href), + styles$229 = getResourcesFromRoot(currentProps).hoistableStyles; + type = styles$229.get(key$228); type || ((currentProps = currentProps.ownerDocument || currentProps), (type = { type: "stylesheet", instance: null, count: 0 }), - styles$230.set(key$229, type), - preloadPropsMap.has(key$229) || + styles$229.set(key$228, type), + preloadPropsMap.has(key$228) || ((pendingProps = { rel: "preload", as: "style", @@ -15578,16 +15592,16 @@ function getResource(type, currentProps, pendingProps) { hrefLang: pendingProps.hrefLang, referrerPolicy: pendingProps.referrerPolicy }), - preloadPropsMap.set(key$229, pendingProps), - currentProps.querySelector(getStylesheetSelectorFromKey(key$229)) || + preloadPropsMap.set(key$228, pendingProps), + currentProps.querySelector(getStylesheetSelectorFromKey(key$228)) || null !== currentProps.querySelector( - 'link[rel="preload"][as="style"][' + key$229 + "]" + 'link[rel="preload"][as="style"][' + key$228 + "]" ) || - ((key$229 = currentProps.createElement("link")), - setInitialProperties(key$229, "link", pendingProps), - markNodeAsHoistable(key$229), - currentProps.head.appendChild(key$229)))); + ((key$228 = currentProps.createElement("link")), + setInitialProperties(key$228, "link", pendingProps), + markNodeAsHoistable(key$228), + currentProps.head.appendChild(key$228)))); return type; } return null; @@ -15637,14 +15651,14 @@ function acquireResource(hoistableRoot, resource, props) { return (resource.instance = key); case "stylesheet": styleProps = getStyleKey(props.href); - var instance$237 = hoistableRoot.querySelector( + var instance$236 = hoistableRoot.querySelector( getStylesheetSelectorFromKey(styleProps) ); - if (instance$237) + if (instance$236) return ( - (resource.instance = instance$237), - markNodeAsHoistable(instance$237), - instance$237 + (resource.instance = instance$236), + markNodeAsHoistable(instance$236), + instance$236 ); key = assign({}, props, { "data-precedence": props.precedence, @@ -15652,11 +15666,11 @@ function acquireResource(hoistableRoot, resource, props) { }); (styleProps = preloadPropsMap.get(styleProps)) && adoptPreloadPropsForStylesheet(key, styleProps); - instance$237 = ( + instance$236 = ( hoistableRoot.ownerDocument || hoistableRoot ).createElement("link"); - markNodeAsHoistable(instance$237); - var linkInstance = instance$237; + markNodeAsHoistable(instance$236); + var linkInstance = instance$236; linkInstance._p = new Promise(function (resolve, reject) { linkInstance.onload = resolve; linkInstance.onerror = reject; @@ -15668,14 +15682,14 @@ function acquireResource(hoistableRoot, resource, props) { return (linkInstance._p.s = "e"); } ); - setInitialProperties(instance$237, "link", key); - insertStylesheet(instance$237, props.precedence, hoistableRoot); - return (resource.instance = instance$237); + setInitialProperties(instance$236, "link", key); + insertStylesheet(instance$236, props.precedence, hoistableRoot); + return (resource.instance = instance$236); case "script": - instance$237 = getScriptKey(props.src); + instance$236 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - "script[async]" + instance$237 + "script[async]" + instance$236 )) ) return ( @@ -15684,7 +15698,7 @@ function acquireResource(hoistableRoot, resource, props) { styleProps ); key = props; - if ((styleProps = preloadPropsMap.get(instance$237))) + if ((styleProps = preloadPropsMap.get(instance$236))) (key = assign({}, props)), adoptPreloadPropsForScript(key, styleProps); hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot; @@ -16105,10 +16119,10 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1826 = { +var devToolsConfig$jscomp$inline_1825 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-586e60fb", + version: "18.3.0-www-modern-05e5b2d4", rendererPackageName: "react-dom" }; (function (internals) { @@ -16126,10 +16140,10 @@ var devToolsConfig$jscomp$inline_1826 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1826.bundleType, - version: devToolsConfig$jscomp$inline_1826.version, - rendererPackageName: devToolsConfig$jscomp$inline_1826.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1826.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1825.bundleType, + version: devToolsConfig$jscomp$inline_1825.version, + rendererPackageName: devToolsConfig$jscomp$inline_1825.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1825.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16146,14 +16160,14 @@ var devToolsConfig$jscomp$inline_1826 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1826.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1825.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-586e60fb" + reconcilerVersion: "18.3.0-www-modern-05e5b2d4" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.createPortal = function (children, container) { @@ -16309,7 +16323,7 @@ exports.unstable_createEventHandle = function (type, options) { return eventHandle; }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-modern-586e60fb"; +exports.version = "18.3.0-www-modern-05e5b2d4"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOMTesting-dev.classic.js b/compiled/facebook-www/ReactDOMTesting-dev.classic.js index 5ba0e1974f16b..66663514274cf 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.classic.js @@ -29,6 +29,8 @@ var disableInputAttributeSyncing = disableIEWorkarounds = dynamicFeatureFlags.disableIEWorkarounds, enableTrustedTypesIntegration = dynamicFeatureFlags.enableTrustedTypesIntegration, + revertRemovalOfSiblingPrerendering = + dynamicFeatureFlags.revertRemovalOfSiblingPrerendering, replayFailedUnitOfWorkWithInvokeGuardedCallback = dynamicFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback, enableLegacyFBSupport = dynamicFeatureFlags.enableLegacyFBSupport, @@ -33547,10 +33549,10 @@ function renderRootSync(root, lanes) { } default: { - // Continue with the normal work loop. + // Unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } } @@ -33657,7 +33659,7 @@ function renderRootConcurrent(root, lanes) { // Unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -33722,7 +33724,7 @@ function renderRootConcurrent(root, lanes) { // Otherwise, unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); } break; @@ -33787,7 +33789,7 @@ function renderRootConcurrent(root, lanes) { workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -33798,7 +33800,7 @@ function renderRootConcurrent(root, lanes) { // always unwind. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -34001,7 +34003,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { ReactCurrentOwner$1.current = null; } -function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { // This is a fork of performUnitOfWork specifcally for unwinding a fiber // that threw an exception. // @@ -34044,9 +34046,23 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { // To prevent an infinite loop, bubble the error up to the next parent. workInProgress = returnFiber; throw error; - } // Return to the normal work loop. + } - completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & Incomplete) { + // Unwind the stack until we reach the nearest boundary. + unwindUnitOfWork(unitOfWork); + } else { + // Although the fiber suspended, we're intentionally going to commit it in + // an inconsistent state. We can do this safely in cases where we know the + // inconsistent tree will be hidden. + // + // This currently only applies to Legacy Suspense implementation, but we may + // port a version of this to concurrent roots, too, when performing a + // synchronous render. Because that will allow us to mutate the tree as we + // go instead of buffering mutations until the end. Though it's unclear if + // this particular path is how that would be implemented. + completeUnitOfWork(unitOfWork); + } } function completeUnitOfWork(unitOfWork) { @@ -34055,75 +34071,53 @@ function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { - // The current, flushed, state of this fiber is the alternate. Ideally - // nothing should rely on this, but relying on it here means that we don't - // need an additional field on the work in progress. - var current = completedWork.alternate; - var returnFiber = completedWork.return; // Check if the work completed or if something threw. - - if ((completedWork.flags & Incomplete) === NoFlags$1) { - setCurrentFiber(completedWork); - var next = void 0; - - if ((completedWork.mode & ProfileMode) === NoMode) { - next = completeWork(current, completedWork, renderLanes); - } else { - startProfilerTimer(completedWork); - next = completeWork(current, completedWork, renderLanes); // Update render duration assuming we didn't error. - - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); - } - - resetCurrentFiber(); - - if (next !== null) { - // Completing this fiber spawned new work. Work on that next. - workInProgress = next; + if (revertRemovalOfSiblingPrerendering) { + if ((completedWork.flags & Incomplete) !== NoFlags$1) { + // This fiber did not complete, because one of its children did not + // complete. Switch to unwinding the stack instead of completing it. + // + // The reason "unwind" and "complete" is interleaved is because when + // something suspends, we continue rendering the siblings even though + // they will be replaced by a fallback. + // TODO: Disable sibling prerendering, then remove this branch. + unwindUnitOfWork(completedWork); return; } } else { - // This fiber did not complete because something threw. Pop values off - // the stack without entering the complete phase. If this is a boundary, - // capture values if possible. - var _next = unwindWork(current, completedWork); // Because this fiber did not complete, don't reset its lanes. - - if (_next !== null) { - // If completing this work spawned new work, do that next. We'll come - // back here again. - // Since we're restarting, remove anything that is not a host effect - // from the effect tag. - _next.flags &= HostEffectMask; - workInProgress = _next; - return; + { + if ((completedWork.flags & Incomplete) !== NoFlags$1) { + // NOTE: If we re-enable sibling prerendering in some cases, this branch + // is where we would switch to the unwinding path. + error( + "Internal React error: Expected this fiber to be complete, but " + + "it isn't. It should have been unwound. This is a bug in React." + ); + } } + } // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. - if ((completedWork.mode & ProfileMode) !== NoMode) { - // Record the render duration for the fiber that errored. - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing. + var current = completedWork.alternate; + var returnFiber = completedWork.return; + setCurrentFiber(completedWork); + var next = void 0; - var actualDuration = completedWork.actualDuration; - var child = completedWork.child; + if ((completedWork.mode & ProfileMode) === NoMode) { + next = completeWork(current, completedWork, renderLanes); + } else { + startProfilerTimer(completedWork); + next = completeWork(current, completedWork, renderLanes); // Update render duration assuming we didn't error. - while (child !== null) { - // $FlowFixMe[unsafe-addition] addition with possible null/undefined value - actualDuration += child.actualDuration; - child = child.sibling; - } + stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); + } - completedWork.actualDuration = actualDuration; - } + resetCurrentFiber(); - if (returnFiber !== null) { - // Mark the parent fiber as incomplete and clear its subtree flags. - returnFiber.flags |= Incomplete; - returnFiber.subtreeFlags = NoFlags$1; - returnFiber.deletions = null; - } else { - // We've unwound all the way to the root. - workInProgressRootExitStatus = RootDidNotComplete; - workInProgress = null; - return; - } + if (next !== null) { + // Completing this fiber spawned new work. Work on that next. + workInProgress = next; + return; } var siblingFiber = completedWork.sibling; @@ -34145,6 +34139,86 @@ function completeUnitOfWork(unitOfWork) { } } +function unwindUnitOfWork(unitOfWork) { + var incompleteWork = unitOfWork; + + do { + // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. + var current = incompleteWork.alternate; // This fiber did not complete because something threw. Pop values off + // the stack without entering the complete phase. If this is a boundary, + // capture values if possible. + + var next = unwindWork(current, incompleteWork); // Because this fiber did not complete, don't reset its lanes. + + if (next !== null) { + // Found a boundary that can handle this exception. Re-renter the + // begin phase. This branch will return us to the normal work loop. + // + // Since we're restarting, remove anything that is not a host effect + // from the effect tag. + next.flags &= HostEffectMask; + workInProgress = next; + return; + } // Keep unwinding until we reach either a boundary or the root. + + if ((incompleteWork.mode & ProfileMode) !== NoMode) { + // Record the render duration for the fiber that errored. + stopProfilerTimerIfRunningAndRecordDelta(incompleteWork, false); // Include the time spent working on failed children before continuing. + + var actualDuration = incompleteWork.actualDuration; + var child = incompleteWork.child; + + while (child !== null) { + // $FlowFixMe[unsafe-addition] addition with possible null/undefined value + actualDuration += child.actualDuration; + child = child.sibling; + } + + incompleteWork.actualDuration = actualDuration; + } // TODO: Once we stop prerendering siblings, instead of resetting the parent + // of the node being unwound, we should be able to reset node itself as we + // unwind the stack. Saves an additional null check. + + var returnFiber = incompleteWork.return; + + if (returnFiber !== null) { + // Mark the parent fiber as incomplete and clear its subtree flags. + // TODO: Once we stop prerendering siblings, we may be able to get rid of + // the Incomplete flag because unwinding to the nearest boundary will + // happen synchronously. + returnFiber.flags |= Incomplete; + returnFiber.subtreeFlags = NoFlags$1; + returnFiber.deletions = null; + } + + if (revertRemovalOfSiblingPrerendering) { + // If there are siblings, work on them now even though they're going to be + // replaced by a fallback. We're "prerendering" them. Historically our + // rationale for this behavior has been to initiate any lazy data requests + // in the siblings, and also to warm up the CPU cache. + // TODO: Don't prerender siblings. With `use`, we suspend the work loop + // until the data has resolved, anyway. + var siblingFiber = incompleteWork.sibling; + + if (siblingFiber !== null) { + // This branch will return us to the normal work loop. + workInProgress = siblingFiber; + return; + } + } // Otherwise, return to the parent + // $FlowFixMe[incompatible-type] we bail out when we get a null + + incompleteWork = returnFiber; // Update the next thing we're working on in case something throws. + + workInProgress = incompleteWork; + } while (incompleteWork !== null); // We've unwound all the way to the root. + + workInProgressRootExitStatus = RootDidNotComplete; + workInProgress = null; +} + function commitRoot(root, recoverableErrors, transitions) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. @@ -36771,7 +36845,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-07e6678b"; +var ReactVersion = "18.3.0-www-classic-7ee97d02"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOMTesting-dev.modern.js b/compiled/facebook-www/ReactDOMTesting-dev.modern.js index 8600d6bae1e96..35d458675c3aa 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.modern.js @@ -133,6 +133,8 @@ var disableInputAttributeSyncing = disableIEWorkarounds = dynamicFeatureFlags.disableIEWorkarounds, enableTrustedTypesIntegration = dynamicFeatureFlags.enableTrustedTypesIntegration, + revertRemovalOfSiblingPrerendering = + dynamicFeatureFlags.revertRemovalOfSiblingPrerendering, replayFailedUnitOfWorkWithInvokeGuardedCallback = dynamicFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback, enableLegacyFBSupport = dynamicFeatureFlags.enableLegacyFBSupport, @@ -30826,10 +30828,10 @@ function renderRootSync(root, lanes) { } default: { - // Continue with the normal work loop. + // Unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } } @@ -30936,7 +30938,7 @@ function renderRootConcurrent(root, lanes) { // Unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -31001,7 +31003,7 @@ function renderRootConcurrent(root, lanes) { // Otherwise, unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); } break; @@ -31066,7 +31068,7 @@ function renderRootConcurrent(root, lanes) { workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -31077,7 +31079,7 @@ function renderRootConcurrent(root, lanes) { // always unwind. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -31280,7 +31282,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { ReactCurrentOwner.current = null; } -function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { // This is a fork of performUnitOfWork specifcally for unwinding a fiber // that threw an exception. // @@ -31323,9 +31325,23 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { // To prevent an infinite loop, bubble the error up to the next parent. workInProgress = returnFiber; throw error; - } // Return to the normal work loop. + } - completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & Incomplete) { + // Unwind the stack until we reach the nearest boundary. + unwindUnitOfWork(unitOfWork); + } else { + // Although the fiber suspended, we're intentionally going to commit it in + // an inconsistent state. We can do this safely in cases where we know the + // inconsistent tree will be hidden. + // + // This currently only applies to Legacy Suspense implementation, but we may + // port a version of this to concurrent roots, too, when performing a + // synchronous render. Because that will allow us to mutate the tree as we + // go instead of buffering mutations until the end. Though it's unclear if + // this particular path is how that would be implemented. + completeUnitOfWork(unitOfWork); + } } function completeUnitOfWork(unitOfWork) { @@ -31334,75 +31350,53 @@ function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { - // The current, flushed, state of this fiber is the alternate. Ideally - // nothing should rely on this, but relying on it here means that we don't - // need an additional field on the work in progress. - var current = completedWork.alternate; - var returnFiber = completedWork.return; // Check if the work completed or if something threw. - - if ((completedWork.flags & Incomplete) === NoFlags$1) { - setCurrentFiber(completedWork); - var next = void 0; - - if ((completedWork.mode & ProfileMode) === NoMode) { - next = completeWork(current, completedWork, renderLanes); - } else { - startProfilerTimer(completedWork); - next = completeWork(current, completedWork, renderLanes); // Update render duration assuming we didn't error. - - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); - } - - resetCurrentFiber(); - - if (next !== null) { - // Completing this fiber spawned new work. Work on that next. - workInProgress = next; + if (revertRemovalOfSiblingPrerendering) { + if ((completedWork.flags & Incomplete) !== NoFlags$1) { + // This fiber did not complete, because one of its children did not + // complete. Switch to unwinding the stack instead of completing it. + // + // The reason "unwind" and "complete" is interleaved is because when + // something suspends, we continue rendering the siblings even though + // they will be replaced by a fallback. + // TODO: Disable sibling prerendering, then remove this branch. + unwindUnitOfWork(completedWork); return; } } else { - // This fiber did not complete because something threw. Pop values off - // the stack without entering the complete phase. If this is a boundary, - // capture values if possible. - var _next = unwindWork(current, completedWork); // Because this fiber did not complete, don't reset its lanes. - - if (_next !== null) { - // If completing this work spawned new work, do that next. We'll come - // back here again. - // Since we're restarting, remove anything that is not a host effect - // from the effect tag. - _next.flags &= HostEffectMask; - workInProgress = _next; - return; + { + if ((completedWork.flags & Incomplete) !== NoFlags$1) { + // NOTE: If we re-enable sibling prerendering in some cases, this branch + // is where we would switch to the unwinding path. + error( + "Internal React error: Expected this fiber to be complete, but " + + "it isn't. It should have been unwound. This is a bug in React." + ); + } } + } // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. - if ((completedWork.mode & ProfileMode) !== NoMode) { - // Record the render duration for the fiber that errored. - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing. + var current = completedWork.alternate; + var returnFiber = completedWork.return; + setCurrentFiber(completedWork); + var next = void 0; - var actualDuration = completedWork.actualDuration; - var child = completedWork.child; + if ((completedWork.mode & ProfileMode) === NoMode) { + next = completeWork(current, completedWork, renderLanes); + } else { + startProfilerTimer(completedWork); + next = completeWork(current, completedWork, renderLanes); // Update render duration assuming we didn't error. - while (child !== null) { - // $FlowFixMe[unsafe-addition] addition with possible null/undefined value - actualDuration += child.actualDuration; - child = child.sibling; - } + stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); + } - completedWork.actualDuration = actualDuration; - } + resetCurrentFiber(); - if (returnFiber !== null) { - // Mark the parent fiber as incomplete and clear its subtree flags. - returnFiber.flags |= Incomplete; - returnFiber.subtreeFlags = NoFlags$1; - returnFiber.deletions = null; - } else { - // We've unwound all the way to the root. - workInProgressRootExitStatus = RootDidNotComplete; - workInProgress = null; - return; - } + if (next !== null) { + // Completing this fiber spawned new work. Work on that next. + workInProgress = next; + return; } var siblingFiber = completedWork.sibling; @@ -31424,6 +31418,86 @@ function completeUnitOfWork(unitOfWork) { } } +function unwindUnitOfWork(unitOfWork) { + var incompleteWork = unitOfWork; + + do { + // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. + var current = incompleteWork.alternate; // This fiber did not complete because something threw. Pop values off + // the stack without entering the complete phase. If this is a boundary, + // capture values if possible. + + var next = unwindWork(current, incompleteWork); // Because this fiber did not complete, don't reset its lanes. + + if (next !== null) { + // Found a boundary that can handle this exception. Re-renter the + // begin phase. This branch will return us to the normal work loop. + // + // Since we're restarting, remove anything that is not a host effect + // from the effect tag. + next.flags &= HostEffectMask; + workInProgress = next; + return; + } // Keep unwinding until we reach either a boundary or the root. + + if ((incompleteWork.mode & ProfileMode) !== NoMode) { + // Record the render duration for the fiber that errored. + stopProfilerTimerIfRunningAndRecordDelta(incompleteWork, false); // Include the time spent working on failed children before continuing. + + var actualDuration = incompleteWork.actualDuration; + var child = incompleteWork.child; + + while (child !== null) { + // $FlowFixMe[unsafe-addition] addition with possible null/undefined value + actualDuration += child.actualDuration; + child = child.sibling; + } + + incompleteWork.actualDuration = actualDuration; + } // TODO: Once we stop prerendering siblings, instead of resetting the parent + // of the node being unwound, we should be able to reset node itself as we + // unwind the stack. Saves an additional null check. + + var returnFiber = incompleteWork.return; + + if (returnFiber !== null) { + // Mark the parent fiber as incomplete and clear its subtree flags. + // TODO: Once we stop prerendering siblings, we may be able to get rid of + // the Incomplete flag because unwinding to the nearest boundary will + // happen synchronously. + returnFiber.flags |= Incomplete; + returnFiber.subtreeFlags = NoFlags$1; + returnFiber.deletions = null; + } + + if (revertRemovalOfSiblingPrerendering) { + // If there are siblings, work on them now even though they're going to be + // replaced by a fallback. We're "prerendering" them. Historically our + // rationale for this behavior has been to initiate any lazy data requests + // in the siblings, and also to warm up the CPU cache. + // TODO: Don't prerender siblings. With `use`, we suspend the work loop + // until the data has resolved, anyway. + var siblingFiber = incompleteWork.sibling; + + if (siblingFiber !== null) { + // This branch will return us to the normal work loop. + workInProgress = siblingFiber; + return; + } + } // Otherwise, return to the parent + // $FlowFixMe[incompatible-type] we bail out when we get a null + + incompleteWork = returnFiber; // Update the next thing we're working on in case something throws. + + workInProgress = incompleteWork; + } while (incompleteWork !== null); // We've unwound all the way to the root. + + workInProgressRootExitStatus = RootDidNotComplete; + workInProgress = null; +} + function commitRoot(root, recoverableErrors, transitions) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. @@ -34050,7 +34124,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-10946e6a"; +var ReactVersion = "18.3.0-www-modern-9b4f00ba"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOMTesting-prod.classic.js b/compiled/facebook-www/ReactDOMTesting-prod.classic.js index 9caecb844b545..e6649dce2cc1f 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.classic.js @@ -23,6 +23,8 @@ var Scheduler = require("scheduler"), disableIEWorkarounds = dynamicFeatureFlags.disableIEWorkarounds, enableTrustedTypesIntegration = dynamicFeatureFlags.enableTrustedTypesIntegration, + revertRemovalOfSiblingPrerendering = + dynamicFeatureFlags.revertRemovalOfSiblingPrerendering, enableLegacyFBSupport = dynamicFeatureFlags.enableLegacyFBSupport, deferRenderPhaseUpdateToNextBatch = dynamicFeatureFlags.deferRenderPhaseUpdateToNextBatch, @@ -10939,7 +10941,7 @@ function renderRootSync(root, lanes) { default: (workInProgressSuspendedReason = 0), (workInProgressThrownValue = null), - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); } } workLoopSync(); @@ -10981,7 +10983,7 @@ function renderRootConcurrent(root, lanes) { case 1: workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 2: if (isThenableResolved(thrownValue)) { @@ -11011,7 +11013,7 @@ function renderRootConcurrent(root, lanes) { replaySuspendedUnitOfWork(lanes)) : ((workInProgressSuspendedReason = 0), (workInProgressThrownValue = null), - unwindSuspendedUnitOfWork(lanes, thrownValue)); + throwAndUnwindWorkLoop(lanes, thrownValue)); break; case 5: switch (workInProgress.tag) { @@ -11034,12 +11036,12 @@ function renderRootConcurrent(root, lanes) { } workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 6: workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 8: resetWorkInProgressStack(); @@ -11119,7 +11121,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { : (workInProgress = current); ReactCurrentOwner.current = null; } -function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { resetContextDependencies(); resetHooksOnUnwind(); thenableState$1 = null; @@ -11289,38 +11291,30 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { } catch (error) { throw ((workInProgress = returnFiber), error); } - completeUnitOfWork(unitOfWork); + unitOfWork.flags & 32768 + ? unwindUnitOfWork(unitOfWork) + : completeUnitOfWork(unitOfWork); } } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { - var current = completedWork.alternate; + if ( + revertRemovalOfSiblingPrerendering && + 0 !== (completedWork.flags & 32768) + ) { + unwindUnitOfWork(completedWork); + return; + } unitOfWork = completedWork.return; - if (0 === (completedWork.flags & 32768)) { - if ( - ((current = completeWork(current, completedWork, renderLanes)), - null !== current) - ) { - workInProgress = current; - return; - } - } else { - current = unwindWork(current, completedWork); - if (null !== current) { - current.flags &= 32767; - workInProgress = current; - return; - } - if (null !== unitOfWork) - (unitOfWork.flags |= 32768), - (unitOfWork.subtreeFlags = 0), - (unitOfWork.deletions = null); - else { - workInProgressRootExitStatus = 6; - workInProgress = null; - return; - } + var next = completeWork( + completedWork.alternate, + completedWork, + renderLanes + ); + if (null !== next) { + workInProgress = next; + return; } completedWork = completedWork.sibling; if (null !== completedWork) { @@ -11331,6 +11325,29 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } +function unwindUnitOfWork(unitOfWork) { + do { + var next = unwindWork(unitOfWork.alternate, unitOfWork); + if (null !== next) { + next.flags &= 32767; + workInProgress = next; + return; + } + next = unitOfWork.return; + null !== next && + ((next.flags |= 32768), (next.subtreeFlags = 0), (next.deletions = null)); + if ( + revertRemovalOfSiblingPrerendering && + ((unitOfWork = unitOfWork.sibling), null !== unitOfWork) + ) { + workInProgress = unitOfWork; + return; + } + workInProgress = unitOfWork = next; + } while (null !== unitOfWork); + workInProgressRootExitStatus = 6; + workInProgress = null; +} function commitRoot(root, recoverableErrors, transitions) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig$1.transition; @@ -11392,12 +11409,12 @@ function commitRootImpl( var prevExecutionContext = executionContext; executionContext |= 4; ReactCurrentOwner.current = null; - var shouldFireAfterActiveInstanceBlur$181 = commitBeforeMutationEffects( + var shouldFireAfterActiveInstanceBlur$180 = commitBeforeMutationEffects( root, finishedWork ); commitMutationEffectsOnFiber(finishedWork, root); - shouldFireAfterActiveInstanceBlur$181 && + shouldFireAfterActiveInstanceBlur$180 && ((_enabled = !0), dispatchAfterDetachedBlur(selectionInformation.focusedElem), (_enabled = !1)); @@ -11476,7 +11493,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects() { if (null !== rootWithPendingPassiveEffects) { - var root$182 = rootWithPendingPassiveEffects, + var root$181 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes); @@ -11492,7 +11509,7 @@ function flushPassiveEffects() { } finally { (currentUpdatePriority = previousPriority), (ReactCurrentBatchConfig$1.transition = prevTransition), - releaseRootPooledCache(root$182, remainingLanes); + releaseRootPooledCache(root$181, remainingLanes); } } return !1; @@ -12799,12 +12816,12 @@ function getPublicRootInstance(container) { function attemptSynchronousHydration(fiber) { switch (fiber.tag) { case 3: - var root$184 = fiber.stateNode; - if (root$184.current.memoizedState.isDehydrated) { - var lanes = getHighestPriorityLanes(root$184.pendingLanes); + var root$183 = fiber.stateNode; + if (root$183.current.memoizedState.isDehydrated) { + var lanes = getHighestPriorityLanes(root$183.pendingLanes); 0 !== lanes && - (markRootEntangled(root$184, lanes | 2), - ensureRootIsScheduled(root$184, now()), + (markRootEntangled(root$183, lanes | 2), + ensureRootIsScheduled(root$183, now()), 0 === (executionContext & 6) && ((workInProgressRootRenderTargetTime = now() + 500), flushSyncCallbacks())); @@ -12923,11 +12940,11 @@ function legacyCreateRootFromDOMContainer( if ("function" === typeof callback) { var originalCallback = callback; callback = function () { - var instance = getPublicRootInstance(root$185); + var instance = getPublicRootInstance(root$184); originalCallback.call(instance); }; } - var root$185 = createHydrationContainer( + var root$184 = createHydrationContainer( initialChildren, callback, container, @@ -12939,23 +12956,23 @@ function legacyCreateRootFromDOMContainer( noopOnRecoverableError, null ); - container._reactRootContainer = root$185; - container[internalContainerInstanceKey] = root$185.current; + container._reactRootContainer = root$184; + container[internalContainerInstanceKey] = root$184.current; listenToAllSupportedEvents( 8 === container.nodeType ? container.parentNode : container ); flushSync$1(); - return root$185; + return root$184; } clearContainer(container); if ("function" === typeof callback) { - var originalCallback$186 = callback; + var originalCallback$185 = callback; callback = function () { - var instance = getPublicRootInstance(root$187); - originalCallback$186.call(instance); + var instance = getPublicRootInstance(root$186); + originalCallback$185.call(instance); }; } - var root$187 = createFiberRoot( + var root$186 = createFiberRoot( container, 0, !1, @@ -12967,15 +12984,15 @@ function legacyCreateRootFromDOMContainer( noopOnRecoverableError, null ); - container._reactRootContainer = root$187; - container[internalContainerInstanceKey] = root$187.current; + container._reactRootContainer = root$186; + container[internalContainerInstanceKey] = root$186.current; listenToAllSupportedEvents( 8 === container.nodeType ? container.parentNode : container ); flushSync$1(function () { - updateContainer(initialChildren, root$187, parentComponent, callback); + updateContainer(initialChildren, root$186, parentComponent, callback); }); - return root$187; + return root$186; } function legacyRenderSubtreeIntoContainer( parentComponent, @@ -13094,17 +13111,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1639 = { +var devToolsConfig$jscomp$inline_1638 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-26dea44b", + version: "18.3.0-www-classic-f4456f06", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2197 = { - bundleType: devToolsConfig$jscomp$inline_1639.bundleType, - version: devToolsConfig$jscomp$inline_1639.version, - rendererPackageName: devToolsConfig$jscomp$inline_1639.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1639.rendererConfig, +var internals$jscomp$inline_2196 = { + bundleType: devToolsConfig$jscomp$inline_1638.bundleType, + version: devToolsConfig$jscomp$inline_1638.version, + rendererPackageName: devToolsConfig$jscomp$inline_1638.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1638.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -13120,26 +13137,26 @@ var internals$jscomp$inline_2197 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1639.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1638.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-26dea44b" + reconcilerVersion: "18.3.0-www-classic-f4456f06" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2198 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2197 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2198.isDisabled && - hook$jscomp$inline_2198.supportsFiber + !hook$jscomp$inline_2197.isDisabled && + hook$jscomp$inline_2197.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2198.inject( - internals$jscomp$inline_2197 + (rendererID = hook$jscomp$inline_2197.inject( + internals$jscomp$inline_2196 )), - (injectedHook = hook$jscomp$inline_2198); + (injectedHook = hook$jscomp$inline_2197); } catch (err) {} } var Dispatcher = Internals.Dispatcher, @@ -13258,12 +13275,12 @@ function preinit(href, options) { switch (as) { case "style": as = getResourcesFromRoot(resourceRoot).hoistableStyles; - var key$192 = getStyleKey(href), + var key$191 = getStyleKey(href), precedence = options.precedence || "default", - resource = as.get(key$192); + resource = as.get(key$191); if (resource) break; resource = resourceRoot.querySelector( - getStylesheetSelectorFromKey(key$192) + getStylesheetSelectorFromKey(key$191) ); resource || ((href = { @@ -13272,7 +13289,7 @@ function preinit(href, options) { "data-precedence": precedence, crossOrigin: options.crossOrigin }), - (options = preloadPropsMap.get(key$192)) && + (options = preloadPropsMap.get(key$191)) && adoptPreloadPropsForStylesheet(href, options), (resource = ( resourceRoot.ownerDocument || resourceRoot @@ -13281,15 +13298,15 @@ function preinit(href, options) { setInitialProperties(resource, "link", href), insertStylesheet(resource, precedence, resourceRoot)); resource = { type: "stylesheet", instance: resource, count: 1 }; - as.set(key$192, resource); + as.set(key$191, resource); break; case "script": (as = getResourcesFromRoot(resourceRoot).hoistableScripts), - (key$192 = getScriptKey(href)), - (precedence = as.get(key$192)), + (key$191 = getScriptKey(href)), + (precedence = as.get(key$191)), precedence || ((precedence = resourceRoot.querySelector( - "script[async]" + key$192 + "script[async]" + key$191 )), precedence || ((href = { @@ -13298,7 +13315,7 @@ function preinit(href, options) { crossOrigin: options.crossOrigin, integrity: options.integrity }), - (options = preloadPropsMap.get(key$192)) && + (options = preloadPropsMap.get(key$191)) && adoptPreloadPropsForScript(href, options), (options = resourceRoot.ownerDocument || resourceRoot), (precedence = options.createElement("script")), @@ -13306,13 +13323,13 @@ function preinit(href, options) { setInitialProperties(precedence, "link", href), options.head.appendChild(precedence)), (precedence = { type: "script", instance: precedence, count: 1 }), - as.set(key$192, precedence)); + as.set(key$191, precedence)); } else if ("style" === as || "script" === as) if ((resourceRoot = getDocumentForPreloads())) { - key$192 = escapeSelectorAttributeValueInsideDoubleQuotes(href); - precedence = key$192 = - 'link[rel="preload"][as="' + as + '"][href="' + key$192 + '"]'; + key$191 = escapeSelectorAttributeValueInsideDoubleQuotes(href); + precedence = key$191 = + 'link[rel="preload"][as="' + as + '"][href="' + key$191 + '"]'; switch (as) { case "style": precedence = getStyleKey(href); @@ -13329,7 +13346,7 @@ function preinit(href, options) { integrity: options.integrity }), preloadPropsMap.set(precedence, href), - null === resourceRoot.querySelector(key$192) && + null === resourceRoot.querySelector(key$191) && ((options = resourceRoot.createElement("link")), setInitialProperties(options, "link", href), markNodeAsHoistable(options), @@ -13361,14 +13378,14 @@ function getResource(type, currentProps, pendingProps) { "string" === typeof pendingProps.href && "string" === typeof pendingProps.precedence ) { - var key$199 = getStyleKey(pendingProps.href), - styles$200 = getResourcesFromRoot(currentProps).hoistableStyles; - type = styles$200.get(key$199); + var key$198 = getStyleKey(pendingProps.href), + styles$199 = getResourcesFromRoot(currentProps).hoistableStyles; + type = styles$199.get(key$198); type || ((currentProps = currentProps.ownerDocument || currentProps), (type = { type: "stylesheet", instance: null, count: 0 }), - styles$200.set(key$199, type), - preloadPropsMap.has(key$199) || + styles$199.set(key$198, type), + preloadPropsMap.has(key$198) || ((pendingProps = { rel: "preload", as: "style", @@ -13379,16 +13396,16 @@ function getResource(type, currentProps, pendingProps) { hrefLang: pendingProps.hrefLang, referrerPolicy: pendingProps.referrerPolicy }), - preloadPropsMap.set(key$199, pendingProps), - currentProps.querySelector(getStylesheetSelectorFromKey(key$199)) || + preloadPropsMap.set(key$198, pendingProps), + currentProps.querySelector(getStylesheetSelectorFromKey(key$198)) || null !== currentProps.querySelector( - 'link[rel="preload"][as="style"][' + key$199 + "]" + 'link[rel="preload"][as="style"][' + key$198 + "]" ) || - ((key$199 = currentProps.createElement("link")), - setInitialProperties(key$199, "link", pendingProps), - markNodeAsHoistable(key$199), - currentProps.head.appendChild(key$199)))); + ((key$198 = currentProps.createElement("link")), + setInitialProperties(key$198, "link", pendingProps), + markNodeAsHoistable(key$198), + currentProps.head.appendChild(key$198)))); return type; } return null; @@ -13438,14 +13455,14 @@ function acquireResource(hoistableRoot, resource, props) { return (resource.instance = key); case "stylesheet": styleProps = getStyleKey(props.href); - var instance$207 = hoistableRoot.querySelector( + var instance$206 = hoistableRoot.querySelector( getStylesheetSelectorFromKey(styleProps) ); - if (instance$207) + if (instance$206) return ( - (resource.instance = instance$207), - markNodeAsHoistable(instance$207), - instance$207 + (resource.instance = instance$206), + markNodeAsHoistable(instance$206), + instance$206 ); key = assign({}, props, { "data-precedence": props.precedence, @@ -13453,11 +13470,11 @@ function acquireResource(hoistableRoot, resource, props) { }); (styleProps = preloadPropsMap.get(styleProps)) && adoptPreloadPropsForStylesheet(key, styleProps); - instance$207 = ( + instance$206 = ( hoistableRoot.ownerDocument || hoistableRoot ).createElement("link"); - markNodeAsHoistable(instance$207); - var linkInstance = instance$207; + markNodeAsHoistable(instance$206); + var linkInstance = instance$206; linkInstance._p = new Promise(function (resolve, reject) { linkInstance.onload = resolve; linkInstance.onerror = reject; @@ -13469,14 +13486,14 @@ function acquireResource(hoistableRoot, resource, props) { return (linkInstance._p.s = "e"); } ); - setInitialProperties(instance$207, "link", key); - insertStylesheet(instance$207, props.precedence, hoistableRoot); - return (resource.instance = instance$207); + setInitialProperties(instance$206, "link", key); + insertStylesheet(instance$206, props.precedence, hoistableRoot); + return (resource.instance = instance$206); case "script": - instance$207 = getScriptKey(props.src); + instance$206 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - "script[async]" + instance$207 + "script[async]" + instance$206 )) ) return ( @@ -13485,7 +13502,7 @@ function acquireResource(hoistableRoot, resource, props) { styleProps ); key = props; - if ((styleProps = preloadPropsMap.get(instance$207))) + if ((styleProps = preloadPropsMap.get(instance$206))) (key = assign({}, props)), adoptPreloadPropsForScript(key, styleProps); hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot; @@ -14519,19 +14536,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$325; + var JSCompiler_inline_result$jscomp$324; if (canUseDOM) { - var isSupported$jscomp$inline_1716 = "oninput" in document; - if (!isSupported$jscomp$inline_1716) { - var element$jscomp$inline_1717 = document.createElement("div"); - element$jscomp$inline_1717.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1716 = - "function" === typeof element$jscomp$inline_1717.oninput; + var isSupported$jscomp$inline_1715 = "oninput" in document; + if (!isSupported$jscomp$inline_1715) { + var element$jscomp$inline_1716 = document.createElement("div"); + element$jscomp$inline_1716.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1715 = + "function" === typeof element$jscomp$inline_1716.oninput; } - JSCompiler_inline_result$jscomp$325 = isSupported$jscomp$inline_1716; - } else JSCompiler_inline_result$jscomp$325 = !1; + JSCompiler_inline_result$jscomp$324 = isSupported$jscomp$inline_1715; + } else JSCompiler_inline_result$jscomp$324 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$325 && + JSCompiler_inline_result$jscomp$324 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -14669,20 +14686,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1729 = 0; - i$jscomp$inline_1729 < simpleEventPluginEvents.length; - i$jscomp$inline_1729++ + var i$jscomp$inline_1728 = 0; + i$jscomp$inline_1728 < simpleEventPluginEvents.length; + i$jscomp$inline_1728++ ) { - var eventName$jscomp$inline_1730 = - simpleEventPluginEvents[i$jscomp$inline_1729], - domEventName$jscomp$inline_1731 = - eventName$jscomp$inline_1730.toLowerCase(), - capitalizedEvent$jscomp$inline_1732 = - eventName$jscomp$inline_1730[0].toUpperCase() + - eventName$jscomp$inline_1730.slice(1); + var eventName$jscomp$inline_1729 = + simpleEventPluginEvents[i$jscomp$inline_1728], + domEventName$jscomp$inline_1730 = + eventName$jscomp$inline_1729.toLowerCase(), + capitalizedEvent$jscomp$inline_1731 = + eventName$jscomp$inline_1729[0].toUpperCase() + + eventName$jscomp$inline_1729.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1731, - "on" + capitalizedEvent$jscomp$inline_1732 + domEventName$jscomp$inline_1730, + "on" + capitalizedEvent$jscomp$inline_1731 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16559,4 +16576,4 @@ exports.unstable_renderSubtreeIntoContainer = function ( ); }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-classic-26dea44b"; +exports.version = "18.3.0-www-classic-f4456f06"; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.modern.js b/compiled/facebook-www/ReactDOMTesting-prod.modern.js index e4e20b5da659f..5af75db29534c 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.modern.js @@ -43,6 +43,8 @@ var dynamicFeatureFlags = require("ReactFeatureFlags"), disableIEWorkarounds = dynamicFeatureFlags.disableIEWorkarounds, enableTrustedTypesIntegration = dynamicFeatureFlags.enableTrustedTypesIntegration, + revertRemovalOfSiblingPrerendering = + dynamicFeatureFlags.revertRemovalOfSiblingPrerendering, enableLegacyFBSupport = dynamicFeatureFlags.enableLegacyFBSupport, deferRenderPhaseUpdateToNextBatch = dynamicFeatureFlags.deferRenderPhaseUpdateToNextBatch, @@ -7401,7 +7403,7 @@ function commitBeforeMutationEffects(root, firstChild) { selection = selection.focusOffset; try { JSCompiler_temp.nodeType, focusNode.nodeType; - } catch (e$190) { + } catch (e$189) { JSCompiler_temp = null; break a; } @@ -10462,7 +10464,7 @@ function renderRootSync(root, lanes) { default: (workInProgressSuspendedReason = 0), (workInProgressThrownValue = null), - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); } } workLoopSync(); @@ -10504,7 +10506,7 @@ function renderRootConcurrent(root, lanes) { case 1: workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 2: if (isThenableResolved(thrownValue)) { @@ -10534,7 +10536,7 @@ function renderRootConcurrent(root, lanes) { replaySuspendedUnitOfWork(lanes)) : ((workInProgressSuspendedReason = 0), (workInProgressThrownValue = null), - unwindSuspendedUnitOfWork(lanes, thrownValue)); + throwAndUnwindWorkLoop(lanes, thrownValue)); break; case 5: switch (workInProgress.tag) { @@ -10557,12 +10559,12 @@ function renderRootConcurrent(root, lanes) { } workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 6: workInProgressSuspendedReason = 0; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(lanes, thrownValue); + throwAndUnwindWorkLoop(lanes, thrownValue); break; case 8: resetWorkInProgressStack(); @@ -10642,7 +10644,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { : (workInProgress = current); ReactCurrentOwner.current = null; } -function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { resetContextDependencies(); resetHooksOnUnwind(); thenableState$1 = null; @@ -10812,38 +10814,30 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { } catch (error) { throw ((workInProgress = returnFiber), error); } - completeUnitOfWork(unitOfWork); + unitOfWork.flags & 32768 + ? unwindUnitOfWork(unitOfWork) + : completeUnitOfWork(unitOfWork); } } function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { - var current = completedWork.alternate; + if ( + revertRemovalOfSiblingPrerendering && + 0 !== (completedWork.flags & 32768) + ) { + unwindUnitOfWork(completedWork); + return; + } unitOfWork = completedWork.return; - if (0 === (completedWork.flags & 32768)) { - if ( - ((current = completeWork(current, completedWork, renderLanes)), - null !== current) - ) { - workInProgress = current; - return; - } - } else { - current = unwindWork(current, completedWork); - if (null !== current) { - current.flags &= 32767; - workInProgress = current; - return; - } - if (null !== unitOfWork) - (unitOfWork.flags |= 32768), - (unitOfWork.subtreeFlags = 0), - (unitOfWork.deletions = null); - else { - workInProgressRootExitStatus = 6; - workInProgress = null; - return; - } + var next = completeWork( + completedWork.alternate, + completedWork, + renderLanes + ); + if (null !== next) { + workInProgress = next; + return; } completedWork = completedWork.sibling; if (null !== completedWork) { @@ -10854,6 +10848,29 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } +function unwindUnitOfWork(unitOfWork) { + do { + var next = unwindWork(unitOfWork.alternate, unitOfWork); + if (null !== next) { + next.flags &= 32767; + workInProgress = next; + return; + } + next = unitOfWork.return; + null !== next && + ((next.flags |= 32768), (next.subtreeFlags = 0), (next.deletions = null)); + if ( + revertRemovalOfSiblingPrerendering && + ((unitOfWork = unitOfWork.sibling), null !== unitOfWork) + ) { + workInProgress = unitOfWork; + return; + } + workInProgress = unitOfWork = next; + } while (null !== unitOfWork); + workInProgressRootExitStatus = 6; + workInProgress = null; +} function commitRoot(root, recoverableErrors, transitions) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig$1.transition; @@ -10915,12 +10932,12 @@ function commitRootImpl( var prevExecutionContext = executionContext; executionContext |= 4; ReactCurrentOwner.current = null; - var shouldFireAfterActiveInstanceBlur$179 = commitBeforeMutationEffects( + var shouldFireAfterActiveInstanceBlur$178 = commitBeforeMutationEffects( root, finishedWork ); commitMutationEffectsOnFiber(finishedWork, root); - shouldFireAfterActiveInstanceBlur$179 && + shouldFireAfterActiveInstanceBlur$178 && ((_enabled = !0), dispatchAfterDetachedBlur(selectionInformation.focusedElem), (_enabled = !1)); @@ -10999,7 +11016,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects() { if (null !== rootWithPendingPassiveEffects) { - var root$180 = rootWithPendingPassiveEffects, + var root$179 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes); @@ -11015,7 +11032,7 @@ function flushPassiveEffects() { } finally { (currentUpdatePriority = previousPriority), (ReactCurrentBatchConfig$1.transition = prevTransition), - releaseRootPooledCache(root$180, remainingLanes); + releaseRootPooledCache(root$179, remainingLanes); } } return !1; @@ -12208,12 +12225,12 @@ function updateContainer(element, container, parentComponent, callback) { function attemptSynchronousHydration(fiber) { switch (fiber.tag) { case 3: - var root$182 = fiber.stateNode; - if (root$182.current.memoizedState.isDehydrated) { - var lanes = getHighestPriorityLanes(root$182.pendingLanes); + var root$181 = fiber.stateNode; + if (root$181.current.memoizedState.isDehydrated) { + var lanes = getHighestPriorityLanes(root$181.pendingLanes); 0 !== lanes && - (markRootEntangled(root$182, lanes | 2), - ensureRootIsScheduled(root$182, now()), + (markRootEntangled(root$181, lanes | 2), + ensureRootIsScheduled(root$181, now()), 0 === (executionContext & 6) && ((workInProgressRootRenderTargetTime = now() + 500), flushSyncCallbacks())); @@ -13487,19 +13504,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$301; + var JSCompiler_inline_result$jscomp$300; if (canUseDOM) { - var isSupported$jscomp$inline_1555 = "oninput" in document; - if (!isSupported$jscomp$inline_1555) { - var element$jscomp$inline_1556 = document.createElement("div"); - element$jscomp$inline_1556.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1555 = - "function" === typeof element$jscomp$inline_1556.oninput; + var isSupported$jscomp$inline_1554 = "oninput" in document; + if (!isSupported$jscomp$inline_1554) { + var element$jscomp$inline_1555 = document.createElement("div"); + element$jscomp$inline_1555.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1554 = + "function" === typeof element$jscomp$inline_1555.oninput; } - JSCompiler_inline_result$jscomp$301 = isSupported$jscomp$inline_1555; - } else JSCompiler_inline_result$jscomp$301 = !1; + JSCompiler_inline_result$jscomp$300 = isSupported$jscomp$inline_1554; + } else JSCompiler_inline_result$jscomp$300 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$301 && + JSCompiler_inline_result$jscomp$300 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -13808,20 +13825,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1596 = 0; - i$jscomp$inline_1596 < simpleEventPluginEvents.length; - i$jscomp$inline_1596++ + var i$jscomp$inline_1595 = 0; + i$jscomp$inline_1595 < simpleEventPluginEvents.length; + i$jscomp$inline_1595++ ) { - var eventName$jscomp$inline_1597 = - simpleEventPluginEvents[i$jscomp$inline_1596], - domEventName$jscomp$inline_1598 = - eventName$jscomp$inline_1597.toLowerCase(), - capitalizedEvent$jscomp$inline_1599 = - eventName$jscomp$inline_1597[0].toUpperCase() + - eventName$jscomp$inline_1597.slice(1); + var eventName$jscomp$inline_1596 = + simpleEventPluginEvents[i$jscomp$inline_1595], + domEventName$jscomp$inline_1597 = + eventName$jscomp$inline_1596.toLowerCase(), + capitalizedEvent$jscomp$inline_1598 = + eventName$jscomp$inline_1596[0].toUpperCase() + + eventName$jscomp$inline_1596.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1598, - "on" + capitalizedEvent$jscomp$inline_1599 + domEventName$jscomp$inline_1597, + "on" + capitalizedEvent$jscomp$inline_1598 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -15012,12 +15029,12 @@ function preinit$1(href, options) { switch (as) { case "style": as = getResourcesFromRoot(resourceRoot).hoistableStyles; - var key$202 = getStyleKey(href), + var key$201 = getStyleKey(href), precedence = options.precedence || "default", - resource = as.get(key$202); + resource = as.get(key$201); if (resource) break; resource = resourceRoot.querySelector( - getStylesheetSelectorFromKey(key$202) + getStylesheetSelectorFromKey(key$201) ); resource || ((href = { @@ -15026,7 +15043,7 @@ function preinit$1(href, options) { "data-precedence": precedence, crossOrigin: options.crossOrigin }), - (options = preloadPropsMap.get(key$202)) && + (options = preloadPropsMap.get(key$201)) && adoptPreloadPropsForStylesheet(href, options), (resource = ( resourceRoot.ownerDocument || resourceRoot @@ -15035,15 +15052,15 @@ function preinit$1(href, options) { setInitialProperties(resource, "link", href), insertStylesheet(resource, precedence, resourceRoot)); resource = { type: "stylesheet", instance: resource, count: 1 }; - as.set(key$202, resource); + as.set(key$201, resource); break; case "script": (as = getResourcesFromRoot(resourceRoot).hoistableScripts), - (key$202 = getScriptKey(href)), - (precedence = as.get(key$202)), + (key$201 = getScriptKey(href)), + (precedence = as.get(key$201)), precedence || ((precedence = resourceRoot.querySelector( - "script[async]" + key$202 + "script[async]" + key$201 )), precedence || ((href = { @@ -15052,7 +15069,7 @@ function preinit$1(href, options) { crossOrigin: options.crossOrigin, integrity: options.integrity }), - (options = preloadPropsMap.get(key$202)) && + (options = preloadPropsMap.get(key$201)) && adoptPreloadPropsForScript(href, options), (options = resourceRoot.ownerDocument || resourceRoot), (precedence = options.createElement("script")), @@ -15060,13 +15077,13 @@ function preinit$1(href, options) { setInitialProperties(precedence, "link", href), options.head.appendChild(precedence)), (precedence = { type: "script", instance: precedence, count: 1 }), - as.set(key$202, precedence)); + as.set(key$201, precedence)); } else if ("style" === as || "script" === as) if ((resourceRoot = getDocumentForPreloads())) { - key$202 = escapeSelectorAttributeValueInsideDoubleQuotes(href); - precedence = key$202 = - 'link[rel="preload"][as="' + as + '"][href="' + key$202 + '"]'; + key$201 = escapeSelectorAttributeValueInsideDoubleQuotes(href); + precedence = key$201 = + 'link[rel="preload"][as="' + as + '"][href="' + key$201 + '"]'; switch (as) { case "style": precedence = getStyleKey(href); @@ -15083,7 +15100,7 @@ function preinit$1(href, options) { integrity: options.integrity }), preloadPropsMap.set(precedence, href), - null === resourceRoot.querySelector(key$202) && + null === resourceRoot.querySelector(key$201) && ((options = resourceRoot.createElement("link")), setInitialProperties(options, "link", href), markNodeAsHoistable(options), @@ -15115,14 +15132,14 @@ function getResource(type, currentProps, pendingProps) { "string" === typeof pendingProps.href && "string" === typeof pendingProps.precedence ) { - var key$209 = getStyleKey(pendingProps.href), - styles$210 = getResourcesFromRoot(currentProps).hoistableStyles; - type = styles$210.get(key$209); + var key$208 = getStyleKey(pendingProps.href), + styles$209 = getResourcesFromRoot(currentProps).hoistableStyles; + type = styles$209.get(key$208); type || ((currentProps = currentProps.ownerDocument || currentProps), (type = { type: "stylesheet", instance: null, count: 0 }), - styles$210.set(key$209, type), - preloadPropsMap.has(key$209) || + styles$209.set(key$208, type), + preloadPropsMap.has(key$208) || ((pendingProps = { rel: "preload", as: "style", @@ -15133,16 +15150,16 @@ function getResource(type, currentProps, pendingProps) { hrefLang: pendingProps.hrefLang, referrerPolicy: pendingProps.referrerPolicy }), - preloadPropsMap.set(key$209, pendingProps), - currentProps.querySelector(getStylesheetSelectorFromKey(key$209)) || + preloadPropsMap.set(key$208, pendingProps), + currentProps.querySelector(getStylesheetSelectorFromKey(key$208)) || null !== currentProps.querySelector( - 'link[rel="preload"][as="style"][' + key$209 + "]" + 'link[rel="preload"][as="style"][' + key$208 + "]" ) || - ((key$209 = currentProps.createElement("link")), - setInitialProperties(key$209, "link", pendingProps), - markNodeAsHoistable(key$209), - currentProps.head.appendChild(key$209)))); + ((key$208 = currentProps.createElement("link")), + setInitialProperties(key$208, "link", pendingProps), + markNodeAsHoistable(key$208), + currentProps.head.appendChild(key$208)))); return type; } return null; @@ -15192,14 +15209,14 @@ function acquireResource(hoistableRoot, resource, props) { return (resource.instance = key); case "stylesheet": styleProps = getStyleKey(props.href); - var instance$217 = hoistableRoot.querySelector( + var instance$216 = hoistableRoot.querySelector( getStylesheetSelectorFromKey(styleProps) ); - if (instance$217) + if (instance$216) return ( - (resource.instance = instance$217), - markNodeAsHoistable(instance$217), - instance$217 + (resource.instance = instance$216), + markNodeAsHoistable(instance$216), + instance$216 ); key = assign({}, props, { "data-precedence": props.precedence, @@ -15207,11 +15224,11 @@ function acquireResource(hoistableRoot, resource, props) { }); (styleProps = preloadPropsMap.get(styleProps)) && adoptPreloadPropsForStylesheet(key, styleProps); - instance$217 = ( + instance$216 = ( hoistableRoot.ownerDocument || hoistableRoot ).createElement("link"); - markNodeAsHoistable(instance$217); - var linkInstance = instance$217; + markNodeAsHoistable(instance$216); + var linkInstance = instance$216; linkInstance._p = new Promise(function (resolve, reject) { linkInstance.onload = resolve; linkInstance.onerror = reject; @@ -15223,14 +15240,14 @@ function acquireResource(hoistableRoot, resource, props) { return (linkInstance._p.s = "e"); } ); - setInitialProperties(instance$217, "link", key); - insertStylesheet(instance$217, props.precedence, hoistableRoot); - return (resource.instance = instance$217); + setInitialProperties(instance$216, "link", key); + insertStylesheet(instance$216, props.precedence, hoistableRoot); + return (resource.instance = instance$216); case "script": - instance$217 = getScriptKey(props.src); + instance$216 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - "script[async]" + instance$217 + "script[async]" + instance$216 )) ) return ( @@ -15239,7 +15256,7 @@ function acquireResource(hoistableRoot, resource, props) { styleProps ); key = props; - if ((styleProps = preloadPropsMap.get(instance$217))) + if ((styleProps = preloadPropsMap.get(instance$216))) (key = assign({}, props)), adoptPreloadPropsForScript(key, styleProps); hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot; @@ -15717,17 +15734,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1775 = { +var devToolsConfig$jscomp$inline_1774 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-1423f459", + version: "18.3.0-www-modern-0d5680f8", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2178 = { - bundleType: devToolsConfig$jscomp$inline_1775.bundleType, - version: devToolsConfig$jscomp$inline_1775.version, - rendererPackageName: devToolsConfig$jscomp$inline_1775.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1775.rendererConfig, +var internals$jscomp$inline_2177 = { + bundleType: devToolsConfig$jscomp$inline_1774.bundleType, + version: devToolsConfig$jscomp$inline_1774.version, + rendererPackageName: devToolsConfig$jscomp$inline_1774.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1774.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -15744,26 +15761,26 @@ var internals$jscomp$inline_2178 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1775.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1774.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-1423f459" + reconcilerVersion: "18.3.0-www-modern-0d5680f8" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2179 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2178 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2179.isDisabled && - hook$jscomp$inline_2179.supportsFiber + !hook$jscomp$inline_2178.isDisabled && + hook$jscomp$inline_2178.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2179.inject( - internals$jscomp$inline_2178 + (rendererID = hook$jscomp$inline_2178.inject( + internals$jscomp$inline_2177 )), - (injectedHook = hook$jscomp$inline_2179); + (injectedHook = hook$jscomp$inline_2178); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; @@ -16071,4 +16088,4 @@ exports.unstable_createEventHandle = function (type, options) { return eventHandle; }; exports.unstable_runWithPriority = runWithPriority; -exports.version = "18.3.0-www-modern-1423f459"; +exports.version = "18.3.0-www-modern-0d5680f8"; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.classic.js b/compiled/facebook-www/ReactTestRenderer-dev.classic.js index dc98b82e6e980..94177ba73766e 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.classic.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.classic.js @@ -21415,10 +21415,10 @@ function renderRootSync(root, lanes) { } default: { - // Continue with the normal work loop. + // Unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } } @@ -21489,7 +21489,7 @@ function renderRootConcurrent(root, lanes) { // Unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -21554,7 +21554,7 @@ function renderRootConcurrent(root, lanes) { // Otherwise, unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); } break; @@ -21619,7 +21619,7 @@ function renderRootConcurrent(root, lanes) { workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -21630,7 +21630,7 @@ function renderRootConcurrent(root, lanes) { // always unwind. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -21817,7 +21817,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { ReactCurrentOwner.current = null; } -function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { // This is a fork of performUnitOfWork specifcally for unwinding a fiber // that threw an exception. // @@ -21860,9 +21860,23 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { // To prevent an infinite loop, bubble the error up to the next parent. workInProgress = returnFiber; throw error; - } // Return to the normal work loop. + } - completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & Incomplete) { + // Unwind the stack until we reach the nearest boundary. + unwindUnitOfWork(unitOfWork); + } else { + // Although the fiber suspended, we're intentionally going to commit it in + // an inconsistent state. We can do this safely in cases where we know the + // inconsistent tree will be hidden. + // + // This currently only applies to Legacy Suspense implementation, but we may + // port a version of this to concurrent roots, too, when performing a + // synchronous render. Because that will allow us to mutate the tree as we + // go instead of buffering mutations until the end. Though it's unclear if + // this particular path is how that would be implemented. + completeUnitOfWork(unitOfWork); + } } function completeUnitOfWork(unitOfWork) { @@ -21871,75 +21885,41 @@ function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { - // The current, flushed, state of this fiber is the alternate. Ideally + { + { + if ((completedWork.flags & Incomplete) !== NoFlags$1) { + // NOTE: If we re-enable sibling prerendering in some cases, this branch + // is where we would switch to the unwinding path. + error( + "Internal React error: Expected this fiber to be complete, but " + + "it isn't. It should have been unwound. This is a bug in React." + ); + } + } + } // The current, flushed, state of this fiber is the alternate. Ideally // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. - var current = completedWork.alternate; - var returnFiber = completedWork.return; // Check if the work completed or if something threw. - if ((completedWork.flags & Incomplete) === NoFlags$1) { - setCurrentFiber(completedWork); - var next = void 0; - - if ((completedWork.mode & ProfileMode) === NoMode) { - next = completeWork(current, completedWork, renderLanes); - } else { - startProfilerTimer(completedWork); - next = completeWork(current, completedWork, renderLanes); // Update render duration assuming we didn't error. - - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); - } - - resetCurrentFiber(); + var current = completedWork.alternate; + var returnFiber = completedWork.return; + setCurrentFiber(completedWork); + var next = void 0; - if (next !== null) { - // Completing this fiber spawned new work. Work on that next. - workInProgress = next; - return; - } + if ((completedWork.mode & ProfileMode) === NoMode) { + next = completeWork(current, completedWork, renderLanes); } else { - // This fiber did not complete because something threw. Pop values off - // the stack without entering the complete phase. If this is a boundary, - // capture values if possible. - var _next = unwindWork(current, completedWork); // Because this fiber did not complete, don't reset its lanes. - - if (_next !== null) { - // If completing this work spawned new work, do that next. We'll come - // back here again. - // Since we're restarting, remove anything that is not a host effect - // from the effect tag. - _next.flags &= HostEffectMask; - workInProgress = _next; - return; - } + startProfilerTimer(completedWork); + next = completeWork(current, completedWork, renderLanes); // Update render duration assuming we didn't error. - if ((completedWork.mode & ProfileMode) !== NoMode) { - // Record the render duration for the fiber that errored. - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing. - - var actualDuration = completedWork.actualDuration; - var child = completedWork.child; - - while (child !== null) { - // $FlowFixMe[unsafe-addition] addition with possible null/undefined value - actualDuration += child.actualDuration; - child = child.sibling; - } + stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); + } - completedWork.actualDuration = actualDuration; - } + resetCurrentFiber(); - if (returnFiber !== null) { - // Mark the parent fiber as incomplete and clear its subtree flags. - returnFiber.flags |= Incomplete; - returnFiber.subtreeFlags = NoFlags$1; - returnFiber.deletions = null; - } else { - // We've unwound all the way to the root. - workInProgressRootExitStatus = RootDidNotComplete; - workInProgress = null; - return; - } + if (next !== null) { + // Completing this fiber spawned new work. Work on that next. + workInProgress = next; + return; } var siblingFiber = completedWork.sibling; @@ -21961,6 +21941,70 @@ function completeUnitOfWork(unitOfWork) { } } +function unwindUnitOfWork(unitOfWork) { + var incompleteWork = unitOfWork; + + do { + // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. + var current = incompleteWork.alternate; // This fiber did not complete because something threw. Pop values off + // the stack without entering the complete phase. If this is a boundary, + // capture values if possible. + + var next = unwindWork(current, incompleteWork); // Because this fiber did not complete, don't reset its lanes. + + if (next !== null) { + // Found a boundary that can handle this exception. Re-renter the + // begin phase. This branch will return us to the normal work loop. + // + // Since we're restarting, remove anything that is not a host effect + // from the effect tag. + next.flags &= HostEffectMask; + workInProgress = next; + return; + } // Keep unwinding until we reach either a boundary or the root. + + if ((incompleteWork.mode & ProfileMode) !== NoMode) { + // Record the render duration for the fiber that errored. + stopProfilerTimerIfRunningAndRecordDelta(incompleteWork, false); // Include the time spent working on failed children before continuing. + + var actualDuration = incompleteWork.actualDuration; + var child = incompleteWork.child; + + while (child !== null) { + // $FlowFixMe[unsafe-addition] addition with possible null/undefined value + actualDuration += child.actualDuration; + child = child.sibling; + } + + incompleteWork.actualDuration = actualDuration; + } // TODO: Once we stop prerendering siblings, instead of resetting the parent + // of the node being unwound, we should be able to reset node itself as we + // unwind the stack. Saves an additional null check. + + var returnFiber = incompleteWork.return; + + if (returnFiber !== null) { + // Mark the parent fiber as incomplete and clear its subtree flags. + // TODO: Once we stop prerendering siblings, we may be able to get rid of + // the Incomplete flag because unwinding to the nearest boundary will + // happen synchronously. + returnFiber.flags |= Incomplete; + returnFiber.subtreeFlags = NoFlags$1; + returnFiber.deletions = null; + } + // $FlowFixMe[incompatible-type] we bail out when we get a null + + incompleteWork = returnFiber; // Update the next thing we're working on in case something throws. + + workInProgress = incompleteWork; + } while (incompleteWork !== null); // We've unwound all the way to the root. + + workInProgressRootExitStatus = RootDidNotComplete; + workInProgress = null; +} + function commitRoot(root, recoverableErrors, transitions) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. @@ -24198,7 +24242,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-2f2686b2"; +var ReactVersion = "18.3.0-www-classic-0c193767"; // Might add PROFILE later. diff --git a/compiled/facebook-www/ReactTestRenderer-dev.modern.js b/compiled/facebook-www/ReactTestRenderer-dev.modern.js index 97eb89b15c0c6..c37cf81f372b2 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.modern.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.modern.js @@ -21415,10 +21415,10 @@ function renderRootSync(root, lanes) { } default: { - // Continue with the normal work loop. + // Unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } } @@ -21489,7 +21489,7 @@ function renderRootConcurrent(root, lanes) { // Unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -21554,7 +21554,7 @@ function renderRootConcurrent(root, lanes) { // Otherwise, unwind then continue with the normal work loop. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); } break; @@ -21619,7 +21619,7 @@ function renderRootConcurrent(root, lanes) { workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -21630,7 +21630,7 @@ function renderRootConcurrent(root, lanes) { // always unwind. workInProgressSuspendedReason = NotSuspended; workInProgressThrownValue = null; - unwindSuspendedUnitOfWork(unitOfWork, thrownValue); + throwAndUnwindWorkLoop(unitOfWork, thrownValue); break; } @@ -21817,7 +21817,7 @@ function replaySuspendedUnitOfWork(unitOfWork) { ReactCurrentOwner.current = null; } -function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { +function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { // This is a fork of performUnitOfWork specifcally for unwinding a fiber // that threw an exception. // @@ -21860,9 +21860,23 @@ function unwindSuspendedUnitOfWork(unitOfWork, thrownValue) { // To prevent an infinite loop, bubble the error up to the next parent. workInProgress = returnFiber; throw error; - } // Return to the normal work loop. + } - completeUnitOfWork(unitOfWork); + if (unitOfWork.flags & Incomplete) { + // Unwind the stack until we reach the nearest boundary. + unwindUnitOfWork(unitOfWork); + } else { + // Although the fiber suspended, we're intentionally going to commit it in + // an inconsistent state. We can do this safely in cases where we know the + // inconsistent tree will be hidden. + // + // This currently only applies to Legacy Suspense implementation, but we may + // port a version of this to concurrent roots, too, when performing a + // synchronous render. Because that will allow us to mutate the tree as we + // go instead of buffering mutations until the end. Though it's unclear if + // this particular path is how that would be implemented. + completeUnitOfWork(unitOfWork); + } } function completeUnitOfWork(unitOfWork) { @@ -21871,75 +21885,41 @@ function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { - // The current, flushed, state of this fiber is the alternate. Ideally + { + { + if ((completedWork.flags & Incomplete) !== NoFlags$1) { + // NOTE: If we re-enable sibling prerendering in some cases, this branch + // is where we would switch to the unwinding path. + error( + "Internal React error: Expected this fiber to be complete, but " + + "it isn't. It should have been unwound. This is a bug in React." + ); + } + } + } // The current, flushed, state of this fiber is the alternate. Ideally // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. - var current = completedWork.alternate; - var returnFiber = completedWork.return; // Check if the work completed or if something threw. - if ((completedWork.flags & Incomplete) === NoFlags$1) { - setCurrentFiber(completedWork); - var next = void 0; - - if ((completedWork.mode & ProfileMode) === NoMode) { - next = completeWork(current, completedWork, renderLanes); - } else { - startProfilerTimer(completedWork); - next = completeWork(current, completedWork, renderLanes); // Update render duration assuming we didn't error. - - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); - } - - resetCurrentFiber(); + var current = completedWork.alternate; + var returnFiber = completedWork.return; + setCurrentFiber(completedWork); + var next = void 0; - if (next !== null) { - // Completing this fiber spawned new work. Work on that next. - workInProgress = next; - return; - } + if ((completedWork.mode & ProfileMode) === NoMode) { + next = completeWork(current, completedWork, renderLanes); } else { - // This fiber did not complete because something threw. Pop values off - // the stack without entering the complete phase. If this is a boundary, - // capture values if possible. - var _next = unwindWork(current, completedWork); // Because this fiber did not complete, don't reset its lanes. - - if (_next !== null) { - // If completing this work spawned new work, do that next. We'll come - // back here again. - // Since we're restarting, remove anything that is not a host effect - // from the effect tag. - _next.flags &= HostEffectMask; - workInProgress = _next; - return; - } + startProfilerTimer(completedWork); + next = completeWork(current, completedWork, renderLanes); // Update render duration assuming we didn't error. - if ((completedWork.mode & ProfileMode) !== NoMode) { - // Record the render duration for the fiber that errored. - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing. - - var actualDuration = completedWork.actualDuration; - var child = completedWork.child; - - while (child !== null) { - // $FlowFixMe[unsafe-addition] addition with possible null/undefined value - actualDuration += child.actualDuration; - child = child.sibling; - } + stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); + } - completedWork.actualDuration = actualDuration; - } + resetCurrentFiber(); - if (returnFiber !== null) { - // Mark the parent fiber as incomplete and clear its subtree flags. - returnFiber.flags |= Incomplete; - returnFiber.subtreeFlags = NoFlags$1; - returnFiber.deletions = null; - } else { - // We've unwound all the way to the root. - workInProgressRootExitStatus = RootDidNotComplete; - workInProgress = null; - return; - } + if (next !== null) { + // Completing this fiber spawned new work. Work on that next. + workInProgress = next; + return; } var siblingFiber = completedWork.sibling; @@ -21961,6 +21941,70 @@ function completeUnitOfWork(unitOfWork) { } } +function unwindUnitOfWork(unitOfWork) { + var incompleteWork = unitOfWork; + + do { + // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. + var current = incompleteWork.alternate; // This fiber did not complete because something threw. Pop values off + // the stack without entering the complete phase. If this is a boundary, + // capture values if possible. + + var next = unwindWork(current, incompleteWork); // Because this fiber did not complete, don't reset its lanes. + + if (next !== null) { + // Found a boundary that can handle this exception. Re-renter the + // begin phase. This branch will return us to the normal work loop. + // + // Since we're restarting, remove anything that is not a host effect + // from the effect tag. + next.flags &= HostEffectMask; + workInProgress = next; + return; + } // Keep unwinding until we reach either a boundary or the root. + + if ((incompleteWork.mode & ProfileMode) !== NoMode) { + // Record the render duration for the fiber that errored. + stopProfilerTimerIfRunningAndRecordDelta(incompleteWork, false); // Include the time spent working on failed children before continuing. + + var actualDuration = incompleteWork.actualDuration; + var child = incompleteWork.child; + + while (child !== null) { + // $FlowFixMe[unsafe-addition] addition with possible null/undefined value + actualDuration += child.actualDuration; + child = child.sibling; + } + + incompleteWork.actualDuration = actualDuration; + } // TODO: Once we stop prerendering siblings, instead of resetting the parent + // of the node being unwound, we should be able to reset node itself as we + // unwind the stack. Saves an additional null check. + + var returnFiber = incompleteWork.return; + + if (returnFiber !== null) { + // Mark the parent fiber as incomplete and clear its subtree flags. + // TODO: Once we stop prerendering siblings, we may be able to get rid of + // the Incomplete flag because unwinding to the nearest boundary will + // happen synchronously. + returnFiber.flags |= Incomplete; + returnFiber.subtreeFlags = NoFlags$1; + returnFiber.deletions = null; + } + // $FlowFixMe[incompatible-type] we bail out when we get a null + + incompleteWork = returnFiber; // Update the next thing we're working on in case something throws. + + workInProgress = incompleteWork; + } while (incompleteWork !== null); // We've unwound all the way to the root. + + workInProgressRootExitStatus = RootDidNotComplete; + workInProgress = null; +} + function commitRoot(root, recoverableErrors, transitions) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. @@ -24198,7 +24242,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-1423f459"; +var ReactVersion = "18.3.0-www-modern-0d5680f8"; // Might add PROFILE later. diff --git a/compiled/facebook-www/WARNINGS b/compiled/facebook-www/WARNINGS index 8fcbd1631ca93..c94338cdd39ae 100644 --- a/compiled/facebook-www/WARNINGS +++ b/compiled/facebook-www/WARNINGS @@ -160,6 +160,7 @@ "Functions are not valid as a React child. This may happen if you return a Component instead of from render. Or maybe you meant to call this function rather than return it." "Internal React error: Attempted to capture a commit phase error inside a detached tree. This indicates a bug in React. Likely causes include deleting the same fiber more than once, committing an already-finished tree, or an inconsistent return pointer.\n\nError message:\n\n%s" "Internal React error: Expected static flag was missing. Please notify the React team." +"Internal React error: Expected this fiber to be complete, but it isn't. It should have been unwound. This is a bug in React." "Internal error: Expected work-in-progress queue to be a clone. This is a bug in React." "Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase." "Invalid ARIA attribute `%s`. Did you mean `%s`?"