From 82b15d49f75909a06e85bc2b48159d0ef36fe6a5 Mon Sep 17 00:00:00 2001 From: jerrydev0927 Date: Tue, 17 Oct 2023 16:53:57 +0000 Subject: [PATCH] useDeferredValue should skip initialValue if it suspends (#27509) ### Based on https://github.com/facebook/react/pull/27505 If a parent render spawns a deferred task with useDeferredValue, but the parent render suspends, we should not wait for the parent render to complete before attempting to render the final value. The reason is that the initialValue argument to useDeferredValue is meant to represent an immediate preview of the final UI. If we can't render it "immediately", we might as well skip it and go straight to the "real" value. This is an improvement over how a userspace implementation of useDeferredValue would work, because a userspace implementation would have to wait for the parent task to commit (useEffect) before spawning the deferred task, creating a waterfall. DiffTrain build for [b2a68a65c84b63ac86930d88ae5c84380cbbdeb6](https://github.com/facebook/react/commit/b2a68a65c84b63ac86930d88ae5c84380cbbdeb6) --- compiled/facebook-www/REVISION | 2 +- compiled/facebook-www/React-dev.classic.js | 2 +- compiled/facebook-www/React-prod.classic.js | 2 +- compiled/facebook-www/React-prod.modern.js | 2 +- .../facebook-www/React-profiling.modern.js | 2 +- compiled/facebook-www/ReactART-dev.classic.js | 187 ++++++++--- compiled/facebook-www/ReactART-dev.modern.js | 187 ++++++++--- .../facebook-www/ReactART-prod.classic.js | 261 +++++++++------ compiled/facebook-www/ReactART-prod.modern.js | 261 +++++++++------ compiled/facebook-www/ReactDOM-dev.classic.js | 187 ++++++++--- compiled/facebook-www/ReactDOM-dev.modern.js | 187 ++++++++--- .../facebook-www/ReactDOM-prod.classic.js | 315 ++++++++++------- compiled/facebook-www/ReactDOM-prod.modern.js | 315 ++++++++++------- .../ReactDOM-profiling.classic.js | 316 +++++++++++------- .../facebook-www/ReactDOM-profiling.modern.js | 316 +++++++++++------- .../facebook-www/ReactDOMServer-dev.modern.js | 2 +- .../ReactDOMServer-prod.modern.js | 2 +- .../ReactDOMTesting-dev.classic.js | 187 ++++++++--- .../ReactDOMTesting-dev.modern.js | 187 ++++++++--- .../ReactDOMTesting-prod.classic.js | 315 ++++++++++------- .../ReactDOMTesting-prod.modern.js | 315 ++++++++++------- .../ReactTestRenderer-dev.classic.js | 181 +++++++--- .../ReactTestRenderer-dev.modern.js | 181 +++++++--- 23 files changed, 2505 insertions(+), 1407 deletions(-) diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index 4a5691ed78..a6a4eca4c8 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -67cc9ba8789335b9da0838a446137c1be62adbcd +b2a68a65c84b63ac86930d88ae5c84380cbbdeb6 diff --git a/compiled/facebook-www/React-dev.classic.js b/compiled/facebook-www/React-dev.classic.js index 269d7b6baf..e32dd86cc9 100644 --- a/compiled/facebook-www/React-dev.classic.js +++ b/compiled/facebook-www/React-dev.classic.js @@ -27,7 +27,7 @@ if ( } "use strict"; -var ReactVersion = "18.3.0-www-classic-b6ac59ca"; +var ReactVersion = "18.3.0-www-classic-8c719f5e"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled/facebook-www/React-prod.classic.js b/compiled/facebook-www/React-prod.classic.js index 514fe95a80..351feb7c7c 100644 --- a/compiled/facebook-www/React-prod.classic.js +++ b/compiled/facebook-www/React-prod.classic.js @@ -587,4 +587,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-www-classic-1a677f82"; +exports.version = "18.3.0-www-classic-703d13e3"; diff --git a/compiled/facebook-www/React-prod.modern.js b/compiled/facebook-www/React-prod.modern.js index 1a8ee1313b..4d1633e61a 100644 --- a/compiled/facebook-www/React-prod.modern.js +++ b/compiled/facebook-www/React-prod.modern.js @@ -579,4 +579,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-www-modern-a28e1532"; +exports.version = "18.3.0-www-modern-eba2410d"; diff --git a/compiled/facebook-www/React-profiling.modern.js b/compiled/facebook-www/React-profiling.modern.js index 5008bf54d4..9c0889853c 100644 --- a/compiled/facebook-www/React-profiling.modern.js +++ b/compiled/facebook-www/React-profiling.modern.js @@ -590,7 +590,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-www-modern-a6764733"; +exports.version = "18.3.0-www-modern-f61d9097"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactART-dev.classic.js b/compiled/facebook-www/ReactART-dev.classic.js index 6fbadd9c9f..cb27eadf66 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-4668f682"; +var ReactVersion = "18.3.0-www-classic-8789cf1c"; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -1591,7 +1591,7 @@ var TransitionHydrationLane = 64; var TransitionLanes = /* */ - 8388480; + 4194176; var TransitionLane1 = /* */ 128; @@ -1637,39 +1637,39 @@ var TransitionLane14 = var TransitionLane15 = /* */ 2097152; -var TransitionLane16 = - /* */ - 4194304; var RetryLanes = /* */ - 125829120; + 62914560; var RetryLane1 = /* */ - 8388608; + 4194304; var RetryLane2 = /* */ - 16777216; + 8388608; var RetryLane3 = /* */ - 33554432; + 16777216; var RetryLane4 = /* */ - 67108864; + 33554432; var SomeRetryLane = RetryLane1; var SelectiveHydrationLane = /* */ - 134217728; + 67108864; var NonIdleLanes = /* */ - 268435455; + 134217727; var IdleHydrationLane = /* */ - 268435456; + 134217728; var IdleLane = /* */ - 536870912; + 268435456; var OffscreenLane = /* */ + 536870912; +var DeferredLane = + /* */ 1073741824; // Any lane that might schedule an update. This is used to detect infinite // update loops, so it doesn't include hydration lanes or retries. @@ -1730,6 +1730,10 @@ function getLabelForLane(lane) { if (lane & OffscreenLane) { return "Offscreen"; } + + if (lane & DeferredLane) { + return "Deferred"; + } } } var NoTimestamp = -1; @@ -1782,7 +1786,6 @@ function getHighestPriorityLanes(lanes) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: return lanes & TransitionLanes; case RetryLane1: @@ -1803,6 +1806,11 @@ function getHighestPriorityLanes(lanes) { case OffscreenLane: return OffscreenLane; + case DeferredLane: + // This shouldn't be reachable because deferred work is always entangled + // with something else. + return NoLanes; + default: { error("Should have found matching lanes. This is a bug in React."); @@ -1969,7 +1977,6 @@ function computeExpirationTime(lane, currentTime) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: return currentTime + 5000; case RetryLane1: @@ -1987,6 +1994,7 @@ function computeExpirationTime(lane, currentTime) { case IdleHydrationLane: case IdleLane: case OffscreenLane: + case DeferredLane: // Anything idle priority or lower should never expire. return NoTimestamp; @@ -2190,7 +2198,7 @@ function markRootUpdated(root, updateLane) { root.pingedLanes = NoLanes; } } -function markRootSuspended$1(root, suspendedLanes) { +function markRootSuspended$1(root, suspendedLanes, spawnedLane) { root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. @@ -2203,11 +2211,15 @@ function markRootSuspended$1(root, suspendedLanes) { expirationTimes[index] = NoTimestamp; lanes &= ~lane; } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); + } } function markRootPinged(root, pingedLanes) { root.pingedLanes |= root.suspendedLanes & pingedLanes; } -function markRootFinished(root, remainingLanes) { +function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; // Let's try everything again @@ -2247,7 +2259,32 @@ function markRootFinished(root, remainingLanes) { lanes &= ~lane; } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane( + root, + spawnedLane, // This render finished successfully without suspending, so we don't need + // to entangle the spawned task with the parent task. + NoLanes + ); + } +} + +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + // This render spawned a deferred task. Mark it as pending. + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; // Entangle the spawned lane with the DeferredLane bit so that we know it + // was the result of another render. This lets us avoid a useDeferredValue + // waterfall — only the first level will defer. + + var spawnedLaneIndex = laneToIndex(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] |= + DeferredLane | // If the parent render task suspended, we must also entangle those lanes + // with the spawned task. + entangledLanes; } + function markRootEntangled(root, entangledLanes) { // In addition to entangling each of the given lanes with each other, we also // have to consider _transitive_ entanglements. For each lane that is already @@ -2336,7 +2373,6 @@ function getBumpedLaneForHydration(root, renderLanes) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: case RetryLane1: case RetryLane2: case RetryLane3: @@ -9783,15 +9819,18 @@ function rerenderDeferredValue(value, initialValue) { } function mountDeferredValueImpl(hook, value, initialValue) { - if (enableUseDeferredValueInitialArg && initialValue !== undefined) { - // When `initialValue` is provided, we defer the initial render even if the + if ( + enableUseDeferredValueInitialArg && // When `initialValue` is provided, we defer the initial render even if the // current render is not synchronous. - // TODO: However, to avoid waterfalls, we should not defer if this render - // was itself spawned by an earlier useDeferredValue. Plan is to add a - // Deferred lane to track this. - hook.memoizedState = initialValue; // Schedule a deferred render + initialValue !== undefined && // However, to avoid waterfalls, we do not defer if this render + // was itself spawned by an earlier useDeferredValue. Check if DeferredLane + // is part of the render lanes. + !includesSomeLane(renderLanes, DeferredLane) + ) { + // Render with the initial value + hook.memoizedState = initialValue; // Schedule a deferred render to switch to the final value. - var deferredLane = claimNextTransitionLane(); + var deferredLane = requestDeferredLane(); currentlyRenderingFiber$1.lanes = mergeLanes( currentlyRenderingFiber$1.lanes, deferredLane @@ -9819,7 +9858,7 @@ function updateDeferredValueImpl(hook, prevValue, value, initialValue) { // previous value and spawn a deferred render to update it later. if (!objectIs(value, prevValue)) { // Schedule a deferred render - var deferredLane = claimNextTransitionLane(); + var deferredLane = requestDeferredLane(); currentlyRenderingFiber$1.lanes = mergeLanes( currentlyRenderingFiber$1.lanes, deferredLane @@ -23875,7 +23914,9 @@ var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event). -var workInProgressRootPingedLanes = NoLanes; // Errors that are thrown during the render phase. +var workInProgressRootPingedLanes = NoLanes; // If this lane scheduled deferred work, this is the lane of the deferred task. + +var workInProgressDeferredLane = NoLane; // Errors that are thrown during the render phase. var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI. // We will log them once the tree commits. @@ -24158,6 +24199,27 @@ function requestRetryLane(fiber) { return claimNextRetryLane(); } +function requestDeferredLane() { + if (workInProgressDeferredLane === NoLane) { + // If there are multiple useDeferredValue hooks in the same render, the + // tasks that they spawn should all be batched together, so they should all + // receive the same lane. + if (includesSomeLane(workInProgressRootRenderLanes, OffscreenLane)) { + // There's only one OffscreenLane, so if it contains deferred work, we + // should just reschedule using the same lane. + // TODO: We also use OffscreenLane for hydration, on the basis that the + // initial HTML is the same as the hydrated UI, but since the deferred + // task will change the UI, it should be treated like an update. Use + // TransitionHydrationLane to trigger selective hydration. + workInProgressDeferredLane = OffscreenLane; + } else { + // Everything else is spawned as a transition. + workInProgressDeferredLane = requestTransitionLane(); + } + } + + return workInProgressDeferredLane; +} function scheduleUpdateOnFiber(root, fiber, lane) { { if (isRunningInsertionEffect) { @@ -24181,7 +24243,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { // The incoming update might unblock the current render. Interrupt the // current attempt and restart from the top. prepareFreshStack(root, NoLanes); - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } // Mark that the root has a pending update. markRootUpdated(root, lane); @@ -24262,7 +24328,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { // effect of interrupting the current render and switching to the update. // TODO: Make sure this doesn't override pings that happen while we've // already started rendering. - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } } @@ -24350,7 +24420,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); } else { // The render completed. // Check if this render may have yielded to a concurrent event, and if so, @@ -24395,7 +24465,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); throw fatalError; } // We now have a consistent tree. The next step is either to commit it, @@ -24515,7 +24585,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { // This is a transition, so we should exit without committing a // placeholder and without scheduling a timeout. Delay indefinitely // until we receive more data. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, workInProgressDeferredLane); return; } // Commit the placeholder. @@ -24538,7 +24608,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { commitRoot( root, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane ); } else { if ( @@ -24551,7 +24622,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now$1(); // Don't bother with a very short suspense time. if (msUntilTimeout > 10) { - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, workInProgressDeferredLane); var nextLanes = getNextLanes(root, NoLanes); if (nextLanes !== NoLanes) { @@ -24571,7 +24642,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { finishedWork, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ), msUntilTimeout ); @@ -24584,7 +24656,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { finishedWork, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ); } } @@ -24594,7 +24667,8 @@ function commitRootWhenReady( finishedWork, recoverableErrors, transitions, - lanes + lanes, + spawnedLane ) { // TODO: Combine retry throttling with Suspensey commits. Right now they run // one after the other. @@ -24619,12 +24693,12 @@ function commitRootWhenReady( root.cancelPendingCommit = schedulePendingCommit( commitRoot.bind(null, root, recoverableErrors, transitions) ); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, spawnedLane); return; } } // Otherwise, commit immediately. - commitRoot(root, recoverableErrors, transitions); + commitRoot(root, recoverableErrors, transitions, spawnedLane); } function isRenderConsistentWithExternalStores(finishedWork) { @@ -24689,7 +24763,7 @@ function isRenderConsistentWithExternalStores(finishedWork) { return true; } -function markRootSuspended(root, suspendedLanes) { +function markRootSuspended(root, suspendedLanes, spawnedLane) { // When suspending, we should always exclude lanes that were pinged or (more // rarely, since we try to avoid it) updated during the render phase. // TODO: Lol maybe there's a better way to factor this besides this @@ -24699,7 +24773,7 @@ function markRootSuspended(root, suspendedLanes) { suspendedLanes, workInProgressRootInterleavedUpdatedLanes ); - markRootSuspended$1(root, suspendedLanes); + markRootSuspended$1(root, suspendedLanes, spawnedLane); } // This is the entry point for synchronous tasks that don't go // through Scheduler @@ -24751,7 +24825,7 @@ function performSyncWorkOnRoot(root, lanes) { if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); throw fatalError; } @@ -24760,7 +24834,7 @@ function performSyncWorkOnRoot(root, lanes) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); return null; } // We now have a consistent tree. Because this is a sync render, we @@ -24772,7 +24846,8 @@ function performSyncWorkOnRoot(root, lanes) { commitRoot( root, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane ); // Before exiting, make sure there's a callback scheduled for the next // pending level. @@ -24896,6 +24971,7 @@ function prepareFreshStack(root, lanes) { workInProgressRootSkippedLanes = NoLanes; workInProgressRootInterleavedUpdatedLanes = NoLanes; workInProgressRootPingedLanes = NoLanes; + workInProgressDeferredLane = NoLane; workInProgressRootConcurrentErrors = null; workInProgressRootRecoverableErrors = null; // Get the lanes that are entangled with whatever we're about to render. We // track these separately so we can distinguish the priority of the render @@ -25138,9 +25214,9 @@ function renderDidSuspendDelayIfPossible() { // this render. if ( - workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || - includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) + includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) && + workInProgressRoot !== null ) { // Mark the current render as suspended so that we switch to working on // the updates that were skipped. Usually we only suspend at the end of @@ -25151,8 +25227,11 @@ function renderDidSuspendDelayIfPossible() { // pinged or updated while we were rendering. // TODO: Consider unwinding immediately, using the // SuspendedOnHydration mechanism. - // $FlowFixMe[incompatible-call] need null check workInProgressRoot - markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes); + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } } function renderDidError(error) { @@ -25931,7 +26010,7 @@ function unwindUnitOfWork(unitOfWork) { workInProgress = null; } -function commitRoot(root, recoverableErrors, transitions) { +function commitRoot(root, recoverableErrors, transitions, spawnedLane) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. var previousUpdateLanePriority = getCurrentUpdatePriority(); @@ -25944,7 +26023,8 @@ function commitRoot(root, recoverableErrors, transitions) { root, recoverableErrors, transitions, - previousUpdateLanePriority + previousUpdateLanePriority, + spawnedLane ); } finally { ReactCurrentBatchConfig.transition = prevTransition; @@ -25958,7 +26038,8 @@ function commitRootImpl( root, recoverableErrors, transitions, - renderPriorityLevel + renderPriorityLevel, + spawnedLane ) { do { // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which @@ -26033,7 +26114,7 @@ function commitRootImpl( var concurrentlyUpdatedLanes = getConcurrentlyUpdatedLanes(); remainingLanes = mergeLanes(remainingLanes, concurrentlyUpdatedLanes); - markRootFinished(root, remainingLanes); + markRootFinished(root, remainingLanes, spawnedLane); if (root === workInProgressRoot) { // We can reset these now that they are finished. diff --git a/compiled/facebook-www/ReactART-dev.modern.js b/compiled/facebook-www/ReactART-dev.modern.js index 918bb2ae80..94e35f850b 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-e16a234e"; +var ReactVersion = "18.3.0-www-modern-bbf5dd10"; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -1588,7 +1588,7 @@ var TransitionHydrationLane = 64; var TransitionLanes = /* */ - 8388480; + 4194176; var TransitionLane1 = /* */ 128; @@ -1634,39 +1634,39 @@ var TransitionLane14 = var TransitionLane15 = /* */ 2097152; -var TransitionLane16 = - /* */ - 4194304; var RetryLanes = /* */ - 125829120; + 62914560; var RetryLane1 = /* */ - 8388608; + 4194304; var RetryLane2 = /* */ - 16777216; + 8388608; var RetryLane3 = /* */ - 33554432; + 16777216; var RetryLane4 = /* */ - 67108864; + 33554432; var SomeRetryLane = RetryLane1; var SelectiveHydrationLane = /* */ - 134217728; + 67108864; var NonIdleLanes = /* */ - 268435455; + 134217727; var IdleHydrationLane = /* */ - 268435456; + 134217728; var IdleLane = /* */ - 536870912; + 268435456; var OffscreenLane = /* */ + 536870912; +var DeferredLane = + /* */ 1073741824; // Any lane that might schedule an update. This is used to detect infinite // update loops, so it doesn't include hydration lanes or retries. @@ -1727,6 +1727,10 @@ function getLabelForLane(lane) { if (lane & OffscreenLane) { return "Offscreen"; } + + if (lane & DeferredLane) { + return "Deferred"; + } } } var NoTimestamp = -1; @@ -1779,7 +1783,6 @@ function getHighestPriorityLanes(lanes) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: return lanes & TransitionLanes; case RetryLane1: @@ -1800,6 +1803,11 @@ function getHighestPriorityLanes(lanes) { case OffscreenLane: return OffscreenLane; + case DeferredLane: + // This shouldn't be reachable because deferred work is always entangled + // with something else. + return NoLanes; + default: { error("Should have found matching lanes. This is a bug in React."); @@ -1966,7 +1974,6 @@ function computeExpirationTime(lane, currentTime) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: return currentTime + 5000; case RetryLane1: @@ -1984,6 +1991,7 @@ function computeExpirationTime(lane, currentTime) { case IdleHydrationLane: case IdleLane: case OffscreenLane: + case DeferredLane: // Anything idle priority or lower should never expire. return NoTimestamp; @@ -2187,7 +2195,7 @@ function markRootUpdated(root, updateLane) { root.pingedLanes = NoLanes; } } -function markRootSuspended$1(root, suspendedLanes) { +function markRootSuspended$1(root, suspendedLanes, spawnedLane) { root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. @@ -2200,11 +2208,15 @@ function markRootSuspended$1(root, suspendedLanes) { expirationTimes[index] = NoTimestamp; lanes &= ~lane; } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); + } } function markRootPinged(root, pingedLanes) { root.pingedLanes |= root.suspendedLanes & pingedLanes; } -function markRootFinished(root, remainingLanes) { +function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; // Let's try everything again @@ -2244,7 +2256,32 @@ function markRootFinished(root, remainingLanes) { lanes &= ~lane; } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane( + root, + spawnedLane, // This render finished successfully without suspending, so we don't need + // to entangle the spawned task with the parent task. + NoLanes + ); + } +} + +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + // This render spawned a deferred task. Mark it as pending. + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; // Entangle the spawned lane with the DeferredLane bit so that we know it + // was the result of another render. This lets us avoid a useDeferredValue + // waterfall — only the first level will defer. + + var spawnedLaneIndex = laneToIndex(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] |= + DeferredLane | // If the parent render task suspended, we must also entangle those lanes + // with the spawned task. + entangledLanes; } + function markRootEntangled(root, entangledLanes) { // In addition to entangling each of the given lanes with each other, we also // have to consider _transitive_ entanglements. For each lane that is already @@ -2333,7 +2370,6 @@ function getBumpedLaneForHydration(root, renderLanes) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: case RetryLane1: case RetryLane2: case RetryLane3: @@ -9539,15 +9575,18 @@ function rerenderDeferredValue(value, initialValue) { } function mountDeferredValueImpl(hook, value, initialValue) { - if (enableUseDeferredValueInitialArg && initialValue !== undefined) { - // When `initialValue` is provided, we defer the initial render even if the + if ( + enableUseDeferredValueInitialArg && // When `initialValue` is provided, we defer the initial render even if the // current render is not synchronous. - // TODO: However, to avoid waterfalls, we should not defer if this render - // was itself spawned by an earlier useDeferredValue. Plan is to add a - // Deferred lane to track this. - hook.memoizedState = initialValue; // Schedule a deferred render + initialValue !== undefined && // However, to avoid waterfalls, we do not defer if this render + // was itself spawned by an earlier useDeferredValue. Check if DeferredLane + // is part of the render lanes. + !includesSomeLane(renderLanes, DeferredLane) + ) { + // Render with the initial value + hook.memoizedState = initialValue; // Schedule a deferred render to switch to the final value. - var deferredLane = claimNextTransitionLane(); + var deferredLane = requestDeferredLane(); currentlyRenderingFiber$1.lanes = mergeLanes( currentlyRenderingFiber$1.lanes, deferredLane @@ -9575,7 +9614,7 @@ function updateDeferredValueImpl(hook, prevValue, value, initialValue) { // previous value and spawn a deferred render to update it later. if (!objectIs(value, prevValue)) { // Schedule a deferred render - var deferredLane = claimNextTransitionLane(); + var deferredLane = requestDeferredLane(); currentlyRenderingFiber$1.lanes = mergeLanes( currentlyRenderingFiber$1.lanes, deferredLane @@ -23540,7 +23579,9 @@ var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event). -var workInProgressRootPingedLanes = NoLanes; // Errors that are thrown during the render phase. +var workInProgressRootPingedLanes = NoLanes; // If this lane scheduled deferred work, this is the lane of the deferred task. + +var workInProgressDeferredLane = NoLane; // Errors that are thrown during the render phase. var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI. // We will log them once the tree commits. @@ -23823,6 +23864,27 @@ function requestRetryLane(fiber) { return claimNextRetryLane(); } +function requestDeferredLane() { + if (workInProgressDeferredLane === NoLane) { + // If there are multiple useDeferredValue hooks in the same render, the + // tasks that they spawn should all be batched together, so they should all + // receive the same lane. + if (includesSomeLane(workInProgressRootRenderLanes, OffscreenLane)) { + // There's only one OffscreenLane, so if it contains deferred work, we + // should just reschedule using the same lane. + // TODO: We also use OffscreenLane for hydration, on the basis that the + // initial HTML is the same as the hydrated UI, but since the deferred + // task will change the UI, it should be treated like an update. Use + // TransitionHydrationLane to trigger selective hydration. + workInProgressDeferredLane = OffscreenLane; + } else { + // Everything else is spawned as a transition. + workInProgressDeferredLane = requestTransitionLane(); + } + } + + return workInProgressDeferredLane; +} function scheduleUpdateOnFiber(root, fiber, lane) { { if (isRunningInsertionEffect) { @@ -23846,7 +23908,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { // The incoming update might unblock the current render. Interrupt the // current attempt and restart from the top. prepareFreshStack(root, NoLanes); - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } // Mark that the root has a pending update. markRootUpdated(root, lane); @@ -23927,7 +23993,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { // effect of interrupting the current render and switching to the update. // TODO: Make sure this doesn't override pings that happen while we've // already started rendering. - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } } @@ -24015,7 +24085,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); } else { // The render completed. // Check if this render may have yielded to a concurrent event, and if so, @@ -24060,7 +24130,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); throw fatalError; } // We now have a consistent tree. The next step is either to commit it, @@ -24180,7 +24250,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { // This is a transition, so we should exit without committing a // placeholder and without scheduling a timeout. Delay indefinitely // until we receive more data. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, workInProgressDeferredLane); return; } // Commit the placeholder. @@ -24203,7 +24273,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { commitRoot( root, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane ); } else { if ( @@ -24216,7 +24287,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now$1(); // Don't bother with a very short suspense time. if (msUntilTimeout > 10) { - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, workInProgressDeferredLane); var nextLanes = getNextLanes(root, NoLanes); if (nextLanes !== NoLanes) { @@ -24236,7 +24307,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { finishedWork, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ), msUntilTimeout ); @@ -24249,7 +24321,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { finishedWork, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ); } } @@ -24259,7 +24332,8 @@ function commitRootWhenReady( finishedWork, recoverableErrors, transitions, - lanes + lanes, + spawnedLane ) { // TODO: Combine retry throttling with Suspensey commits. Right now they run // one after the other. @@ -24284,12 +24358,12 @@ function commitRootWhenReady( root.cancelPendingCommit = schedulePendingCommit( commitRoot.bind(null, root, recoverableErrors, transitions) ); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, spawnedLane); return; } } // Otherwise, commit immediately. - commitRoot(root, recoverableErrors, transitions); + commitRoot(root, recoverableErrors, transitions, spawnedLane); } function isRenderConsistentWithExternalStores(finishedWork) { @@ -24354,7 +24428,7 @@ function isRenderConsistentWithExternalStores(finishedWork) { return true; } -function markRootSuspended(root, suspendedLanes) { +function markRootSuspended(root, suspendedLanes, spawnedLane) { // When suspending, we should always exclude lanes that were pinged or (more // rarely, since we try to avoid it) updated during the render phase. // TODO: Lol maybe there's a better way to factor this besides this @@ -24364,7 +24438,7 @@ function markRootSuspended(root, suspendedLanes) { suspendedLanes, workInProgressRootInterleavedUpdatedLanes ); - markRootSuspended$1(root, suspendedLanes); + markRootSuspended$1(root, suspendedLanes, spawnedLane); } // This is the entry point for synchronous tasks that don't go // through Scheduler @@ -24416,7 +24490,7 @@ function performSyncWorkOnRoot(root, lanes) { if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); throw fatalError; } @@ -24425,7 +24499,7 @@ function performSyncWorkOnRoot(root, lanes) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); return null; } // We now have a consistent tree. Because this is a sync render, we @@ -24437,7 +24511,8 @@ function performSyncWorkOnRoot(root, lanes) { commitRoot( root, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane ); // Before exiting, make sure there's a callback scheduled for the next // pending level. @@ -24561,6 +24636,7 @@ function prepareFreshStack(root, lanes) { workInProgressRootSkippedLanes = NoLanes; workInProgressRootInterleavedUpdatedLanes = NoLanes; workInProgressRootPingedLanes = NoLanes; + workInProgressDeferredLane = NoLane; workInProgressRootConcurrentErrors = null; workInProgressRootRecoverableErrors = null; // Get the lanes that are entangled with whatever we're about to render. We // track these separately so we can distinguish the priority of the render @@ -24803,9 +24879,9 @@ function renderDidSuspendDelayIfPossible() { // this render. if ( - workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || - includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) + includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) && + workInProgressRoot !== null ) { // Mark the current render as suspended so that we switch to working on // the updates that were skipped. Usually we only suspend at the end of @@ -24816,8 +24892,11 @@ function renderDidSuspendDelayIfPossible() { // pinged or updated while we were rendering. // TODO: Consider unwinding immediately, using the // SuspendedOnHydration mechanism. - // $FlowFixMe[incompatible-call] need null check workInProgressRoot - markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes); + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } } function renderDidError(error) { @@ -25591,7 +25670,7 @@ function unwindUnitOfWork(unitOfWork) { workInProgress = null; } -function commitRoot(root, recoverableErrors, transitions) { +function commitRoot(root, recoverableErrors, transitions, spawnedLane) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. var previousUpdateLanePriority = getCurrentUpdatePriority(); @@ -25604,7 +25683,8 @@ function commitRoot(root, recoverableErrors, transitions) { root, recoverableErrors, transitions, - previousUpdateLanePriority + previousUpdateLanePriority, + spawnedLane ); } finally { ReactCurrentBatchConfig.transition = prevTransition; @@ -25618,7 +25698,8 @@ function commitRootImpl( root, recoverableErrors, transitions, - renderPriorityLevel + renderPriorityLevel, + spawnedLane ) { do { // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which @@ -25693,7 +25774,7 @@ function commitRootImpl( var concurrentlyUpdatedLanes = getConcurrentlyUpdatedLanes(); remainingLanes = mergeLanes(remainingLanes, concurrentlyUpdatedLanes); - markRootFinished(root, remainingLanes); + markRootFinished(root, remainingLanes, spawnedLane); if (root === workInProgressRoot) { // We can reset these now that they are finished. diff --git a/compiled/facebook-www/ReactART-prod.classic.js b/compiled/facebook-www/ReactART-prod.classic.js index 82e470d764..1d092e340f 100644 --- a/compiled/facebook-www/ReactART-prod.classic.js +++ b/compiled/facebook-www/ReactART-prod.classic.js @@ -390,7 +390,7 @@ function clz32Fallback(x) { } var SyncUpdateLanes = enableUnifiedSyncLane ? 42 : 2, nextTransitionLane = 128, - nextRetryLane = 8388608; + nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { if (enableUnifiedSyncLane) { var pendingSyncLanes = lanes & SyncUpdateLanes; @@ -426,13 +426,14 @@ function getHighestPriorityLanes(lanes) { case 524288: case 1048576: case 2097152: + return lanes & 4194176; case 4194304: - return lanes & 8388480; case 8388608: case 16777216: case 33554432: + return lanes & 62914560; case 67108864: - return lanes & 125829120; + return 67108864; case 134217728: return 134217728; case 268435456: @@ -440,7 +441,7 @@ function getHighestPriorityLanes(lanes) { case 536870912: return 536870912; case 1073741824: - return 1073741824; + return 0; default: return lanes; } @@ -451,7 +452,7 @@ function getNextLanes(root, wipLanes) { var nextLanes = 0, suspendedLanes = root.suspendedLanes; root = root.pingedLanes; - var nonIdlePendingLanes = pendingLanes & 268435455; + var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes @@ -470,7 +471,7 @@ function getNextLanes(root, wipLanes) { ((suspendedLanes = nextLanes & -nextLanes), (root = wipLanes & -wipLanes), suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 8388480))) + (32 === suspendedLanes && 0 !== (root & 4194176))) ? wipLanes : nextLanes; } @@ -499,13 +500,13 @@ function computeExpirationTime(lane, currentTime) { case 524288: case 1048576: case 2097152: - case 4194304: return currentTime + 5e3; + case 4194304: case 8388608: case 16777216: case 33554432: - case 67108864: return -1; + case 67108864: case 134217728: case 268435456: case 536870912: @@ -517,22 +518,16 @@ function computeExpirationTime(lane, currentTime) { } function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) return 0; - root = root.pendingLanes & -1073741825; - return 0 !== root ? root : root & 1073741824 ? 1073741824 : 0; + root = root.pendingLanes & -536870913; + return 0 !== root ? root : root & 536870912 ? 536870912 : 0; } function includesBlockingLane(root, lanes) { return 0 !== (root.current.mode & 32) ? !1 : 0 !== (lanes & 60); } -function claimNextTransitionLane() { - var lane = nextTransitionLane; - nextTransitionLane <<= 1; - 0 === (nextTransitionLane & 8388480) && (nextTransitionLane = 128); - return lane; -} function claimNextRetryLane() { var lane = nextRetryLane; nextRetryLane <<= 1; - 0 === (nextRetryLane & 125829120) && (nextRetryLane = 8388608); + 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304); return lane; } function createLaneMap(initial) { @@ -541,10 +536,10 @@ function createLaneMap(initial) { } function markRootUpdated(root, updateLane) { root.pendingLanes |= updateLane; - 536870912 !== updateLane && + 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0)); } -function markRootFinished(root, remainingLanes) { +function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; @@ -554,24 +549,37 @@ function markRootFinished(root, remainingLanes) { root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; remainingLanes = root.entanglements; - var expirationTimes = root.expirationTimes; - for (root = root.hiddenUpdates; 0 < noLongerPendingLanes; ) { + for ( + var expirationTimes = root.expirationTimes, + hiddenUpdates = root.hiddenUpdates; + 0 < noLongerPendingLanes; + + ) { var index$4 = 31 - clz32(noLongerPendingLanes), lane = 1 << index$4; remainingLanes[index$4] = 0; expirationTimes[index$4] = -1; - var hiddenUpdatesForLane = root[index$4]; + var hiddenUpdatesForLane = hiddenUpdates[index$4]; if (null !== hiddenUpdatesForLane) for ( - root[index$4] = null, index$4 = 0; + hiddenUpdates[index$4] = null, index$4 = 0; index$4 < hiddenUpdatesForLane.length; index$4++ ) { var update = hiddenUpdatesForLane[index$4]; - null !== update && (update.lane &= -1073741825); + null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; } + 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); +} +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; + var spawnedLaneIndex = 31 - clz32(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] = + root.entanglements[spawnedLaneIndex] | 1073741824 | entangledLanes; } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); @@ -612,9 +620,9 @@ function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes ? 8 < lanes - ? 0 !== (lanes & 268435455) + ? 0 !== (lanes & 134217727) ? 32 - : 536870912 + : 268435456 : 8 : 2; } @@ -1066,7 +1074,7 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { null === sourceFiber ? (parent[isHidden] = [update]) : sourceFiber.push(update), - (update.lane = lane | 1073741824)); + (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { if (50 < nestedUpdateCount) @@ -1122,7 +1130,7 @@ function enqueueUpdate(fiber, update, lane) { } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 4194176))) { var queueLanes = fiber.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -1210,7 +1218,7 @@ function processUpdateQueue( current = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { - var updateLane = pendingQueue.lane & -1073741825, + var updateLane = pendingQueue.lane & -536870913, isHiddenUpdate = updateLane !== pendingQueue.lane; if ( isHiddenUpdate @@ -2323,7 +2331,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { prepareFreshStack(workInProgressRootRenderLanes$29, 0), markRootSuspended( workInProgressRootRenderLanes$29, - nextLanes + nextLanes, + 0 ), ensureRootIsScheduled(workInProgressRootRenderLanes$29), originallyAttemptedLanes) @@ -2331,7 +2340,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { 6 === exitStatus ? markRootSuspended( workInProgressRootRenderLanes$29, - nextLanes + nextLanes, + 0 ) : ((workInProgressRootRenderLanes$29.finishedWork = workInProgressRootRenderLanes$29.current.alternate), @@ -2340,7 +2350,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { commitRoot( workInProgressRootRenderLanes$29, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane )); } ensureRootIsScheduled(workInProgressRootRenderLanes$29); @@ -2392,7 +2403,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { var suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, - lanes = root.pendingLanes & -125829121; + lanes = root.pendingLanes & -62914561; 0 < lanes; ) { @@ -2446,7 +2457,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { case 32: suspendedLanes = NormalPriority$1; break; - case 536870912: + case 268435456: suspendedLanes = IdlePriority; break; default: @@ -2459,8 +2470,12 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { return currentTime; } function requestTransitionLane() { - 0 === currentEventTransitionLane && - (currentEventTransitionLane = claimNextTransitionLane()); + if (0 === currentEventTransitionLane) { + var lane = nextTransitionLane; + nextTransitionLane <<= 1; + 0 === (nextTransitionLane & 4194176) && (nextTransitionLane = 128); + currentEventTransitionLane = lane; + } return currentEventTransitionLane; } var currentEntangledListeners = null, @@ -2783,7 +2798,7 @@ function updateReducerImpl(hook, current, reducer) { newBaseQueueLast = null, update = current; do { - var updateLane = update.lane & -1073741825; + var updateLane = update.lane & -536870913; if ( updateLane !== update.lane ? (workInProgressRootRenderLanes & updateLane) === updateLane @@ -3116,9 +3131,11 @@ function updateMemo(nextCreate, deps) { return nextCreate; } function mountDeferredValueImpl(hook, value, initialValue) { - return enableUseDeferredValueInitialArg && void 0 !== initialValue + return enableUseDeferredValueInitialArg && + void 0 !== initialValue && + 0 === (renderLanes & 1073741824) ? ((hook.memoizedState = initialValue), - (value = claimNextTransitionLane()), + (value = requestDeferredLane()), (currentlyRenderingFiber$1.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0), @@ -3132,7 +3149,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { (hook.memoizedState = value) ); objectIs(value, prevValue) || - ((value = claimNextTransitionLane()), + ((value = requestDeferredLane()), (currentlyRenderingFiber$1.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); @@ -3316,7 +3333,7 @@ function enqueueRenderPhaseUpdate(queue, update) { queue.pending = update; } function entangleTransitionUpdate(root, queue, lane) { - if (0 !== (lane & 8388480)) { + if (0 !== (lane & 4194176)) { var queueLanes = queue.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -4104,7 +4121,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) { null !== current && pushTransition(workInProgress, null, null), reuseHiddenContextOnStack(), pushOffscreenSuspenseHandler(workInProgress); - else if (0 !== (renderLanes & 1073741824)) + else if (0 !== (renderLanes & 536870912)) (workInProgress.memoizedState = { baseLanes: 0, cachePool: null }), null !== current && pushTransition( @@ -4118,7 +4135,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) { pushOffscreenSuspenseHandler(workInProgress); else return ( - (workInProgress.lanes = workInProgress.childLanes = 1073741824), + (workInProgress.lanes = workInProgress.childLanes = 536870912), deferHiddenOffscreenComponent( current, workInProgress, @@ -4550,7 +4567,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.child.memoizedState = mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress.lanes = 8388608), + (workInProgress.lanes = 4194304), current ); pushPrimaryTreeSuspenseHandler(workInProgress); @@ -4839,11 +4856,10 @@ function updateDehydratedSuspenseComponent( case 8388608: case 16777216: case 33554432: - case 67108864: didSuspend = 64; break; - case 536870912: - didSuspend = 268435456; + case 268435456: + didSuspend = 134217728; break; default: didSuspend = 0; @@ -5570,7 +5586,7 @@ function scheduleRetryEffect(workInProgress, retryQueue) { ? (workInProgress.flags |= 4) : workInProgress.flags & 16384 && ((retryQueue = - 22 !== workInProgress.tag ? claimNextRetryLane() : 1073741824), + 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), (workInProgress.lanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { @@ -5861,7 +5877,7 @@ function completeWork(current, workInProgress, renderLanes) { ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(instance, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); } else { if (!newProps) @@ -5881,11 +5897,11 @@ function completeWork(current, workInProgress, renderLanes) { } else 2 * now() - instance.renderingStartTime > workInProgressRootRenderTargetTime && - 1073741824 !== renderLanes && + 536870912 !== renderLanes && ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(instance, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); instance.isBackwards ? ((cache$80.sibling = workInProgress.child), (workInProgress.child = cache$80)) @@ -5938,7 +5954,7 @@ function completeWork(current, workInProgress, renderLanes) { (workInProgress.flags |= 8192) : newProps && (workInProgress.flags |= 8192)), newProps && 0 !== (workInProgress.mode & 1) - ? 0 !== (renderLanes & 1073741824) && + ? 0 !== (renderLanes & 536870912) && 0 === (workInProgress.flags & 128) && (bubbleProperties(workInProgress), 23 !== workInProgress.tag && @@ -7993,6 +8009,7 @@ var DefaultCacheDispatcher = { workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, workInProgressRootPingedLanes = 0, + workInProgressDeferredLane = 0, workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, globalMostRecentFallbackTime = 0, @@ -8083,13 +8100,25 @@ function requestUpdateLane(fiber) { fiber = currentUpdatePriority; return 0 !== fiber ? fiber : 32; } +function requestDeferredLane() { + 0 === workInProgressDeferredLane && + (workInProgressDeferredLane = + 0 !== (workInProgressRootRenderLanes & 536870912) + ? 536870912 + : requestTransitionLane()); + return workInProgressDeferredLane; +} function scheduleUpdateOnFiber(root, fiber, lane) { if ( (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || null !== root.cancelPendingCommit ) prepareFreshStack(root, 0), - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); markRootUpdated(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) { if (enableTransitionTracing) { @@ -8112,7 +8141,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { (0 === (executionContext & 2) && (workInProgressRootInterleavedUpdatedLanes |= lane), 4 === workInProgressRootExitStatus && - markRootSuspended(root, workInProgressRootRenderLanes)); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + )); ensureRootIsScheduled(root); 2 === lane && 0 === executionContext && @@ -8140,7 +8173,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (0 !== exitStatus) { var renderWasConcurrent = didTimeout; do { - if (6 === exitStatus) markRootSuspended(root, lanes); + if (6 === exitStatus) markRootSuspended(root, lanes, 0); else { didTimeout = root.current.alternate; if ( @@ -8169,7 +8202,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { throw ( ((originalCallbackNode = workInProgressRootFatalError), prepareFreshStack(root, 0), - markRootSuspended(root, lanes), + markRootSuspended(root, lanes, 0), ensureRootIsScheduled(root), originalCallbackNode) ); @@ -8182,8 +8215,12 @@ function performConcurrentWorkOnRoot(root, didTimeout) { case 1: throw Error(formatProdErrorMessage(345)); case 4: - if ((lanes & 8388480) === lanes) { - markRootSuspended(renderWasConcurrent, lanes); + if ((lanes & 4194176) === lanes) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); break a; } break; @@ -8195,12 +8232,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { throw Error(formatProdErrorMessage(329)); } if ( - (lanes & 125829120) === lanes && + (lanes & 62914560) === lanes && (alwaysThrottleRetries || 3 === exitStatus) && ((exitStatus = globalMostRecentFallbackTime + 300 - now()), 10 < exitStatus) ) { - markRootSuspended(renderWasConcurrent, lanes); + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; renderWasConcurrent.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( @@ -8209,7 +8250,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ), exitStatus ); @@ -8220,7 +8262,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ); } } @@ -8271,10 +8314,11 @@ function commitRootWhenReady( finishedWork, recoverableErrors, transitions, - lanes + lanes, + spawnedLane ) { 0 === (lanes & 42) && accumulateSuspenseyCommitOnFiber(finishedWork); - commitRoot(root, recoverableErrors, transitions); + commitRoot(root, recoverableErrors, transitions, spawnedLane); } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { @@ -8310,17 +8354,23 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootSuspended(root, suspendedLanes) { +function markRootSuspended(root, suspendedLanes, spawnedLane) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for (root = root.expirationTimes; 0 < suspendedLanes; ) { - var index$3 = 31 - clz32(suspendedLanes), + for ( + var expirationTimes = root.expirationTimes, lanes = suspendedLanes; + 0 < lanes; + + ) { + var index$3 = 31 - clz32(lanes), lane = 1 << index$3; - root[index$3] = -1; - suspendedLanes &= ~lane; + expirationTimes[index$3] = -1; + lanes &= ~lane; } + 0 !== spawnedLane && + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } function resetWorkInProgressStack() { if (null !== workInProgress) { @@ -8357,7 +8407,8 @@ function prepareFreshStack(root, lanes) { workInProgressRootDidAttachPingListener = !1; workInProgressRootExitStatus = 0; workInProgressRootFatalError = null; - workInProgressRootPingedLanes = + workInProgressDeferredLane = + workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; @@ -8389,15 +8440,15 @@ function handleThrow(root, thrownValue) { (root = suspenseHandlerStackCursor.current), (workInProgressSuspendedReason = (null !== root && - ((workInProgressRootRenderLanes & 8388480) === + ((workInProgressRootRenderLanes & 4194176) === workInProgressRootRenderLanes ? null !== shellBoundary - : ((workInProgressRootRenderLanes & 125829120) !== + : ((workInProgressRootRenderLanes & 62914560) !== workInProgressRootRenderLanes && - 0 === (workInProgressRootRenderLanes & 1073741824)) || + 0 === (workInProgressRootRenderLanes & 536870912)) || root !== shellBoundary)) || - 0 !== (workInProgressRootSkippedLanes & 268435455) || - 0 !== (workInProgressRootInterleavedUpdatedLanes & 268435455) + 0 !== (workInProgressRootSkippedLanes & 134217727) || + 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) ? 3 : 2)) : thrownValue === SuspenseyCommitException @@ -8428,10 +8479,14 @@ function pushCacheDispatcher() { } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = 4; - null === workInProgressRoot || - (0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455)) || - markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes); + (0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || + null === workInProgressRoot || + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } function renderRootSync(root, lanes) { var prevExecutionContext = executionContext; @@ -8866,7 +8921,7 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } -function commitRoot(root, recoverableErrors, transitions) { +function commitRoot(root, recoverableErrors, transitions, spawnedLane) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig.transition; try { @@ -8876,7 +8931,8 @@ function commitRoot(root, recoverableErrors, transitions) { root, recoverableErrors, transitions, - previousUpdateLanePriority + previousUpdateLanePriority, + spawnedLane ); } finally { (ReactCurrentBatchConfig.transition = prevTransition), @@ -8888,7 +8944,8 @@ function commitRootImpl( root, recoverableErrors, transitions, - renderPriorityLevel + renderPriorityLevel, + spawnedLane ) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); @@ -8904,7 +8961,7 @@ function commitRootImpl( root.cancelPendingCommit = null; var remainingLanes = finishedWork.lanes | finishedWork.childLanes; remainingLanes |= concurrentlyUpdatedLanes; - markRootFinished(root, remainingLanes); + markRootFinished(root, remainingLanes, spawnedLane); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -8922,7 +8979,7 @@ function commitRootImpl( if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { transitions = ReactCurrentBatchConfig.transition; ReactCurrentBatchConfig.transition = null; - var previousPriority = currentUpdatePriority; + spawnedLane = currentUpdatePriority; currentUpdatePriority = 2; var prevExecutionContext = executionContext; executionContext |= 4; @@ -8933,7 +8990,7 @@ function commitRootImpl( commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); requestPaint(); executionContext = prevExecutionContext; - currentUpdatePriority = previousPriority; + currentUpdatePriority = spawnedLane; ReactCurrentBatchConfig.transition = transitions; } else root.current = finishedWork; rootDoesHavePassiveEffects @@ -8968,7 +9025,7 @@ function commitRootImpl( 0 !== root.tag && flushPassiveEffects(); remainingLanes = root.pendingLanes; - 0 !== (lanes & 8388522) && 0 !== (remainingLanes & SyncUpdateLanes) + 0 !== (lanes & 4194218) && 0 !== (remainingLanes & SyncUpdateLanes) ? root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) @@ -9114,7 +9171,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 125829120) === + (workInProgressRootRenderLanes & 62914560) === workInProgressRootRenderLanes && 300 > now() - globalMostRecentFallbackTime) ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) @@ -10106,19 +10163,19 @@ var slice = Array.prototype.slice, }; return Text; })(React.Component), - devToolsConfig$jscomp$inline_1143 = { + devToolsConfig$jscomp$inline_1146 = { findFiberByHostInstance: function () { return null; }, bundleType: 0, - version: "18.3.0-www-classic-b0a669da", + version: "18.3.0-www-classic-97e3e442", rendererPackageName: "react-art" }; -var internals$jscomp$inline_1318 = { - bundleType: devToolsConfig$jscomp$inline_1143.bundleType, - version: devToolsConfig$jscomp$inline_1143.version, - rendererPackageName: devToolsConfig$jscomp$inline_1143.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1143.rendererConfig, +var internals$jscomp$inline_1321 = { + bundleType: devToolsConfig$jscomp$inline_1146.bundleType, + version: devToolsConfig$jscomp$inline_1146.version, + rendererPackageName: devToolsConfig$jscomp$inline_1146.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1146.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10135,26 +10192,26 @@ var internals$jscomp$inline_1318 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1143.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1146.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-b0a669da" + reconcilerVersion: "18.3.0-www-classic-97e3e442" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1319 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1322 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1319.isDisabled && - hook$jscomp$inline_1319.supportsFiber + !hook$jscomp$inline_1322.isDisabled && + hook$jscomp$inline_1322.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1319.inject( - internals$jscomp$inline_1318 + (rendererID = hook$jscomp$inline_1322.inject( + internals$jscomp$inline_1321 )), - (injectedHook = hook$jscomp$inline_1319); + (injectedHook = hook$jscomp$inline_1322); } 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 3394de05f6..62d9a4b02b 100644 --- a/compiled/facebook-www/ReactART-prod.modern.js +++ b/compiled/facebook-www/ReactART-prod.modern.js @@ -278,7 +278,7 @@ function clz32Fallback(x) { } var SyncUpdateLanes = enableUnifiedSyncLane ? 42 : 2, nextTransitionLane = 128, - nextRetryLane = 8388608; + nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { if (enableUnifiedSyncLane) { var pendingSyncLanes = lanes & SyncUpdateLanes; @@ -314,13 +314,14 @@ function getHighestPriorityLanes(lanes) { case 524288: case 1048576: case 2097152: + return lanes & 4194176; case 4194304: - return lanes & 8388480; case 8388608: case 16777216: case 33554432: + return lanes & 62914560; case 67108864: - return lanes & 125829120; + return 67108864; case 134217728: return 134217728; case 268435456: @@ -328,7 +329,7 @@ function getHighestPriorityLanes(lanes) { case 536870912: return 536870912; case 1073741824: - return 1073741824; + return 0; default: return lanes; } @@ -339,7 +340,7 @@ function getNextLanes(root, wipLanes) { var nextLanes = 0, suspendedLanes = root.suspendedLanes; root = root.pingedLanes; - var nonIdlePendingLanes = pendingLanes & 268435455; + var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes @@ -358,7 +359,7 @@ function getNextLanes(root, wipLanes) { ((suspendedLanes = nextLanes & -nextLanes), (root = wipLanes & -wipLanes), suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 8388480))) + (32 === suspendedLanes && 0 !== (root & 4194176))) ? wipLanes : nextLanes; } @@ -387,13 +388,13 @@ function computeExpirationTime(lane, currentTime) { case 524288: case 1048576: case 2097152: - case 4194304: return currentTime + 5e3; + case 4194304: case 8388608: case 16777216: case 33554432: - case 67108864: return -1; + case 67108864: case 134217728: case 268435456: case 536870912: @@ -405,22 +406,16 @@ function computeExpirationTime(lane, currentTime) { } function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) return 0; - root = root.pendingLanes & -1073741825; - return 0 !== root ? root : root & 1073741824 ? 1073741824 : 0; + root = root.pendingLanes & -536870913; + return 0 !== root ? root : root & 536870912 ? 536870912 : 0; } function includesBlockingLane(root, lanes) { return 0 !== (root.current.mode & 32) ? !1 : 0 !== (lanes & 60); } -function claimNextTransitionLane() { - var lane = nextTransitionLane; - nextTransitionLane <<= 1; - 0 === (nextTransitionLane & 8388480) && (nextTransitionLane = 128); - return lane; -} function claimNextRetryLane() { var lane = nextRetryLane; nextRetryLane <<= 1; - 0 === (nextRetryLane & 125829120) && (nextRetryLane = 8388608); + 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304); return lane; } function createLaneMap(initial) { @@ -429,10 +424,10 @@ function createLaneMap(initial) { } function markRootUpdated(root, updateLane) { root.pendingLanes |= updateLane; - 536870912 !== updateLane && + 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0)); } -function markRootFinished(root, remainingLanes) { +function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; @@ -442,24 +437,37 @@ function markRootFinished(root, remainingLanes) { root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; remainingLanes = root.entanglements; - var expirationTimes = root.expirationTimes; - for (root = root.hiddenUpdates; 0 < noLongerPendingLanes; ) { + for ( + var expirationTimes = root.expirationTimes, + hiddenUpdates = root.hiddenUpdates; + 0 < noLongerPendingLanes; + + ) { var index$4 = 31 - clz32(noLongerPendingLanes), lane = 1 << index$4; remainingLanes[index$4] = 0; expirationTimes[index$4] = -1; - var hiddenUpdatesForLane = root[index$4]; + var hiddenUpdatesForLane = hiddenUpdates[index$4]; if (null !== hiddenUpdatesForLane) for ( - root[index$4] = null, index$4 = 0; + hiddenUpdates[index$4] = null, index$4 = 0; index$4 < hiddenUpdatesForLane.length; index$4++ ) { var update = hiddenUpdatesForLane[index$4]; - null !== update && (update.lane &= -1073741825); + null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; } + 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); +} +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; + var spawnedLaneIndex = 31 - clz32(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] = + root.entanglements[spawnedLaneIndex] | 1073741824 | entangledLanes; } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); @@ -500,9 +508,9 @@ function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes ? 8 < lanes - ? 0 !== (lanes & 268435455) + ? 0 !== (lanes & 134217727) ? 32 - : 536870912 + : 268435456 : 8 : 2; } @@ -876,7 +884,7 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { null === sourceFiber ? (parent[isHidden] = [update]) : sourceFiber.push(update), - (update.lane = lane | 1073741824)); + (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { if (50 < nestedUpdateCount) @@ -932,7 +940,7 @@ function enqueueUpdate(fiber, update, lane) { } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 4194176))) { var queueLanes = fiber.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -1020,7 +1028,7 @@ function processUpdateQueue( current = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { - var updateLane = pendingQueue.lane & -1073741825, + var updateLane = pendingQueue.lane & -536870913, isHiddenUpdate = updateLane !== pendingQueue.lane; if ( isHiddenUpdate @@ -2133,7 +2141,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { prepareFreshStack(workInProgressRootRenderLanes$29, 0), markRootSuspended( workInProgressRootRenderLanes$29, - nextLanes + nextLanes, + 0 ), ensureRootIsScheduled(workInProgressRootRenderLanes$29), originallyAttemptedLanes) @@ -2141,7 +2150,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { 6 === exitStatus ? markRootSuspended( workInProgressRootRenderLanes$29, - nextLanes + nextLanes, + 0 ) : ((workInProgressRootRenderLanes$29.finishedWork = workInProgressRootRenderLanes$29.current.alternate), @@ -2150,7 +2160,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { commitRoot( workInProgressRootRenderLanes$29, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane )); } ensureRootIsScheduled(workInProgressRootRenderLanes$29); @@ -2202,7 +2213,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { var suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, - lanes = root.pendingLanes & -125829121; + lanes = root.pendingLanes & -62914561; 0 < lanes; ) { @@ -2256,7 +2267,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { case 32: suspendedLanes = NormalPriority$1; break; - case 536870912: + case 268435456: suspendedLanes = IdlePriority; break; default: @@ -2269,8 +2280,12 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { return currentTime; } function requestTransitionLane() { - 0 === currentEventTransitionLane && - (currentEventTransitionLane = claimNextTransitionLane()); + if (0 === currentEventTransitionLane) { + var lane = nextTransitionLane; + nextTransitionLane <<= 1; + 0 === (nextTransitionLane & 4194176) && (nextTransitionLane = 128); + currentEventTransitionLane = lane; + } return currentEventTransitionLane; } var currentEntangledListeners = null, @@ -2593,7 +2608,7 @@ function updateReducerImpl(hook, current, reducer) { newBaseQueueLast = null, update = current; do { - var updateLane = update.lane & -1073741825; + var updateLane = update.lane & -536870913; if ( updateLane !== update.lane ? (workInProgressRootRenderLanes & updateLane) === updateLane @@ -2926,9 +2941,11 @@ function updateMemo(nextCreate, deps) { return nextCreate; } function mountDeferredValueImpl(hook, value, initialValue) { - return enableUseDeferredValueInitialArg && void 0 !== initialValue + return enableUseDeferredValueInitialArg && + void 0 !== initialValue && + 0 === (renderLanes & 1073741824) ? ((hook.memoizedState = initialValue), - (value = claimNextTransitionLane()), + (value = requestDeferredLane()), (currentlyRenderingFiber$1.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0), @@ -2942,7 +2959,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { (hook.memoizedState = value) ); objectIs(value, prevValue) || - ((value = claimNextTransitionLane()), + ((value = requestDeferredLane()), (currentlyRenderingFiber$1.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); @@ -3126,7 +3143,7 @@ function enqueueRenderPhaseUpdate(queue, update) { queue.pending = update; } function entangleTransitionUpdate(root, queue, lane) { - if (0 !== (lane & 8388480)) { + if (0 !== (lane & 4194176)) { var queueLanes = queue.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -3899,7 +3916,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) { null !== current && pushTransition(workInProgress, null, null), reuseHiddenContextOnStack(), pushOffscreenSuspenseHandler(workInProgress); - else if (0 !== (renderLanes & 1073741824)) + else if (0 !== (renderLanes & 536870912)) (workInProgress.memoizedState = { baseLanes: 0, cachePool: null }), null !== current && pushTransition( @@ -3913,7 +3930,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) { pushOffscreenSuspenseHandler(workInProgress); else return ( - (workInProgress.lanes = workInProgress.childLanes = 1073741824), + (workInProgress.lanes = workInProgress.childLanes = 536870912), deferHiddenOffscreenComponent( current, workInProgress, @@ -4313,7 +4330,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.child.memoizedState = mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress.lanes = 8388608), + (workInProgress.lanes = 4194304), current ); pushPrimaryTreeSuspenseHandler(workInProgress); @@ -4602,11 +4619,10 @@ function updateDehydratedSuspenseComponent( case 8388608: case 16777216: case 33554432: - case 67108864: didSuspend = 64; break; - case 536870912: - didSuspend = 268435456; + case 268435456: + didSuspend = 134217728; break; default: didSuspend = 0; @@ -5329,7 +5345,7 @@ function scheduleRetryEffect(workInProgress, retryQueue) { ? (workInProgress.flags |= 4) : workInProgress.flags & 16384 && ((retryQueue = - 22 !== workInProgress.tag ? claimNextRetryLane() : 1073741824), + 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), (workInProgress.lanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { @@ -5610,7 +5626,7 @@ function completeWork(current, workInProgress, renderLanes) { ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(instance, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); } else { if (!newProps) @@ -5630,11 +5646,11 @@ function completeWork(current, workInProgress, renderLanes) { } else 2 * now() - instance.renderingStartTime > workInProgressRootRenderTargetTime && - 1073741824 !== renderLanes && + 536870912 !== renderLanes && ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(instance, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); instance.isBackwards ? ((cache$80.sibling = workInProgress.child), (workInProgress.child = cache$80)) @@ -5687,7 +5703,7 @@ function completeWork(current, workInProgress, renderLanes) { (workInProgress.flags |= 8192) : newProps && (workInProgress.flags |= 8192)), newProps && 0 !== (workInProgress.mode & 1) - ? 0 !== (renderLanes & 1073741824) && + ? 0 !== (renderLanes & 536870912) && 0 === (workInProgress.flags & 128) && (bubbleProperties(workInProgress), 23 !== workInProgress.tag && @@ -7733,6 +7749,7 @@ var DefaultCacheDispatcher = { workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, workInProgressRootPingedLanes = 0, + workInProgressDeferredLane = 0, workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, globalMostRecentFallbackTime = 0, @@ -7823,13 +7840,25 @@ function requestUpdateLane(fiber) { fiber = currentUpdatePriority; return 0 !== fiber ? fiber : 32; } +function requestDeferredLane() { + 0 === workInProgressDeferredLane && + (workInProgressDeferredLane = + 0 !== (workInProgressRootRenderLanes & 536870912) + ? 536870912 + : requestTransitionLane()); + return workInProgressDeferredLane; +} function scheduleUpdateOnFiber(root, fiber, lane) { if ( (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || null !== root.cancelPendingCommit ) prepareFreshStack(root, 0), - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); markRootUpdated(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) { if (enableTransitionTracing) { @@ -7852,7 +7881,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { (0 === (executionContext & 2) && (workInProgressRootInterleavedUpdatedLanes |= lane), 4 === workInProgressRootExitStatus && - markRootSuspended(root, workInProgressRootRenderLanes)); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + )); ensureRootIsScheduled(root); 2 === lane && 0 === executionContext && @@ -7880,7 +7913,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (0 !== exitStatus) { var renderWasConcurrent = didTimeout; do { - if (6 === exitStatus) markRootSuspended(root, lanes); + if (6 === exitStatus) markRootSuspended(root, lanes, 0); else { didTimeout = root.current.alternate; if ( @@ -7909,7 +7942,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { throw ( ((originalCallbackNode = workInProgressRootFatalError), prepareFreshStack(root, 0), - markRootSuspended(root, lanes), + markRootSuspended(root, lanes, 0), ensureRootIsScheduled(root), originalCallbackNode) ); @@ -7922,8 +7955,12 @@ function performConcurrentWorkOnRoot(root, didTimeout) { case 1: throw Error(formatProdErrorMessage(345)); case 4: - if ((lanes & 8388480) === lanes) { - markRootSuspended(renderWasConcurrent, lanes); + if ((lanes & 4194176) === lanes) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); break a; } break; @@ -7935,12 +7972,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { throw Error(formatProdErrorMessage(329)); } if ( - (lanes & 125829120) === lanes && + (lanes & 62914560) === lanes && (alwaysThrottleRetries || 3 === exitStatus) && ((exitStatus = globalMostRecentFallbackTime + 300 - now()), 10 < exitStatus) ) { - markRootSuspended(renderWasConcurrent, lanes); + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; renderWasConcurrent.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( @@ -7949,7 +7990,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ), exitStatus ); @@ -7960,7 +8002,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ); } } @@ -8011,10 +8054,11 @@ function commitRootWhenReady( finishedWork, recoverableErrors, transitions, - lanes + lanes, + spawnedLane ) { 0 === (lanes & 42) && accumulateSuspenseyCommitOnFiber(finishedWork); - commitRoot(root, recoverableErrors, transitions); + commitRoot(root, recoverableErrors, transitions, spawnedLane); } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { @@ -8050,17 +8094,23 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootSuspended(root, suspendedLanes) { +function markRootSuspended(root, suspendedLanes, spawnedLane) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for (root = root.expirationTimes; 0 < suspendedLanes; ) { - var index$3 = 31 - clz32(suspendedLanes), + for ( + var expirationTimes = root.expirationTimes, lanes = suspendedLanes; + 0 < lanes; + + ) { + var index$3 = 31 - clz32(lanes), lane = 1 << index$3; - root[index$3] = -1; - suspendedLanes &= ~lane; + expirationTimes[index$3] = -1; + lanes &= ~lane; } + 0 !== spawnedLane && + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } function resetWorkInProgressStack() { if (null !== workInProgress) { @@ -8097,7 +8147,8 @@ function prepareFreshStack(root, lanes) { workInProgressRootDidAttachPingListener = !1; workInProgressRootExitStatus = 0; workInProgressRootFatalError = null; - workInProgressRootPingedLanes = + workInProgressDeferredLane = + workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; @@ -8129,15 +8180,15 @@ function handleThrow(root, thrownValue) { (root = suspenseHandlerStackCursor.current), (workInProgressSuspendedReason = (null !== root && - ((workInProgressRootRenderLanes & 8388480) === + ((workInProgressRootRenderLanes & 4194176) === workInProgressRootRenderLanes ? null !== shellBoundary - : ((workInProgressRootRenderLanes & 125829120) !== + : ((workInProgressRootRenderLanes & 62914560) !== workInProgressRootRenderLanes && - 0 === (workInProgressRootRenderLanes & 1073741824)) || + 0 === (workInProgressRootRenderLanes & 536870912)) || root !== shellBoundary)) || - 0 !== (workInProgressRootSkippedLanes & 268435455) || - 0 !== (workInProgressRootInterleavedUpdatedLanes & 268435455) + 0 !== (workInProgressRootSkippedLanes & 134217727) || + 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) ? 3 : 2)) : thrownValue === SuspenseyCommitException @@ -8168,10 +8219,14 @@ function pushCacheDispatcher() { } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = 4; - null === workInProgressRoot || - (0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455)) || - markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes); + (0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || + null === workInProgressRoot || + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } function renderRootSync(root, lanes) { var prevExecutionContext = executionContext; @@ -8602,7 +8657,7 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } -function commitRoot(root, recoverableErrors, transitions) { +function commitRoot(root, recoverableErrors, transitions, spawnedLane) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig.transition; try { @@ -8612,7 +8667,8 @@ function commitRoot(root, recoverableErrors, transitions) { root, recoverableErrors, transitions, - previousUpdateLanePriority + previousUpdateLanePriority, + spawnedLane ); } finally { (ReactCurrentBatchConfig.transition = prevTransition), @@ -8624,7 +8680,8 @@ function commitRootImpl( root, recoverableErrors, transitions, - renderPriorityLevel + renderPriorityLevel, + spawnedLane ) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); @@ -8640,7 +8697,7 @@ function commitRootImpl( root.cancelPendingCommit = null; var remainingLanes = finishedWork.lanes | finishedWork.childLanes; remainingLanes |= concurrentlyUpdatedLanes; - markRootFinished(root, remainingLanes); + markRootFinished(root, remainingLanes, spawnedLane); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -8658,7 +8715,7 @@ function commitRootImpl( if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { transitions = ReactCurrentBatchConfig.transition; ReactCurrentBatchConfig.transition = null; - var previousPriority = currentUpdatePriority; + spawnedLane = currentUpdatePriority; currentUpdatePriority = 2; var prevExecutionContext = executionContext; executionContext |= 4; @@ -8669,7 +8726,7 @@ function commitRootImpl( commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); requestPaint(); executionContext = prevExecutionContext; - currentUpdatePriority = previousPriority; + currentUpdatePriority = spawnedLane; ReactCurrentBatchConfig.transition = transitions; } else root.current = finishedWork; rootDoesHavePassiveEffects @@ -8704,7 +8761,7 @@ function commitRootImpl( 0 !== root.tag && flushPassiveEffects(); remainingLanes = root.pendingLanes; - 0 !== (lanes & 8388522) && 0 !== (remainingLanes & SyncUpdateLanes) + 0 !== (lanes & 4194218) && 0 !== (remainingLanes & SyncUpdateLanes) ? root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) @@ -8850,7 +8907,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 125829120) === + (workInProgressRootRenderLanes & 62914560) === workInProgressRootRenderLanes && 300 > now() - globalMostRecentFallbackTime) ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) @@ -9775,19 +9832,19 @@ var slice = Array.prototype.slice, }; return Text; })(React.Component), - devToolsConfig$jscomp$inline_1123 = { + devToolsConfig$jscomp$inline_1126 = { findFiberByHostInstance: function () { return null; }, bundleType: 0, - version: "18.3.0-www-modern-9da1579a", + version: "18.3.0-www-modern-504a3f39", rendererPackageName: "react-art" }; -var internals$jscomp$inline_1298 = { - bundleType: devToolsConfig$jscomp$inline_1123.bundleType, - version: devToolsConfig$jscomp$inline_1123.version, - rendererPackageName: devToolsConfig$jscomp$inline_1123.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1123.rendererConfig, +var internals$jscomp$inline_1301 = { + bundleType: devToolsConfig$jscomp$inline_1126.bundleType, + version: devToolsConfig$jscomp$inline_1126.version, + rendererPackageName: devToolsConfig$jscomp$inline_1126.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1126.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -9804,26 +9861,26 @@ var internals$jscomp$inline_1298 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1123.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1126.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-9da1579a" + reconcilerVersion: "18.3.0-www-modern-504a3f39" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1299 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1302 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1299.isDisabled && - hook$jscomp$inline_1299.supportsFiber + !hook$jscomp$inline_1302.isDisabled && + hook$jscomp$inline_1302.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1299.inject( - internals$jscomp$inline_1298 + (rendererID = hook$jscomp$inline_1302.inject( + internals$jscomp$inline_1301 )), - (injectedHook = hook$jscomp$inline_1299); + (injectedHook = hook$jscomp$inline_1302); } 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 f0e2800a2d..f4375788cf 100644 --- a/compiled/facebook-www/ReactDOM-dev.classic.js +++ b/compiled/facebook-www/ReactDOM-dev.classic.js @@ -1761,7 +1761,7 @@ var TransitionHydrationLane = 64; var TransitionLanes = /* */ - 8388480; + 4194176; var TransitionLane1 = /* */ 128; @@ -1807,39 +1807,39 @@ var TransitionLane14 = var TransitionLane15 = /* */ 2097152; -var TransitionLane16 = - /* */ - 4194304; var RetryLanes = /* */ - 125829120; + 62914560; var RetryLane1 = /* */ - 8388608; + 4194304; var RetryLane2 = /* */ - 16777216; + 8388608; var RetryLane3 = /* */ - 33554432; + 16777216; var RetryLane4 = /* */ - 67108864; + 33554432; var SomeRetryLane = RetryLane1; var SelectiveHydrationLane = /* */ - 134217728; + 67108864; var NonIdleLanes = /* */ - 268435455; + 134217727; var IdleHydrationLane = /* */ - 268435456; + 134217728; var IdleLane = /* */ - 536870912; + 268435456; var OffscreenLane = /* */ + 536870912; +var DeferredLane = + /* */ 1073741824; // Any lane that might schedule an update. This is used to detect infinite // update loops, so it doesn't include hydration lanes or retries. @@ -1900,6 +1900,10 @@ function getLabelForLane(lane) { if (lane & OffscreenLane) { return "Offscreen"; } + + if (lane & DeferredLane) { + return "Deferred"; + } } } var NoTimestamp = -1; @@ -1952,7 +1956,6 @@ function getHighestPriorityLanes(lanes) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: return lanes & TransitionLanes; case RetryLane1: @@ -1973,6 +1976,11 @@ function getHighestPriorityLanes(lanes) { case OffscreenLane: return OffscreenLane; + case DeferredLane: + // This shouldn't be reachable because deferred work is always entangled + // with something else. + return NoLanes; + default: { error("Should have found matching lanes. This is a bug in React."); @@ -2139,7 +2147,6 @@ function computeExpirationTime(lane, currentTime) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: return currentTime + 5000; case RetryLane1: @@ -2157,6 +2164,7 @@ function computeExpirationTime(lane, currentTime) { case IdleHydrationLane: case IdleLane: case OffscreenLane: + case DeferredLane: // Anything idle priority or lower should never expire. return NoTimestamp; @@ -2369,7 +2377,7 @@ function markRootUpdated(root, updateLane) { root.pingedLanes = NoLanes; } } -function markRootSuspended$1(root, suspendedLanes) { +function markRootSuspended$1(root, suspendedLanes, spawnedLane) { root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. @@ -2382,11 +2390,15 @@ function markRootSuspended$1(root, suspendedLanes) { expirationTimes[index] = NoTimestamp; lanes &= ~lane; } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); + } } function markRootPinged(root, pingedLanes) { root.pingedLanes |= root.suspendedLanes & pingedLanes; } -function markRootFinished(root, remainingLanes) { +function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; // Let's try everything again @@ -2426,7 +2438,32 @@ function markRootFinished(root, remainingLanes) { lanes &= ~lane; } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane( + root, + spawnedLane, // This render finished successfully without suspending, so we don't need + // to entangle the spawned task with the parent task. + NoLanes + ); + } +} + +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + // This render spawned a deferred task. Mark it as pending. + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; // Entangle the spawned lane with the DeferredLane bit so that we know it + // was the result of another render. This lets us avoid a useDeferredValue + // waterfall — only the first level will defer. + + var spawnedLaneIndex = laneToIndex(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] |= + DeferredLane | // If the parent render task suspended, we must also entangle those lanes + // with the spawned task. + entangledLanes; } + function markRootEntangled(root, entangledLanes) { // In addition to entangling each of the given lanes with each other, we also // have to consider _transitive_ entanglements. For each lane that is already @@ -2529,7 +2566,6 @@ function getBumpedLaneForHydration(root, renderLanes) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: case RetryLane1: case RetryLane2: case RetryLane3: @@ -14344,15 +14380,18 @@ function rerenderDeferredValue(value, initialValue) { } function mountDeferredValueImpl(hook, value, initialValue) { - if (enableUseDeferredValueInitialArg && initialValue !== undefined) { - // When `initialValue` is provided, we defer the initial render even if the + if ( + enableUseDeferredValueInitialArg && // When `initialValue` is provided, we defer the initial render even if the // current render is not synchronous. - // TODO: However, to avoid waterfalls, we should not defer if this render - // was itself spawned by an earlier useDeferredValue. Plan is to add a - // Deferred lane to track this. - hook.memoizedState = initialValue; // Schedule a deferred render + initialValue !== undefined && // However, to avoid waterfalls, we do not defer if this render + // was itself spawned by an earlier useDeferredValue. Check if DeferredLane + // is part of the render lanes. + !includesSomeLane(renderLanes, DeferredLane) + ) { + // Render with the initial value + hook.memoizedState = initialValue; // Schedule a deferred render to switch to the final value. - var deferredLane = claimNextTransitionLane(); + var deferredLane = requestDeferredLane(); currentlyRenderingFiber$1.lanes = mergeLanes( currentlyRenderingFiber$1.lanes, deferredLane @@ -14380,7 +14419,7 @@ function updateDeferredValueImpl(hook, prevValue, value, initialValue) { // previous value and spawn a deferred render to update it later. if (!objectIs(value, prevValue)) { // Schedule a deferred render - var deferredLane = claimNextTransitionLane(); + var deferredLane = requestDeferredLane(); currentlyRenderingFiber$1.lanes = mergeLanes( currentlyRenderingFiber$1.lanes, deferredLane @@ -29362,7 +29401,9 @@ var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event). -var workInProgressRootPingedLanes = NoLanes; // Errors that are thrown during the render phase. +var workInProgressRootPingedLanes = NoLanes; // If this lane scheduled deferred work, this is the lane of the deferred task. + +var workInProgressDeferredLane = NoLane; // Errors that are thrown during the render phase. var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI. // We will log them once the tree commits. @@ -29645,6 +29686,27 @@ function requestRetryLane(fiber) { return claimNextRetryLane(); } +function requestDeferredLane() { + if (workInProgressDeferredLane === NoLane) { + // If there are multiple useDeferredValue hooks in the same render, the + // tasks that they spawn should all be batched together, so they should all + // receive the same lane. + if (includesSomeLane(workInProgressRootRenderLanes, OffscreenLane)) { + // There's only one OffscreenLane, so if it contains deferred work, we + // should just reschedule using the same lane. + // TODO: We also use OffscreenLane for hydration, on the basis that the + // initial HTML is the same as the hydrated UI, but since the deferred + // task will change the UI, it should be treated like an update. Use + // TransitionHydrationLane to trigger selective hydration. + workInProgressDeferredLane = OffscreenLane; + } else { + // Everything else is spawned as a transition. + workInProgressDeferredLane = requestTransitionLane(); + } + } + + return workInProgressDeferredLane; +} function scheduleUpdateOnFiber(root, fiber, lane) { { if (isRunningInsertionEffect) { @@ -29668,7 +29730,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { // The incoming update might unblock the current render. Interrupt the // current attempt and restart from the top. prepareFreshStack(root, NoLanes); - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } // Mark that the root has a pending update. markRootUpdated(root, lane); @@ -29749,7 +29815,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { // effect of interrupting the current render and switching to the update. // TODO: Make sure this doesn't override pings that happen while we've // already started rendering. - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } } @@ -29852,7 +29922,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); } else { // The render completed. // Check if this render may have yielded to a concurrent event, and if so, @@ -29897,7 +29967,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); throw fatalError; } // We now have a consistent tree. The next step is either to commit it, @@ -30017,7 +30087,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { // This is a transition, so we should exit without committing a // placeholder and without scheduling a timeout. Delay indefinitely // until we receive more data. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, workInProgressDeferredLane); return; } // Commit the placeholder. @@ -30040,7 +30110,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { commitRoot( root, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane ); } else { if ( @@ -30053,7 +30124,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now$1(); // Don't bother with a very short suspense time. if (msUntilTimeout > 10) { - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, workInProgressDeferredLane); var nextLanes = getNextLanes(root, NoLanes); if (nextLanes !== NoLanes) { @@ -30073,7 +30144,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { finishedWork, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ), msUntilTimeout ); @@ -30086,7 +30158,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { finishedWork, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ); } } @@ -30096,7 +30169,8 @@ function commitRootWhenReady( finishedWork, recoverableErrors, transitions, - lanes + lanes, + spawnedLane ) { // TODO: Combine retry throttling with Suspensey commits. Right now they run // one after the other. @@ -30124,12 +30198,12 @@ function commitRootWhenReady( root.cancelPendingCommit = schedulePendingCommit( commitRoot.bind(null, root, recoverableErrors, transitions) ); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, spawnedLane); return; } } // Otherwise, commit immediately. - commitRoot(root, recoverableErrors, transitions); + commitRoot(root, recoverableErrors, transitions, spawnedLane); } function isRenderConsistentWithExternalStores(finishedWork) { @@ -30194,7 +30268,7 @@ function isRenderConsistentWithExternalStores(finishedWork) { return true; } -function markRootSuspended(root, suspendedLanes) { +function markRootSuspended(root, suspendedLanes, spawnedLane) { // When suspending, we should always exclude lanes that were pinged or (more // rarely, since we try to avoid it) updated during the render phase. // TODO: Lol maybe there's a better way to factor this besides this @@ -30204,7 +30278,7 @@ function markRootSuspended(root, suspendedLanes) { suspendedLanes, workInProgressRootInterleavedUpdatedLanes ); - markRootSuspended$1(root, suspendedLanes); + markRootSuspended$1(root, suspendedLanes, spawnedLane); } // This is the entry point for synchronous tasks that don't go // through Scheduler @@ -30256,7 +30330,7 @@ function performSyncWorkOnRoot(root, lanes) { if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); throw fatalError; } @@ -30265,7 +30339,7 @@ function performSyncWorkOnRoot(root, lanes) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); return null; } // We now have a consistent tree. Because this is a sync render, we @@ -30277,7 +30351,8 @@ function performSyncWorkOnRoot(root, lanes) { commitRoot( root, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane ); // Before exiting, make sure there's a callback scheduled for the next // pending level. @@ -30439,6 +30514,7 @@ function prepareFreshStack(root, lanes) { workInProgressRootSkippedLanes = NoLanes; workInProgressRootInterleavedUpdatedLanes = NoLanes; workInProgressRootPingedLanes = NoLanes; + workInProgressDeferredLane = NoLane; workInProgressRootConcurrentErrors = null; workInProgressRootRecoverableErrors = null; // Get the lanes that are entangled with whatever we're about to render. We // track these separately so we can distinguish the priority of the render @@ -30681,9 +30757,9 @@ function renderDidSuspendDelayIfPossible() { // this render. if ( - workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || - includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) + includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) && + workInProgressRoot !== null ) { // Mark the current render as suspended so that we switch to working on // the updates that were skipped. Usually we only suspend at the end of @@ -30694,8 +30770,11 @@ function renderDidSuspendDelayIfPossible() { // pinged or updated while we were rendering. // TODO: Consider unwinding immediately, using the // SuspendedOnHydration mechanism. - // $FlowFixMe[incompatible-call] need null check workInProgressRoot - markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes); + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } } function renderDidError(error) { @@ -31474,7 +31553,7 @@ function unwindUnitOfWork(unitOfWork) { workInProgress = null; } -function commitRoot(root, recoverableErrors, transitions) { +function commitRoot(root, recoverableErrors, transitions, spawnedLane) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. var previousUpdateLanePriority = getCurrentUpdatePriority(); @@ -31487,7 +31566,8 @@ function commitRoot(root, recoverableErrors, transitions) { root, recoverableErrors, transitions, - previousUpdateLanePriority + previousUpdateLanePriority, + spawnedLane ); } finally { ReactCurrentBatchConfig$1.transition = prevTransition; @@ -31501,7 +31581,8 @@ function commitRootImpl( root, recoverableErrors, transitions, - renderPriorityLevel + renderPriorityLevel, + spawnedLane ) { do { // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which @@ -31576,7 +31657,7 @@ function commitRootImpl( var concurrentlyUpdatedLanes = getConcurrentlyUpdatedLanes(); remainingLanes = mergeLanes(remainingLanes, concurrentlyUpdatedLanes); - markRootFinished(root, remainingLanes); + markRootFinished(root, remainingLanes, spawnedLane); if (root === workInProgressRoot) { // We can reset these now that they are finished. @@ -34071,7 +34152,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-9360aec2"; +var ReactVersion = "18.3.0-www-classic-1493a174"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOM-dev.modern.js b/compiled/facebook-www/ReactDOM-dev.modern.js index d069916e48..c7216c6dc1 100644 --- a/compiled/facebook-www/ReactDOM-dev.modern.js +++ b/compiled/facebook-www/ReactDOM-dev.modern.js @@ -1118,7 +1118,7 @@ var TransitionHydrationLane = 64; var TransitionLanes = /* */ - 8388480; + 4194176; var TransitionLane1 = /* */ 128; @@ -1164,39 +1164,39 @@ var TransitionLane14 = var TransitionLane15 = /* */ 2097152; -var TransitionLane16 = - /* */ - 4194304; var RetryLanes = /* */ - 125829120; + 62914560; var RetryLane1 = /* */ - 8388608; + 4194304; var RetryLane2 = /* */ - 16777216; + 8388608; var RetryLane3 = /* */ - 33554432; + 16777216; var RetryLane4 = /* */ - 67108864; + 33554432; var SomeRetryLane = RetryLane1; var SelectiveHydrationLane = /* */ - 134217728; + 67108864; var NonIdleLanes = /* */ - 268435455; + 134217727; var IdleHydrationLane = /* */ - 268435456; + 134217728; var IdleLane = /* */ - 536870912; + 268435456; var OffscreenLane = /* */ + 536870912; +var DeferredLane = + /* */ 1073741824; // Any lane that might schedule an update. This is used to detect infinite // update loops, so it doesn't include hydration lanes or retries. @@ -1257,6 +1257,10 @@ function getLabelForLane(lane) { if (lane & OffscreenLane) { return "Offscreen"; } + + if (lane & DeferredLane) { + return "Deferred"; + } } } var NoTimestamp = -1; @@ -1309,7 +1313,6 @@ function getHighestPriorityLanes(lanes) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: return lanes & TransitionLanes; case RetryLane1: @@ -1330,6 +1333,11 @@ function getHighestPriorityLanes(lanes) { case OffscreenLane: return OffscreenLane; + case DeferredLane: + // This shouldn't be reachable because deferred work is always entangled + // with something else. + return NoLanes; + default: { error("Should have found matching lanes. This is a bug in React."); @@ -1496,7 +1504,6 @@ function computeExpirationTime(lane, currentTime) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: return currentTime + 5000; case RetryLane1: @@ -1514,6 +1521,7 @@ function computeExpirationTime(lane, currentTime) { case IdleHydrationLane: case IdleLane: case OffscreenLane: + case DeferredLane: // Anything idle priority or lower should never expire. return NoTimestamp; @@ -1726,7 +1734,7 @@ function markRootUpdated(root, updateLane) { root.pingedLanes = NoLanes; } } -function markRootSuspended$1(root, suspendedLanes) { +function markRootSuspended$1(root, suspendedLanes, spawnedLane) { root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. @@ -1739,11 +1747,15 @@ function markRootSuspended$1(root, suspendedLanes) { expirationTimes[index] = NoTimestamp; lanes &= ~lane; } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); + } } function markRootPinged(root, pingedLanes) { root.pingedLanes |= root.suspendedLanes & pingedLanes; } -function markRootFinished(root, remainingLanes) { +function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; // Let's try everything again @@ -1783,7 +1795,32 @@ function markRootFinished(root, remainingLanes) { lanes &= ~lane; } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane( + root, + spawnedLane, // This render finished successfully without suspending, so we don't need + // to entangle the spawned task with the parent task. + NoLanes + ); + } +} + +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + // This render spawned a deferred task. Mark it as pending. + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; // Entangle the spawned lane with the DeferredLane bit so that we know it + // was the result of another render. This lets us avoid a useDeferredValue + // waterfall — only the first level will defer. + + var spawnedLaneIndex = laneToIndex(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] |= + DeferredLane | // If the parent render task suspended, we must also entangle those lanes + // with the spawned task. + entangledLanes; } + function markRootEntangled(root, entangledLanes) { // In addition to entangling each of the given lanes with each other, we also // have to consider _transitive_ entanglements. For each lane that is already @@ -1886,7 +1923,6 @@ function getBumpedLaneForHydration(root, renderLanes) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: case RetryLane1: case RetryLane2: case RetryLane3: @@ -14285,15 +14321,18 @@ function rerenderDeferredValue(value, initialValue) { } function mountDeferredValueImpl(hook, value, initialValue) { - if (enableUseDeferredValueInitialArg && initialValue !== undefined) { - // When `initialValue` is provided, we defer the initial render even if the + if ( + enableUseDeferredValueInitialArg && // When `initialValue` is provided, we defer the initial render even if the // current render is not synchronous. - // TODO: However, to avoid waterfalls, we should not defer if this render - // was itself spawned by an earlier useDeferredValue. Plan is to add a - // Deferred lane to track this. - hook.memoizedState = initialValue; // Schedule a deferred render + initialValue !== undefined && // However, to avoid waterfalls, we do not defer if this render + // was itself spawned by an earlier useDeferredValue. Check if DeferredLane + // is part of the render lanes. + !includesSomeLane(renderLanes, DeferredLane) + ) { + // Render with the initial value + hook.memoizedState = initialValue; // Schedule a deferred render to switch to the final value. - var deferredLane = claimNextTransitionLane(); + var deferredLane = requestDeferredLane(); currentlyRenderingFiber$1.lanes = mergeLanes( currentlyRenderingFiber$1.lanes, deferredLane @@ -14321,7 +14360,7 @@ function updateDeferredValueImpl(hook, prevValue, value, initialValue) { // previous value and spawn a deferred render to update it later. if (!objectIs(value, prevValue)) { // Schedule a deferred render - var deferredLane = claimNextTransitionLane(); + var deferredLane = requestDeferredLane(); currentlyRenderingFiber$1.lanes = mergeLanes( currentlyRenderingFiber$1.lanes, deferredLane @@ -29212,7 +29251,9 @@ var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event). -var workInProgressRootPingedLanes = NoLanes; // Errors that are thrown during the render phase. +var workInProgressRootPingedLanes = NoLanes; // If this lane scheduled deferred work, this is the lane of the deferred task. + +var workInProgressDeferredLane = NoLane; // Errors that are thrown during the render phase. var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI. // We will log them once the tree commits. @@ -29495,6 +29536,27 @@ function requestRetryLane(fiber) { return claimNextRetryLane(); } +function requestDeferredLane() { + if (workInProgressDeferredLane === NoLane) { + // If there are multiple useDeferredValue hooks in the same render, the + // tasks that they spawn should all be batched together, so they should all + // receive the same lane. + if (includesSomeLane(workInProgressRootRenderLanes, OffscreenLane)) { + // There's only one OffscreenLane, so if it contains deferred work, we + // should just reschedule using the same lane. + // TODO: We also use OffscreenLane for hydration, on the basis that the + // initial HTML is the same as the hydrated UI, but since the deferred + // task will change the UI, it should be treated like an update. Use + // TransitionHydrationLane to trigger selective hydration. + workInProgressDeferredLane = OffscreenLane; + } else { + // Everything else is spawned as a transition. + workInProgressDeferredLane = requestTransitionLane(); + } + } + + return workInProgressDeferredLane; +} function scheduleUpdateOnFiber(root, fiber, lane) { { if (isRunningInsertionEffect) { @@ -29518,7 +29580,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { // The incoming update might unblock the current render. Interrupt the // current attempt and restart from the top. prepareFreshStack(root, NoLanes); - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } // Mark that the root has a pending update. markRootUpdated(root, lane); @@ -29599,7 +29665,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { // effect of interrupting the current render and switching to the update. // TODO: Make sure this doesn't override pings that happen while we've // already started rendering. - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } } @@ -29702,7 +29772,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); } else { // The render completed. // Check if this render may have yielded to a concurrent event, and if so, @@ -29747,7 +29817,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); throw fatalError; } // We now have a consistent tree. The next step is either to commit it, @@ -29867,7 +29937,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { // This is a transition, so we should exit without committing a // placeholder and without scheduling a timeout. Delay indefinitely // until we receive more data. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, workInProgressDeferredLane); return; } // Commit the placeholder. @@ -29890,7 +29960,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { commitRoot( root, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane ); } else { if ( @@ -29903,7 +29974,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now$1(); // Don't bother with a very short suspense time. if (msUntilTimeout > 10) { - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, workInProgressDeferredLane); var nextLanes = getNextLanes(root, NoLanes); if (nextLanes !== NoLanes) { @@ -29923,7 +29994,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { finishedWork, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ), msUntilTimeout ); @@ -29936,7 +30008,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { finishedWork, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ); } } @@ -29946,7 +30019,8 @@ function commitRootWhenReady( finishedWork, recoverableErrors, transitions, - lanes + lanes, + spawnedLane ) { // TODO: Combine retry throttling with Suspensey commits. Right now they run // one after the other. @@ -29974,12 +30048,12 @@ function commitRootWhenReady( root.cancelPendingCommit = schedulePendingCommit( commitRoot.bind(null, root, recoverableErrors, transitions) ); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, spawnedLane); return; } } // Otherwise, commit immediately. - commitRoot(root, recoverableErrors, transitions); + commitRoot(root, recoverableErrors, transitions, spawnedLane); } function isRenderConsistentWithExternalStores(finishedWork) { @@ -30044,7 +30118,7 @@ function isRenderConsistentWithExternalStores(finishedWork) { return true; } -function markRootSuspended(root, suspendedLanes) { +function markRootSuspended(root, suspendedLanes, spawnedLane) { // When suspending, we should always exclude lanes that were pinged or (more // rarely, since we try to avoid it) updated during the render phase. // TODO: Lol maybe there's a better way to factor this besides this @@ -30054,7 +30128,7 @@ function markRootSuspended(root, suspendedLanes) { suspendedLanes, workInProgressRootInterleavedUpdatedLanes ); - markRootSuspended$1(root, suspendedLanes); + markRootSuspended$1(root, suspendedLanes, spawnedLane); } // This is the entry point for synchronous tasks that don't go // through Scheduler @@ -30106,7 +30180,7 @@ function performSyncWorkOnRoot(root, lanes) { if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); throw fatalError; } @@ -30115,7 +30189,7 @@ function performSyncWorkOnRoot(root, lanes) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); return null; } // We now have a consistent tree. Because this is a sync render, we @@ -30127,7 +30201,8 @@ function performSyncWorkOnRoot(root, lanes) { commitRoot( root, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane ); // Before exiting, make sure there's a callback scheduled for the next // pending level. @@ -30289,6 +30364,7 @@ function prepareFreshStack(root, lanes) { workInProgressRootSkippedLanes = NoLanes; workInProgressRootInterleavedUpdatedLanes = NoLanes; workInProgressRootPingedLanes = NoLanes; + workInProgressDeferredLane = NoLane; workInProgressRootConcurrentErrors = null; workInProgressRootRecoverableErrors = null; // Get the lanes that are entangled with whatever we're about to render. We // track these separately so we can distinguish the priority of the render @@ -30531,9 +30607,9 @@ function renderDidSuspendDelayIfPossible() { // this render. if ( - workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || - includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) + includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) && + workInProgressRoot !== null ) { // Mark the current render as suspended so that we switch to working on // the updates that were skipped. Usually we only suspend at the end of @@ -30544,8 +30620,11 @@ function renderDidSuspendDelayIfPossible() { // pinged or updated while we were rendering. // TODO: Consider unwinding immediately, using the // SuspendedOnHydration mechanism. - // $FlowFixMe[incompatible-call] need null check workInProgressRoot - markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes); + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } } function renderDidError(error) { @@ -31319,7 +31398,7 @@ function unwindUnitOfWork(unitOfWork) { workInProgress = null; } -function commitRoot(root, recoverableErrors, transitions) { +function commitRoot(root, recoverableErrors, transitions, spawnedLane) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. var previousUpdateLanePriority = getCurrentUpdatePriority(); @@ -31332,7 +31411,8 @@ function commitRoot(root, recoverableErrors, transitions) { root, recoverableErrors, transitions, - previousUpdateLanePriority + previousUpdateLanePriority, + spawnedLane ); } finally { ReactCurrentBatchConfig$1.transition = prevTransition; @@ -31346,7 +31426,8 @@ function commitRootImpl( root, recoverableErrors, transitions, - renderPriorityLevel + renderPriorityLevel, + spawnedLane ) { do { // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which @@ -31421,7 +31502,7 @@ function commitRootImpl( var concurrentlyUpdatedLanes = getConcurrentlyUpdatedLanes(); remainingLanes = mergeLanes(remainingLanes, concurrentlyUpdatedLanes); - markRootFinished(root, remainingLanes); + markRootFinished(root, remainingLanes, spawnedLane); if (root === workInProgressRoot) { // We can reset these now that they are finished. @@ -33916,7 +33997,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-a17326c6"; +var ReactVersion = "18.3.0-www-modern-01dd8496"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOM-prod.classic.js b/compiled/facebook-www/ReactDOM-prod.classic.js index 8299331a26..cbf823870c 100644 --- a/compiled/facebook-www/ReactDOM-prod.classic.js +++ b/compiled/facebook-www/ReactDOM-prod.classic.js @@ -434,7 +434,7 @@ function clz32Fallback(x) { } var SyncUpdateLanes = enableUnifiedSyncLane ? 42 : 2, nextTransitionLane = 128, - nextRetryLane = 8388608; + nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { if (enableUnifiedSyncLane) { var pendingSyncLanes = lanes & SyncUpdateLanes; @@ -470,13 +470,14 @@ function getHighestPriorityLanes(lanes) { case 524288: case 1048576: case 2097152: + return lanes & 4194176; case 4194304: - return lanes & 8388480; case 8388608: case 16777216: case 33554432: + return lanes & 62914560; case 67108864: - return lanes & 125829120; + return 67108864; case 134217728: return 134217728; case 268435456: @@ -484,7 +485,7 @@ function getHighestPriorityLanes(lanes) { case 536870912: return 536870912; case 1073741824: - return 1073741824; + return 0; default: return lanes; } @@ -495,7 +496,7 @@ function getNextLanes(root, wipLanes) { var nextLanes = 0, suspendedLanes = root.suspendedLanes; root = root.pingedLanes; - var nonIdlePendingLanes = pendingLanes & 268435455; + var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes @@ -514,7 +515,7 @@ function getNextLanes(root, wipLanes) { ((suspendedLanes = nextLanes & -nextLanes), (root = wipLanes & -wipLanes), suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 8388480))) + (32 === suspendedLanes && 0 !== (root & 4194176))) ? wipLanes : nextLanes; } @@ -543,13 +544,13 @@ function computeExpirationTime(lane, currentTime) { case 524288: case 1048576: case 2097152: - case 4194304: return currentTime + 5e3; + case 4194304: case 8388608: case 16777216: case 33554432: - case 67108864: return -1; + case 67108864: case 134217728: case 268435456: case 536870912: @@ -561,22 +562,16 @@ function computeExpirationTime(lane, currentTime) { } function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) return 0; - root = root.pendingLanes & -1073741825; - return 0 !== root ? root : root & 1073741824 ? 1073741824 : 0; + root = root.pendingLanes & -536870913; + return 0 !== root ? root : root & 536870912 ? 536870912 : 0; } function includesBlockingLane(root, lanes) { return 0 !== (root.current.mode & 32) ? !1 : 0 !== (lanes & 60); } -function claimNextTransitionLane() { - var lane = nextTransitionLane; - nextTransitionLane <<= 1; - 0 === (nextTransitionLane & 8388480) && (nextTransitionLane = 128); - return lane; -} function claimNextRetryLane() { var lane = nextRetryLane; nextRetryLane <<= 1; - 0 === (nextRetryLane & 125829120) && (nextRetryLane = 8388608); + 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304); return lane; } function createLaneMap(initial) { @@ -585,10 +580,10 @@ function createLaneMap(initial) { } function markRootUpdated(root, updateLane) { root.pendingLanes |= updateLane; - 536870912 !== updateLane && + 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0)); } -function markRootFinished(root, remainingLanes) { +function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; @@ -598,24 +593,37 @@ function markRootFinished(root, remainingLanes) { root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; remainingLanes = root.entanglements; - var expirationTimes = root.expirationTimes; - for (root = root.hiddenUpdates; 0 < noLongerPendingLanes; ) { + for ( + var expirationTimes = root.expirationTimes, + hiddenUpdates = root.hiddenUpdates; + 0 < noLongerPendingLanes; + + ) { var index$4 = 31 - clz32(noLongerPendingLanes), lane = 1 << index$4; remainingLanes[index$4] = 0; expirationTimes[index$4] = -1; - var hiddenUpdatesForLane = root[index$4]; + var hiddenUpdatesForLane = hiddenUpdates[index$4]; if (null !== hiddenUpdatesForLane) for ( - root[index$4] = null, index$4 = 0; + hiddenUpdates[index$4] = null, index$4 = 0; index$4 < hiddenUpdatesForLane.length; index$4++ ) { var update = hiddenUpdatesForLane[index$4]; - null !== update && (update.lane &= -1073741825); + null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; } + 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); +} +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; + var spawnedLaneIndex = 31 - clz32(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] = + root.entanglements[spawnedLaneIndex] | 1073741824 | entangledLanes; } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); @@ -672,9 +680,9 @@ function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes ? 8 < lanes - ? 0 !== (lanes & 268435455) + ? 0 !== (lanes & 134217727) ? 32 - : 536870912 + : 268435456 : 8 : 2; } @@ -1638,7 +1646,7 @@ function tryHydrateSuspense(fiber, nextInstance) { (fiber.memoizedState = { dehydrated: nextInstance, treeContext: instance, - retryLane: 1073741824 + retryLane: 536870912 }), (instance = createFiber(18, null, null, 0)), (instance.stateNode = nextInstance), @@ -1797,7 +1805,7 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { null === sourceFiber ? (parent[isHidden] = [update]) : sourceFiber.push(update), - (update.lane = lane | 1073741824)); + (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { if (50 < nestedUpdateCount) @@ -1853,7 +1861,7 @@ function enqueueUpdate(fiber, update, lane) { } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 4194176))) { var queueLanes = fiber.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -1941,7 +1949,7 @@ function processUpdateQueue( current = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { - var updateLane = pendingQueue.lane & -1073741825, + var updateLane = pendingQueue.lane & -536870913, isHiddenUpdate = updateLane !== pendingQueue.lane; if ( isHiddenUpdate @@ -3044,7 +3052,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { prepareFreshStack(workInProgressRootRenderLanes$50, 0), markRootSuspended( workInProgressRootRenderLanes$50, - nextLanes + nextLanes, + 0 ), ensureRootIsScheduled(workInProgressRootRenderLanes$50), originallyAttemptedLanes) @@ -3052,7 +3061,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { 6 === exitStatus ? markRootSuspended( workInProgressRootRenderLanes$50, - nextLanes + nextLanes, + 0 ) : ((workInProgressRootRenderLanes$50.finishedWork = workInProgressRootRenderLanes$50.current.alternate), @@ -3061,7 +3071,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { commitRoot( workInProgressRootRenderLanes$50, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane )); } ensureRootIsScheduled(workInProgressRootRenderLanes$50); @@ -3123,7 +3134,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { var suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, - lanes = root.pendingLanes & -125829121; + lanes = root.pendingLanes & -62914561; 0 < lanes; ) { @@ -3177,7 +3188,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { case 32: suspendedLanes = NormalPriority$1; break; - case 536870912: + case 268435456: suspendedLanes = IdlePriority; break; default: @@ -3197,8 +3208,12 @@ function scheduleImmediateTask(cb) { }); } function requestTransitionLane() { - 0 === currentEventTransitionLane && - (currentEventTransitionLane = claimNextTransitionLane()); + if (0 === currentEventTransitionLane) { + var lane = nextTransitionLane; + nextTransitionLane <<= 1; + 0 === (nextTransitionLane & 4194176) && (nextTransitionLane = 128); + currentEventTransitionLane = lane; + } return currentEventTransitionLane; } var currentEntangledListeners = null, @@ -3527,7 +3542,7 @@ function updateReducerImpl(hook, current, reducer) { newBaseQueueLast = null, update = current; do { - var updateLane = update.lane & -1073741825; + var updateLane = update.lane & -536870913; if ( updateLane !== update.lane ? (workInProgressRootRenderLanes & updateLane) === updateLane @@ -3871,9 +3886,11 @@ function updateMemo(nextCreate, deps) { return nextCreate; } function mountDeferredValueImpl(hook, value, initialValue) { - return enableUseDeferredValueInitialArg && void 0 !== initialValue + return enableUseDeferredValueInitialArg && + void 0 !== initialValue && + 0 === (renderLanes & 1073741824) ? ((hook.memoizedState = initialValue), - (value = claimNextTransitionLane()), + (value = requestDeferredLane()), (currentlyRenderingFiber$1.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0), @@ -3887,7 +3904,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { (hook.memoizedState = value) ); objectIs(value, prevValue) || - ((value = claimNextTransitionLane()), + ((value = requestDeferredLane()), (currentlyRenderingFiber$1.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); @@ -4071,7 +4088,7 @@ function enqueueRenderPhaseUpdate(queue, update) { queue.pending = update; } function entangleTransitionUpdate(root, queue, lane) { - if (0 !== (lane & 8388480)) { + if (0 !== (lane & 4194176)) { var queueLanes = queue.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -5071,7 +5088,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) { null !== current && pushTransition(workInProgress, null, null), reuseHiddenContextOnStack(), pushOffscreenSuspenseHandler(workInProgress); - else if (0 !== (renderLanes & 1073741824)) + else if (0 !== (renderLanes & 536870912)) (workInProgress.memoizedState = { baseLanes: 0, cachePool: null }), null !== current && pushTransition( @@ -5085,7 +5102,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) { pushOffscreenSuspenseHandler(workInProgress); else return ( - (workInProgress.lanes = workInProgress.childLanes = 1073741824), + (workInProgress.lanes = workInProgress.childLanes = 536870912), deferHiddenOffscreenComponent( current, workInProgress, @@ -5528,7 +5545,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? (workInProgress.lanes = 2) : "$!" === current.data ? (workInProgress.lanes = 16) - : (workInProgress.lanes = 1073741824), + : (workInProgress.lanes = 536870912), null ); popSuspenseHandler(workInProgress); @@ -5578,7 +5595,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.child.memoizedState = mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress.lanes = 8388608), + (workInProgress.lanes = 4194304), current ); pushPrimaryTreeSuspenseHandler(workInProgress); @@ -5869,11 +5886,10 @@ function updateDehydratedSuspenseComponent( case 8388608: case 16777216: case 33554432: - case 67108864: digest = 64; break; - case 536870912: - digest = 268435456; + case 268435456: + digest = 134217728; break; default: digest = 0; @@ -6644,7 +6660,7 @@ function scheduleRetryEffect(workInProgress, retryQueue) { ? (workInProgress.flags |= 4) : workInProgress.flags & 16384 && ((retryQueue = - 22 !== workInProgress.tag ? claimNextRetryLane() : 1073741824), + 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), (workInProgress.lanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { @@ -7111,7 +7127,7 @@ function completeWork(current, workInProgress, renderLanes) { ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(currentResource, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); } else { if (!newProps) @@ -7132,11 +7148,11 @@ function completeWork(current, workInProgress, renderLanes) { } else 2 * now() - currentResource.renderingStartTime > workInProgressRootRenderTargetTime && - 1073741824 !== renderLanes && + 536870912 !== renderLanes && ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(currentResource, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); currentResource.isBackwards ? ((cache$120.sibling = workInProgress.child), (workInProgress.child = cache$120)) @@ -7189,7 +7205,7 @@ function completeWork(current, workInProgress, renderLanes) { (workInProgress.flags |= 8192) : newProps && (workInProgress.flags |= 8192)), newProps && 0 !== (workInProgress.mode & 1) - ? 0 !== (renderLanes & 1073741824) && + ? 0 !== (renderLanes & 536870912) && 0 === (workInProgress.flags & 128) && (bubbleProperties(workInProgress), 23 !== workInProgress.tag && @@ -9744,6 +9760,7 @@ var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, workInProgressRootPingedLanes = 0, + workInProgressDeferredLane = 0, workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, globalMostRecentFallbackTime = 0, @@ -9837,13 +9854,25 @@ function requestUpdateLane(fiber) { fiber = void 0 === fiber ? 32 : getEventPriority(fiber.type); return fiber; } +function requestDeferredLane() { + 0 === workInProgressDeferredLane && + (workInProgressDeferredLane = + 0 !== (workInProgressRootRenderLanes & 536870912) + ? 536870912 + : requestTransitionLane()); + return workInProgressDeferredLane; +} function scheduleUpdateOnFiber(root, fiber, lane) { if ( (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || null !== root.cancelPendingCommit ) prepareFreshStack(root, 0), - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); markRootUpdated(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) { if (enableTransitionTracing) { @@ -9866,7 +9895,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { (0 === (executionContext & 2) && (workInProgressRootInterleavedUpdatedLanes |= lane), 4 === workInProgressRootExitStatus && - markRootSuspended(root, workInProgressRootRenderLanes)); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + )); ensureRootIsScheduled(root); 2 === lane && 0 === executionContext && @@ -9894,7 +9927,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (0 !== exitStatus) { var renderWasConcurrent = didTimeout; do { - if (6 === exitStatus) markRootSuspended(root, lanes); + if (6 === exitStatus) markRootSuspended(root, lanes, 0); else { didTimeout = root.current.alternate; if ( @@ -9923,7 +9956,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { throw ( ((originalCallbackNode = workInProgressRootFatalError), prepareFreshStack(root, 0), - markRootSuspended(root, lanes), + markRootSuspended(root, lanes, 0), ensureRootIsScheduled(root), originalCallbackNode) ); @@ -9936,8 +9969,12 @@ function performConcurrentWorkOnRoot(root, didTimeout) { case 1: throw Error(formatProdErrorMessage(345)); case 4: - if ((lanes & 8388480) === lanes) { - markRootSuspended(renderWasConcurrent, lanes); + if ((lanes & 4194176) === lanes) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); break a; } break; @@ -9949,12 +9986,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { throw Error(formatProdErrorMessage(329)); } if ( - (lanes & 125829120) === lanes && + (lanes & 62914560) === lanes && (alwaysThrottleRetries || 3 === exitStatus) && ((exitStatus = globalMostRecentFallbackTime + 300 - now()), 10 < exitStatus) ) { - markRootSuspended(renderWasConcurrent, lanes); + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; renderWasConcurrent.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( @@ -9963,7 +10004,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ), exitStatus ); @@ -9974,7 +10016,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ); } } @@ -10024,7 +10067,8 @@ function commitRootWhenReady( finishedWork, recoverableErrors, transitions, - lanes + lanes, + spawnedLane ) { if ( 0 === (lanes & 42) && @@ -10036,10 +10080,10 @@ function commitRootWhenReady( root.cancelPendingCommit = finishedWork( commitRoot.bind(null, root, recoverableErrors, transitions) ); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, spawnedLane); return; } - commitRoot(root, recoverableErrors, transitions); + commitRoot(root, recoverableErrors, transitions, spawnedLane); } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { @@ -10075,17 +10119,23 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootSuspended(root, suspendedLanes) { +function markRootSuspended(root, suspendedLanes, spawnedLane) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for (root = root.expirationTimes; 0 < suspendedLanes; ) { - var index$3 = 31 - clz32(suspendedLanes), + for ( + var expirationTimes = root.expirationTimes, lanes = suspendedLanes; + 0 < lanes; + + ) { + var index$3 = 31 - clz32(lanes), lane = 1 << index$3; - root[index$3] = -1; - suspendedLanes &= ~lane; + expirationTimes[index$3] = -1; + lanes &= ~lane; } + 0 !== spawnedLane && + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } function batchedUpdates$1(fn, a) { var prevExecutionContext = executionContext; @@ -10157,7 +10207,8 @@ function prepareFreshStack(root, lanes) { workInProgressRootDidAttachPingListener = !1; workInProgressRootExitStatus = 0; workInProgressRootFatalError = null; - workInProgressRootPingedLanes = + workInProgressDeferredLane = + workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; @@ -10188,8 +10239,8 @@ function handleThrow(root, thrownValue) { ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = shouldRemainOnPreviousScreen() && - 0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455) + 0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) ? 2 : 3)) : thrownValue === SuspenseyCommitException @@ -10212,14 +10263,14 @@ function shouldRemainOnPreviousScreen() { var handler = suspenseHandlerStackCursor.current; return null === handler ? !0 - : (workInProgressRootRenderLanes & 8388480) === + : (workInProgressRootRenderLanes & 4194176) === workInProgressRootRenderLanes ? null === shellBoundary ? !0 : !1 - : (workInProgressRootRenderLanes & 125829120) === + : (workInProgressRootRenderLanes & 62914560) === workInProgressRootRenderLanes || - 0 !== (workInProgressRootRenderLanes & 1073741824) + 0 !== (workInProgressRootRenderLanes & 536870912) ? handler === shellBoundary : !1; } @@ -10235,10 +10286,14 @@ function pushCacheDispatcher() { } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = 4; - null === workInProgressRoot || - (0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455)) || - markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes); + (0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || + null === workInProgressRoot || + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } function renderRootSync(root, lanes) { var prevExecutionContext = executionContext; @@ -10524,7 +10579,7 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } -function commitRoot(root, recoverableErrors, transitions) { +function commitRoot(root, recoverableErrors, transitions, spawnedLane) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig$1.transition; try { @@ -10534,7 +10589,8 @@ function commitRoot(root, recoverableErrors, transitions) { root, recoverableErrors, transitions, - previousUpdateLanePriority + previousUpdateLanePriority, + spawnedLane ); } finally { (ReactCurrentBatchConfig$1.transition = prevTransition), @@ -10546,7 +10602,8 @@ function commitRootImpl( root, recoverableErrors, transitions, - renderPriorityLevel + renderPriorityLevel, + spawnedLane ) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); @@ -10562,7 +10619,7 @@ function commitRootImpl( root.cancelPendingCommit = null; var remainingLanes = finishedWork.lanes | finishedWork.childLanes; remainingLanes |= concurrentlyUpdatedLanes; - markRootFinished(root, remainingLanes); + markRootFinished(root, remainingLanes, spawnedLane); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -10580,7 +10637,7 @@ function commitRootImpl( if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { transitions = ReactCurrentBatchConfig$1.transition; ReactCurrentBatchConfig$1.transition = null; - var previousPriority = currentUpdatePriority; + spawnedLane = currentUpdatePriority; currentUpdatePriority = 2; var prevExecutionContext = executionContext; executionContext |= 4; @@ -10601,7 +10658,7 @@ function commitRootImpl( commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); requestPaint(); executionContext = prevExecutionContext; - currentUpdatePriority = previousPriority; + currentUpdatePriority = spawnedLane; ReactCurrentBatchConfig$1.transition = transitions; } else root.current = finishedWork; rootDoesHavePassiveEffects @@ -10636,7 +10693,7 @@ function commitRootImpl( 0 !== root.tag && flushPassiveEffects(); remainingLanes = root.pendingLanes; - 0 !== (lanes & 8388522) && 0 !== (remainingLanes & SyncUpdateLanes) + 0 !== (lanes & 4194218) && 0 !== (remainingLanes & SyncUpdateLanes) ? root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) @@ -10799,7 +10856,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 125829120) === + (workInProgressRootRenderLanes & 62914560) === workInProgressRootRenderLanes && 300 > now() - globalMostRecentFallbackTime) ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) @@ -11989,9 +12046,9 @@ function markRetryLaneIfNotHydrated(fiber, retryLane) { } function attemptContinuousHydration(fiber) { if (13 === fiber.tag) { - var root = enqueueConcurrentRenderForLane(fiber, 134217728); - null !== root && scheduleUpdateOnFiber(root, fiber, 134217728); - markRetryLaneIfNotHydrated(fiber, 134217728); + var root = enqueueConcurrentRenderForLane(fiber, 67108864); + null !== root && scheduleUpdateOnFiber(root, fiber, 67108864); + markRetryLaneIfNotHydrated(fiber, 67108864); } } function emptyFindFiberByHostInstance() { @@ -12530,14 +12587,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$345; if (canUseDOM) { - 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; + var isSupported$jscomp$inline_1528 = "oninput" in document; + if (!isSupported$jscomp$inline_1528) { + var element$jscomp$inline_1529 = document.createElement("div"); + element$jscomp$inline_1529.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1528 = + "function" === typeof element$jscomp$inline_1529.oninput; } - JSCompiler_inline_result$jscomp$345 = isSupported$jscomp$inline_1525; + JSCompiler_inline_result$jscomp$345 = isSupported$jscomp$inline_1528; } else JSCompiler_inline_result$jscomp$345 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$345 && @@ -12849,20 +12906,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1566 = 0; - i$jscomp$inline_1566 < simpleEventPluginEvents.length; - i$jscomp$inline_1566++ + var i$jscomp$inline_1569 = 0; + i$jscomp$inline_1569 < simpleEventPluginEvents.length; + i$jscomp$inline_1569++ ) { - 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); + var eventName$jscomp$inline_1570 = + simpleEventPluginEvents[i$jscomp$inline_1569], + domEventName$jscomp$inline_1571 = + eventName$jscomp$inline_1570.toLowerCase(), + capitalizedEvent$jscomp$inline_1572 = + eventName$jscomp$inline_1570[0].toUpperCase() + + eventName$jscomp$inline_1570.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1568, - "on" + capitalizedEvent$jscomp$inline_1569 + domEventName$jscomp$inline_1571, + "on" + capitalizedEvent$jscomp$inline_1572 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16190,7 +16247,7 @@ function getEventPriority(domEventName) { case LowPriority: return 32; case IdlePriority: - return 536870912; + return 268435456; default: return 32; } @@ -16402,17 +16459,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1792 = { +var devToolsConfig$jscomp$inline_1795 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-72149e3a", + version: "18.3.0-www-classic-2b4fb6cd", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2138 = { - bundleType: devToolsConfig$jscomp$inline_1792.bundleType, - version: devToolsConfig$jscomp$inline_1792.version, - rendererPackageName: devToolsConfig$jscomp$inline_1792.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1792.rendererConfig, +var internals$jscomp$inline_2141 = { + bundleType: devToolsConfig$jscomp$inline_1795.bundleType, + version: devToolsConfig$jscomp$inline_1795.version, + rendererPackageName: devToolsConfig$jscomp$inline_1795.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1795.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16428,26 +16485,26 @@ var internals$jscomp$inline_2138 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1792.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1795.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-72149e3a" + reconcilerVersion: "18.3.0-www-classic-2b4fb6cd" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2139 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2142 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2139.isDisabled && - hook$jscomp$inline_2139.supportsFiber + !hook$jscomp$inline_2142.isDisabled && + hook$jscomp$inline_2142.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2139.inject( - internals$jscomp$inline_2138 + (rendererID = hook$jscomp$inline_2142.inject( + internals$jscomp$inline_2141 )), - (injectedHook = hook$jscomp$inline_2139); + (injectedHook = hook$jscomp$inline_2142); } catch (err) {} } assign(Internals, { @@ -16772,4 +16829,4 @@ exports.useFormState = function () { exports.useFormStatus = function () { throw Error(formatProdErrorMessage(248)); }; -exports.version = "18.3.0-www-classic-72149e3a"; +exports.version = "18.3.0-www-classic-2b4fb6cd"; diff --git a/compiled/facebook-www/ReactDOM-prod.modern.js b/compiled/facebook-www/ReactDOM-prod.modern.js index f9c6a46fbd..5870781630 100644 --- a/compiled/facebook-www/ReactDOM-prod.modern.js +++ b/compiled/facebook-www/ReactDOM-prod.modern.js @@ -196,7 +196,7 @@ function clz32Fallback(x) { } var SyncUpdateLanes = enableUnifiedSyncLane ? 42 : 2, nextTransitionLane = 128, - nextRetryLane = 8388608; + nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { if (enableUnifiedSyncLane) { var pendingSyncLanes = lanes & SyncUpdateLanes; @@ -232,13 +232,14 @@ function getHighestPriorityLanes(lanes) { case 524288: case 1048576: case 2097152: + return lanes & 4194176; case 4194304: - return lanes & 8388480; case 8388608: case 16777216: case 33554432: + return lanes & 62914560; case 67108864: - return lanes & 125829120; + return 67108864; case 134217728: return 134217728; case 268435456: @@ -246,7 +247,7 @@ function getHighestPriorityLanes(lanes) { case 536870912: return 536870912; case 1073741824: - return 1073741824; + return 0; default: return lanes; } @@ -257,7 +258,7 @@ function getNextLanes(root, wipLanes) { var nextLanes = 0, suspendedLanes = root.suspendedLanes; root = root.pingedLanes; - var nonIdlePendingLanes = pendingLanes & 268435455; + var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes @@ -276,7 +277,7 @@ function getNextLanes(root, wipLanes) { ((suspendedLanes = nextLanes & -nextLanes), (root = wipLanes & -wipLanes), suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 8388480))) + (32 === suspendedLanes && 0 !== (root & 4194176))) ? wipLanes : nextLanes; } @@ -305,13 +306,13 @@ function computeExpirationTime(lane, currentTime) { case 524288: case 1048576: case 2097152: - case 4194304: return currentTime + 5e3; + case 4194304: case 8388608: case 16777216: case 33554432: - case 67108864: return -1; + case 67108864: case 134217728: case 268435456: case 536870912: @@ -323,22 +324,16 @@ function computeExpirationTime(lane, currentTime) { } function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) return 0; - root = root.pendingLanes & -1073741825; - return 0 !== root ? root : root & 1073741824 ? 1073741824 : 0; + root = root.pendingLanes & -536870913; + return 0 !== root ? root : root & 536870912 ? 536870912 : 0; } function includesBlockingLane(root, lanes) { return 0 !== (root.current.mode & 32) ? !1 : 0 !== (lanes & 60); } -function claimNextTransitionLane() { - var lane = nextTransitionLane; - nextTransitionLane <<= 1; - 0 === (nextTransitionLane & 8388480) && (nextTransitionLane = 128); - return lane; -} function claimNextRetryLane() { var lane = nextRetryLane; nextRetryLane <<= 1; - 0 === (nextRetryLane & 125829120) && (nextRetryLane = 8388608); + 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304); return lane; } function createLaneMap(initial) { @@ -347,10 +342,10 @@ function createLaneMap(initial) { } function markRootUpdated(root, updateLane) { root.pendingLanes |= updateLane; - 536870912 !== updateLane && + 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0)); } -function markRootFinished(root, remainingLanes) { +function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; @@ -360,24 +355,37 @@ function markRootFinished(root, remainingLanes) { root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; remainingLanes = root.entanglements; - var expirationTimes = root.expirationTimes; - for (root = root.hiddenUpdates; 0 < noLongerPendingLanes; ) { + for ( + var expirationTimes = root.expirationTimes, + hiddenUpdates = root.hiddenUpdates; + 0 < noLongerPendingLanes; + + ) { var index$3 = 31 - clz32(noLongerPendingLanes), lane = 1 << index$3; remainingLanes[index$3] = 0; expirationTimes[index$3] = -1; - var hiddenUpdatesForLane = root[index$3]; + var hiddenUpdatesForLane = hiddenUpdates[index$3]; if (null !== hiddenUpdatesForLane) for ( - root[index$3] = null, index$3 = 0; + hiddenUpdates[index$3] = null, index$3 = 0; index$3 < hiddenUpdatesForLane.length; index$3++ ) { var update = hiddenUpdatesForLane[index$3]; - null !== update && (update.lane &= -1073741825); + null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; } + 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); +} +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; + var spawnedLaneIndex = 31 - clz32(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] = + root.entanglements[spawnedLaneIndex] | 1073741824 | entangledLanes; } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); @@ -434,9 +442,9 @@ function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes ? 8 < lanes - ? 0 !== (lanes & 268435455) + ? 0 !== (lanes & 134217727) ? 32 - : 536870912 + : 268435456 : 8 : 2; } @@ -1535,7 +1543,7 @@ function tryHydrateSuspense(fiber, nextInstance) { (fiber.memoizedState = { dehydrated: nextInstance, treeContext: instance, - retryLane: 1073741824 + retryLane: 536870912 }), (instance = createFiber(18, null, null, 0)), (instance.stateNode = nextInstance), @@ -1694,7 +1702,7 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { null === sourceFiber ? (parent[isHidden] = [update]) : sourceFiber.push(update), - (update.lane = lane | 1073741824)); + (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { if (50 < nestedUpdateCount) @@ -1750,7 +1758,7 @@ function enqueueUpdate(fiber, update, lane) { } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 4194176))) { var queueLanes = fiber.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -1838,7 +1846,7 @@ function processUpdateQueue( current = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { - var updateLane = pendingQueue.lane & -1073741825, + var updateLane = pendingQueue.lane & -536870913, isHiddenUpdate = updateLane !== pendingQueue.lane; if ( isHiddenUpdate @@ -2941,7 +2949,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { prepareFreshStack(workInProgressRootRenderLanes$50, 0), markRootSuspended( workInProgressRootRenderLanes$50, - nextLanes + nextLanes, + 0 ), ensureRootIsScheduled(workInProgressRootRenderLanes$50), originallyAttemptedLanes) @@ -2949,7 +2958,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { 6 === exitStatus ? markRootSuspended( workInProgressRootRenderLanes$50, - nextLanes + nextLanes, + 0 ) : ((workInProgressRootRenderLanes$50.finishedWork = workInProgressRootRenderLanes$50.current.alternate), @@ -2958,7 +2968,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { commitRoot( workInProgressRootRenderLanes$50, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane )); } ensureRootIsScheduled(workInProgressRootRenderLanes$50); @@ -3020,7 +3031,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { var suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, - lanes = root.pendingLanes & -125829121; + lanes = root.pendingLanes & -62914561; 0 < lanes; ) { @@ -3074,7 +3085,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { case 32: suspendedLanes = NormalPriority$1; break; - case 536870912: + case 268435456: suspendedLanes = IdlePriority; break; default: @@ -3094,8 +3105,12 @@ function scheduleImmediateTask(cb) { }); } function requestTransitionLane() { - 0 === currentEventTransitionLane && - (currentEventTransitionLane = claimNextTransitionLane()); + if (0 === currentEventTransitionLane) { + var lane = nextTransitionLane; + nextTransitionLane <<= 1; + 0 === (nextTransitionLane & 4194176) && (nextTransitionLane = 128); + currentEventTransitionLane = lane; + } return currentEventTransitionLane; } var currentEntangledListeners = null, @@ -3424,7 +3439,7 @@ function updateReducerImpl(hook, current, reducer) { newBaseQueueLast = null, update = current; do { - var updateLane = update.lane & -1073741825; + var updateLane = update.lane & -536870913; if ( updateLane !== update.lane ? (workInProgressRootRenderLanes & updateLane) === updateLane @@ -3768,9 +3783,11 @@ function updateMemo(nextCreate, deps) { return nextCreate; } function mountDeferredValueImpl(hook, value, initialValue) { - return enableUseDeferredValueInitialArg && void 0 !== initialValue + return enableUseDeferredValueInitialArg && + void 0 !== initialValue && + 0 === (renderLanes & 1073741824) ? ((hook.memoizedState = initialValue), - (value = claimNextTransitionLane()), + (value = requestDeferredLane()), (currentlyRenderingFiber$1.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0), @@ -3784,7 +3801,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { (hook.memoizedState = value) ); objectIs(value, prevValue) || - ((value = claimNextTransitionLane()), + ((value = requestDeferredLane()), (currentlyRenderingFiber$1.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); @@ -3968,7 +3985,7 @@ function enqueueRenderPhaseUpdate(queue, update) { queue.pending = update; } function entangleTransitionUpdate(root, queue, lane) { - if (0 !== (lane & 8388480)) { + if (0 !== (lane & 4194176)) { var queueLanes = queue.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -4953,7 +4970,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) { null !== current && pushTransition(workInProgress, null, null), reuseHiddenContextOnStack(), pushOffscreenSuspenseHandler(workInProgress); - else if (0 !== (renderLanes & 1073741824)) + else if (0 !== (renderLanes & 536870912)) (workInProgress.memoizedState = { baseLanes: 0, cachePool: null }), null !== current && pushTransition( @@ -4967,7 +4984,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) { pushOffscreenSuspenseHandler(workInProgress); else return ( - (workInProgress.lanes = workInProgress.childLanes = 1073741824), + (workInProgress.lanes = workInProgress.childLanes = 536870912), deferHiddenOffscreenComponent( current, workInProgress, @@ -5378,7 +5395,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? (workInProgress.lanes = 2) : "$!" === current.data ? (workInProgress.lanes = 16) - : (workInProgress.lanes = 1073741824), + : (workInProgress.lanes = 536870912), null ); popSuspenseHandler(workInProgress); @@ -5428,7 +5445,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.child.memoizedState = mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress.lanes = 8388608), + (workInProgress.lanes = 4194304), current ); pushPrimaryTreeSuspenseHandler(workInProgress); @@ -5719,11 +5736,10 @@ function updateDehydratedSuspenseComponent( case 8388608: case 16777216: case 33554432: - case 67108864: digest = 64; break; - case 536870912: - digest = 268435456; + case 268435456: + digest = 134217728; break; default: digest = 0; @@ -6490,7 +6506,7 @@ function scheduleRetryEffect(workInProgress, retryQueue) { ? (workInProgress.flags |= 4) : workInProgress.flags & 16384 && ((retryQueue = - 22 !== workInProgress.tag ? claimNextRetryLane() : 1073741824), + 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), (workInProgress.lanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { @@ -6947,7 +6963,7 @@ function completeWork(current, workInProgress, renderLanes) { ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(currentResource, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); } else { if (!newProps) @@ -6968,11 +6984,11 @@ function completeWork(current, workInProgress, renderLanes) { } else 2 * now() - currentResource.renderingStartTime > workInProgressRootRenderTargetTime && - 1073741824 !== renderLanes && + 536870912 !== renderLanes && ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(currentResource, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); currentResource.isBackwards ? ((cache$120.sibling = workInProgress.child), (workInProgress.child = cache$120)) @@ -7025,7 +7041,7 @@ function completeWork(current, workInProgress, renderLanes) { (workInProgress.flags |= 8192) : newProps && (workInProgress.flags |= 8192)), newProps && 0 !== (workInProgress.mode & 1) - ? 0 !== (renderLanes & 1073741824) && + ? 0 !== (renderLanes & 536870912) && 0 === (workInProgress.flags & 128) && (bubbleProperties(workInProgress), 23 !== workInProgress.tag && @@ -9584,6 +9600,7 @@ var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, workInProgressRootPingedLanes = 0, + workInProgressDeferredLane = 0, workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, globalMostRecentFallbackTime = 0, @@ -9677,13 +9694,25 @@ function requestUpdateLane(fiber) { fiber = void 0 === fiber ? 32 : getEventPriority(fiber.type); return fiber; } +function requestDeferredLane() { + 0 === workInProgressDeferredLane && + (workInProgressDeferredLane = + 0 !== (workInProgressRootRenderLanes & 536870912) + ? 536870912 + : requestTransitionLane()); + return workInProgressDeferredLane; +} function scheduleUpdateOnFiber(root, fiber, lane) { if ( (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || null !== root.cancelPendingCommit ) prepareFreshStack(root, 0), - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); markRootUpdated(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) { if (enableTransitionTracing) { @@ -9706,7 +9735,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { (0 === (executionContext & 2) && (workInProgressRootInterleavedUpdatedLanes |= lane), 4 === workInProgressRootExitStatus && - markRootSuspended(root, workInProgressRootRenderLanes)); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + )); ensureRootIsScheduled(root); 2 === lane && 0 === executionContext && @@ -9734,7 +9767,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (0 !== exitStatus) { var renderWasConcurrent = didTimeout; do { - if (6 === exitStatus) markRootSuspended(root, lanes); + if (6 === exitStatus) markRootSuspended(root, lanes, 0); else { didTimeout = root.current.alternate; if ( @@ -9763,7 +9796,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { throw ( ((originalCallbackNode = workInProgressRootFatalError), prepareFreshStack(root, 0), - markRootSuspended(root, lanes), + markRootSuspended(root, lanes, 0), ensureRootIsScheduled(root), originalCallbackNode) ); @@ -9776,8 +9809,12 @@ function performConcurrentWorkOnRoot(root, didTimeout) { case 1: throw Error(formatProdErrorMessage(345)); case 4: - if ((lanes & 8388480) === lanes) { - markRootSuspended(renderWasConcurrent, lanes); + if ((lanes & 4194176) === lanes) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); break a; } break; @@ -9789,12 +9826,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { throw Error(formatProdErrorMessage(329)); } if ( - (lanes & 125829120) === lanes && + (lanes & 62914560) === lanes && (alwaysThrottleRetries || 3 === exitStatus) && ((exitStatus = globalMostRecentFallbackTime + 300 - now()), 10 < exitStatus) ) { - markRootSuspended(renderWasConcurrent, lanes); + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; renderWasConcurrent.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( @@ -9803,7 +9844,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ), exitStatus ); @@ -9814,7 +9856,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ); } } @@ -9864,7 +9907,8 @@ function commitRootWhenReady( finishedWork, recoverableErrors, transitions, - lanes + lanes, + spawnedLane ) { if ( 0 === (lanes & 42) && @@ -9876,10 +9920,10 @@ function commitRootWhenReady( root.cancelPendingCommit = finishedWork( commitRoot.bind(null, root, recoverableErrors, transitions) ); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, spawnedLane); return; } - commitRoot(root, recoverableErrors, transitions); + commitRoot(root, recoverableErrors, transitions, spawnedLane); } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { @@ -9915,17 +9959,23 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootSuspended(root, suspendedLanes) { +function markRootSuspended(root, suspendedLanes, spawnedLane) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for (root = root.expirationTimes; 0 < suspendedLanes; ) { - var index$2 = 31 - clz32(suspendedLanes), + for ( + var expirationTimes = root.expirationTimes, lanes = suspendedLanes; + 0 < lanes; + + ) { + var index$2 = 31 - clz32(lanes), lane = 1 << index$2; - root[index$2] = -1; - suspendedLanes &= ~lane; + expirationTimes[index$2] = -1; + lanes &= ~lane; } + 0 !== spawnedLane && + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } function batchedUpdates$1(fn, a) { var prevExecutionContext = executionContext; @@ -9997,7 +10047,8 @@ function prepareFreshStack(root, lanes) { workInProgressRootDidAttachPingListener = !1; workInProgressRootExitStatus = 0; workInProgressRootFatalError = null; - workInProgressRootPingedLanes = + workInProgressDeferredLane = + workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; @@ -10028,8 +10079,8 @@ function handleThrow(root, thrownValue) { ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = shouldRemainOnPreviousScreen() && - 0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455) + 0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) ? 2 : 3)) : thrownValue === SuspenseyCommitException @@ -10052,14 +10103,14 @@ function shouldRemainOnPreviousScreen() { var handler = suspenseHandlerStackCursor.current; return null === handler ? !0 - : (workInProgressRootRenderLanes & 8388480) === + : (workInProgressRootRenderLanes & 4194176) === workInProgressRootRenderLanes ? null === shellBoundary ? !0 : !1 - : (workInProgressRootRenderLanes & 125829120) === + : (workInProgressRootRenderLanes & 62914560) === workInProgressRootRenderLanes || - 0 !== (workInProgressRootRenderLanes & 1073741824) + 0 !== (workInProgressRootRenderLanes & 536870912) ? handler === shellBoundary : !1; } @@ -10075,10 +10126,14 @@ function pushCacheDispatcher() { } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = 4; - null === workInProgressRoot || - (0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455)) || - markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes); + (0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || + null === workInProgressRoot || + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } function renderRootSync(root, lanes) { var prevExecutionContext = executionContext; @@ -10360,7 +10415,7 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } -function commitRoot(root, recoverableErrors, transitions) { +function commitRoot(root, recoverableErrors, transitions, spawnedLane) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig$1.transition; try { @@ -10370,7 +10425,8 @@ function commitRoot(root, recoverableErrors, transitions) { root, recoverableErrors, transitions, - previousUpdateLanePriority + previousUpdateLanePriority, + spawnedLane ); } finally { (ReactCurrentBatchConfig$1.transition = prevTransition), @@ -10382,7 +10438,8 @@ function commitRootImpl( root, recoverableErrors, transitions, - renderPriorityLevel + renderPriorityLevel, + spawnedLane ) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); @@ -10398,7 +10455,7 @@ function commitRootImpl( root.cancelPendingCommit = null; var remainingLanes = finishedWork.lanes | finishedWork.childLanes; remainingLanes |= concurrentlyUpdatedLanes; - markRootFinished(root, remainingLanes); + markRootFinished(root, remainingLanes, spawnedLane); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -10416,7 +10473,7 @@ function commitRootImpl( if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { transitions = ReactCurrentBatchConfig$1.transition; ReactCurrentBatchConfig$1.transition = null; - var previousPriority = currentUpdatePriority; + spawnedLane = currentUpdatePriority; currentUpdatePriority = 2; var prevExecutionContext = executionContext; executionContext |= 4; @@ -10437,7 +10494,7 @@ function commitRootImpl( commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); requestPaint(); executionContext = prevExecutionContext; - currentUpdatePriority = previousPriority; + currentUpdatePriority = spawnedLane; ReactCurrentBatchConfig$1.transition = transitions; } else root.current = finishedWork; rootDoesHavePassiveEffects @@ -10472,7 +10529,7 @@ function commitRootImpl( 0 !== root.tag && flushPassiveEffects(); remainingLanes = root.pendingLanes; - 0 !== (lanes & 8388522) && 0 !== (remainingLanes & SyncUpdateLanes) + 0 !== (lanes & 4194218) && 0 !== (remainingLanes & SyncUpdateLanes) ? root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) @@ -10635,7 +10692,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 125829120) === + (workInProgressRootRenderLanes & 62914560) === workInProgressRootRenderLanes && 300 > now() - globalMostRecentFallbackTime) ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) @@ -11709,9 +11766,9 @@ function markRetryLaneIfNotHydrated(fiber, retryLane) { } function attemptContinuousHydration(fiber) { if (13 === fiber.tag) { - var root = enqueueConcurrentRenderForLane(fiber, 134217728); - null !== root && scheduleUpdateOnFiber(root, fiber, 134217728); - markRetryLaneIfNotHydrated(fiber, 134217728); + var root = enqueueConcurrentRenderForLane(fiber, 67108864); + null !== root && scheduleUpdateOnFiber(root, fiber, 67108864); + markRetryLaneIfNotHydrated(fiber, 67108864); } } function emptyFindFiberByHostInstance() { @@ -12571,7 +12628,7 @@ function getEventPriority(domEventName) { case LowPriority: return 32; case IdlePriority: - return 536870912; + return 268435456; default: return 32; } @@ -12774,14 +12831,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$343; if (canUseDOM) { - var isSupported$jscomp$inline_1524 = "oninput" in document; - if (!isSupported$jscomp$inline_1524) { - var element$jscomp$inline_1525 = document.createElement("div"); - element$jscomp$inline_1525.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1524 = - "function" === typeof element$jscomp$inline_1525.oninput; + var isSupported$jscomp$inline_1527 = "oninput" in document; + if (!isSupported$jscomp$inline_1527) { + var element$jscomp$inline_1528 = document.createElement("div"); + element$jscomp$inline_1528.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1527 = + "function" === typeof element$jscomp$inline_1528.oninput; } - JSCompiler_inline_result$jscomp$343 = isSupported$jscomp$inline_1524; + JSCompiler_inline_result$jscomp$343 = isSupported$jscomp$inline_1527; } else JSCompiler_inline_result$jscomp$343 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$343 && @@ -13093,20 +13150,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1565 = 0; - i$jscomp$inline_1565 < simpleEventPluginEvents.length; - i$jscomp$inline_1565++ + var i$jscomp$inline_1568 = 0; + i$jscomp$inline_1568 < simpleEventPluginEvents.length; + i$jscomp$inline_1568++ ) { - var eventName$jscomp$inline_1566 = - simpleEventPluginEvents[i$jscomp$inline_1565], - domEventName$jscomp$inline_1567 = - eventName$jscomp$inline_1566.toLowerCase(), - capitalizedEvent$jscomp$inline_1568 = - eventName$jscomp$inline_1566[0].toUpperCase() + - eventName$jscomp$inline_1566.slice(1); + var eventName$jscomp$inline_1569 = + simpleEventPluginEvents[i$jscomp$inline_1568], + domEventName$jscomp$inline_1570 = + eventName$jscomp$inline_1569.toLowerCase(), + capitalizedEvent$jscomp$inline_1571 = + eventName$jscomp$inline_1569[0].toUpperCase() + + eventName$jscomp$inline_1569.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1567, - "on" + capitalizedEvent$jscomp$inline_1568 + domEventName$jscomp$inline_1570, + "on" + capitalizedEvent$jscomp$inline_1571 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -15928,17 +15985,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1751 = { +var devToolsConfig$jscomp$inline_1754 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-3590d8da", + version: "18.3.0-www-modern-f680b500", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2102 = { - bundleType: devToolsConfig$jscomp$inline_1751.bundleType, - version: devToolsConfig$jscomp$inline_1751.version, - rendererPackageName: devToolsConfig$jscomp$inline_1751.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1751.rendererConfig, +var internals$jscomp$inline_2105 = { + bundleType: devToolsConfig$jscomp$inline_1754.bundleType, + version: devToolsConfig$jscomp$inline_1754.version, + rendererPackageName: devToolsConfig$jscomp$inline_1754.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1754.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -15955,26 +16012,26 @@ var internals$jscomp$inline_2102 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1751.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1754.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-3590d8da" + reconcilerVersion: "18.3.0-www-modern-f680b500" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2103 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2106 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2103.isDisabled && - hook$jscomp$inline_2103.supportsFiber + !hook$jscomp$inline_2106.isDisabled && + hook$jscomp$inline_2106.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2103.inject( - internals$jscomp$inline_2102 + (rendererID = hook$jscomp$inline_2106.inject( + internals$jscomp$inline_2105 )), - (injectedHook = hook$jscomp$inline_2103); + (injectedHook = hook$jscomp$inline_2106); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; @@ -16227,4 +16284,4 @@ exports.useFormState = function () { exports.useFormStatus = function () { throw Error(formatProdErrorMessage(248)); }; -exports.version = "18.3.0-www-modern-3590d8da"; +exports.version = "18.3.0-www-modern-f680b500"; diff --git a/compiled/facebook-www/ReactDOM-profiling.classic.js b/compiled/facebook-www/ReactDOM-profiling.classic.js index 609605f545..33e4906cef 100644 --- a/compiled/facebook-www/ReactDOM-profiling.classic.js +++ b/compiled/facebook-www/ReactDOM-profiling.classic.js @@ -444,7 +444,7 @@ function onCommitRoot(root, eventPriority) { case 32: schedulerPriority = NormalPriority$1; break; - case 536870912: + case 268435456: schedulerPriority = IdlePriority; break; default: @@ -539,16 +539,17 @@ function getLabelForLane(lane) { if (lane & 16) return "DefaultHydration"; if (lane & 32) return "Default"; if (lane & 64) return "TransitionHydration"; - if (lane & 8388480) return "Transition"; - if (lane & 125829120) return "Retry"; - if (lane & 134217728) return "SelectiveHydration"; - if (lane & 268435456) return "IdleHydration"; - if (lane & 536870912) return "Idle"; - if (lane & 1073741824) return "Offscreen"; + if (lane & 4194176) return "Transition"; + if (lane & 62914560) return "Retry"; + if (lane & 67108864) return "SelectiveHydration"; + if (lane & 134217728) return "IdleHydration"; + if (lane & 268435456) return "Idle"; + if (lane & 536870912) return "Offscreen"; + if (lane & 1073741824) return "Deferred"; } } var nextTransitionLane = 128, - nextRetryLane = 8388608; + nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { if (enableUnifiedSyncLane) { var pendingSyncLanes = lanes & SyncUpdateLanes; @@ -584,13 +585,14 @@ function getHighestPriorityLanes(lanes) { case 524288: case 1048576: case 2097152: + return lanes & 4194176; case 4194304: - return lanes & 8388480; case 8388608: case 16777216: case 33554432: + return lanes & 62914560; case 67108864: - return lanes & 125829120; + return 67108864; case 134217728: return 134217728; case 268435456: @@ -598,7 +600,7 @@ function getHighestPriorityLanes(lanes) { case 536870912: return 536870912; case 1073741824: - return 1073741824; + return 0; default: return lanes; } @@ -609,7 +611,7 @@ function getNextLanes(root, wipLanes) { var nextLanes = 0, suspendedLanes = root.suspendedLanes; root = root.pingedLanes; - var nonIdlePendingLanes = pendingLanes & 268435455; + var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes @@ -628,7 +630,7 @@ function getNextLanes(root, wipLanes) { ((suspendedLanes = nextLanes & -nextLanes), (root = wipLanes & -wipLanes), suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 8388480))) + (32 === suspendedLanes && 0 !== (root & 4194176))) ? wipLanes : nextLanes; } @@ -657,13 +659,13 @@ function computeExpirationTime(lane, currentTime) { case 524288: case 1048576: case 2097152: - case 4194304: return currentTime + 5e3; + case 4194304: case 8388608: case 16777216: case 33554432: - case 67108864: return -1; + case 67108864: case 134217728: case 268435456: case 536870912: @@ -675,22 +677,16 @@ function computeExpirationTime(lane, currentTime) { } function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) return 0; - root = root.pendingLanes & -1073741825; - return 0 !== root ? root : root & 1073741824 ? 1073741824 : 0; + root = root.pendingLanes & -536870913; + return 0 !== root ? root : root & 536870912 ? 536870912 : 0; } function includesBlockingLane(root, lanes) { return 0 !== (root.current.mode & 32) ? !1 : 0 !== (lanes & 60); } -function claimNextTransitionLane() { - var lane = nextTransitionLane; - nextTransitionLane <<= 1; - 0 === (nextTransitionLane & 8388480) && (nextTransitionLane = 128); - return lane; -} function claimNextRetryLane() { var lane = nextRetryLane; nextRetryLane <<= 1; - 0 === (nextRetryLane & 125829120) && (nextRetryLane = 8388608); + 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304); return lane; } function createLaneMap(initial) { @@ -699,10 +695,10 @@ function createLaneMap(initial) { } function markRootUpdated(root, updateLane) { root.pendingLanes |= updateLane; - 536870912 !== updateLane && + 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0)); } -function markRootFinished(root, remainingLanes) { +function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; @@ -712,24 +708,37 @@ function markRootFinished(root, remainingLanes) { root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; remainingLanes = root.entanglements; - var expirationTimes = root.expirationTimes; - for (root = root.hiddenUpdates; 0 < noLongerPendingLanes; ) { + for ( + var expirationTimes = root.expirationTimes, + hiddenUpdates = root.hiddenUpdates; + 0 < noLongerPendingLanes; + + ) { var index$5 = 31 - clz32(noLongerPendingLanes), lane = 1 << index$5; remainingLanes[index$5] = 0; expirationTimes[index$5] = -1; - var hiddenUpdatesForLane = root[index$5]; + var hiddenUpdatesForLane = hiddenUpdates[index$5]; if (null !== hiddenUpdatesForLane) for ( - root[index$5] = null, index$5 = 0; + hiddenUpdates[index$5] = null, index$5 = 0; index$5 < hiddenUpdatesForLane.length; index$5++ ) { var update = hiddenUpdatesForLane[index$5]; - null !== update && (update.lane &= -1073741825); + null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; } + 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); +} +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; + var spawnedLaneIndex = 31 - clz32(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] = + root.entanglements[spawnedLaneIndex] | 1073741824 | entangledLanes; } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); @@ -816,9 +825,9 @@ function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes ? 8 < lanes - ? 0 !== (lanes & 268435455) + ? 0 !== (lanes & 134217727) ? 32 - : 536870912 + : 268435456 : 8 : 2; } @@ -1782,7 +1791,7 @@ function tryHydrateSuspense(fiber, nextInstance) { (fiber.memoizedState = { dehydrated: nextInstance, treeContext: instance, - retryLane: 1073741824 + retryLane: 536870912 }), (instance = createFiber(18, null, null, 0)), (instance.stateNode = nextInstance), @@ -1941,7 +1950,7 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { null === sourceFiber ? (parent[isHidden] = [update]) : sourceFiber.push(update), - (update.lane = lane | 1073741824)); + (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { if (50 < nestedUpdateCount) @@ -1997,7 +2006,7 @@ function enqueueUpdate(fiber, update, lane) { } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 4194176))) { var queueLanes = fiber.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -2085,7 +2094,7 @@ function processUpdateQueue( current = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { - var updateLane = pendingQueue.lane & -1073741825, + var updateLane = pendingQueue.lane & -536870913, isHiddenUpdate = updateLane !== pendingQueue.lane; if ( isHiddenUpdate @@ -3190,7 +3199,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { prepareFreshStack(workInProgressRootRenderLanes$53, 0), markRootSuspended( workInProgressRootRenderLanes$53, - nextLanes + nextLanes, + 0 ), ensureRootIsScheduled(workInProgressRootRenderLanes$53), originallyAttemptedLanes) @@ -3198,7 +3208,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { 6 === exitStatus ? markRootSuspended( workInProgressRootRenderLanes$53, - nextLanes + nextLanes, + 0 ) : ((workInProgressRootRenderLanes$53.finishedWork = workInProgressRootRenderLanes$53.current.alternate), @@ -3207,7 +3218,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { commitRoot( workInProgressRootRenderLanes$53, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane )); } ensureRootIsScheduled(workInProgressRootRenderLanes$53); @@ -3269,7 +3281,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { var suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, - lanes = root.pendingLanes & -125829121; + lanes = root.pendingLanes & -62914561; 0 < lanes; ) { @@ -3323,7 +3335,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { case 32: suspendedLanes = NormalPriority$1; break; - case 536870912: + case 268435456: suspendedLanes = IdlePriority; break; default: @@ -3343,8 +3355,12 @@ function scheduleImmediateTask(cb) { }); } function requestTransitionLane() { - 0 === currentEventTransitionLane && - (currentEventTransitionLane = claimNextTransitionLane()); + if (0 === currentEventTransitionLane) { + var lane = nextTransitionLane; + nextTransitionLane <<= 1; + 0 === (nextTransitionLane & 4194176) && (nextTransitionLane = 128); + currentEventTransitionLane = lane; + } return currentEventTransitionLane; } var currentEntangledListeners = null, @@ -3673,7 +3689,7 @@ function updateReducerImpl(hook, current, reducer) { newBaseQueueLast = null, update = current; do { - var updateLane = update.lane & -1073741825; + var updateLane = update.lane & -536870913; if ( updateLane !== update.lane ? (workInProgressRootRenderLanes & updateLane) === updateLane @@ -4017,9 +4033,11 @@ function updateMemo(nextCreate, deps) { return nextCreate; } function mountDeferredValueImpl(hook, value, initialValue) { - return enableUseDeferredValueInitialArg && void 0 !== initialValue + return enableUseDeferredValueInitialArg && + void 0 !== initialValue && + 0 === (renderLanes & 1073741824) ? ((hook.memoizedState = initialValue), - (value = claimNextTransitionLane()), + (value = requestDeferredLane()), (currentlyRenderingFiber$1.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0), @@ -4033,7 +4051,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { (hook.memoizedState = value) ); objectIs(value, prevValue) || - ((value = claimNextTransitionLane()), + ((value = requestDeferredLane()), (currentlyRenderingFiber$1.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); @@ -4220,7 +4238,7 @@ function enqueueRenderPhaseUpdate(queue, update) { queue.pending = update; } function entangleTransitionUpdate(root, queue, lane) { - if (0 !== (lane & 8388480)) { + if (0 !== (lane & 4194176)) { var queueLanes = queue.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -5292,7 +5310,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) { null !== current && pushTransition(workInProgress, null, null), reuseHiddenContextOnStack(), pushOffscreenSuspenseHandler(workInProgress); - else if (0 !== (renderLanes & 1073741824)) + else if (0 !== (renderLanes & 536870912)) (workInProgress.memoizedState = { baseLanes: 0, cachePool: null }), null !== current && pushTransition( @@ -5306,7 +5324,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) { pushOffscreenSuspenseHandler(workInProgress); else return ( - (workInProgress.lanes = workInProgress.childLanes = 1073741824), + (workInProgress.lanes = workInProgress.childLanes = 536870912), deferHiddenOffscreenComponent( current, workInProgress, @@ -5760,7 +5778,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? (workInProgress.lanes = 2) : "$!" === current.data ? (workInProgress.lanes = 16) - : (workInProgress.lanes = 1073741824), + : (workInProgress.lanes = 536870912), null ); popSuspenseHandler(workInProgress); @@ -5810,7 +5828,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.child.memoizedState = mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress.lanes = 8388608), + (workInProgress.lanes = 4194304), current ); pushPrimaryTreeSuspenseHandler(workInProgress); @@ -6111,11 +6129,10 @@ function updateDehydratedSuspenseComponent( case 8388608: case 16777216: case 33554432: - case 67108864: digest = 64; break; - case 536870912: - digest = 268435456; + case 268435456: + digest = 134217728; break; default: digest = 0; @@ -6894,7 +6911,7 @@ function scheduleRetryEffect(workInProgress, retryQueue) { ? (workInProgress.flags |= 4) : workInProgress.flags & 16384 && ((retryQueue = - 22 !== workInProgress.tag ? claimNextRetryLane() : 1073741824), + 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), (workInProgress.lanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { @@ -7420,7 +7437,7 @@ function completeWork(current, workInProgress, renderLanes) { ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(currentResource, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); } else { if (!newProps) @@ -7441,11 +7458,11 @@ function completeWork(current, workInProgress, renderLanes) { } else 2 * now$1() - currentResource.renderingStartTime > workInProgressRootRenderTargetTime && - 1073741824 !== renderLanes && + 536870912 !== renderLanes && ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(currentResource, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); currentResource.isBackwards ? ((cache$131.sibling = workInProgress.child), (workInProgress.child = cache$131)) @@ -7498,7 +7515,7 @@ function completeWork(current, workInProgress, renderLanes) { (workInProgress.flags |= 8192) : newProps && (workInProgress.flags |= 8192)), newProps && 0 !== (workInProgress.mode & 1) - ? 0 !== (renderLanes & 1073741824) && + ? 0 !== (renderLanes & 536870912) && 0 === (workInProgress.flags & 128) && (bubbleProperties(workInProgress), 23 !== workInProgress.tag && @@ -10336,6 +10353,7 @@ var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, workInProgressRootPingedLanes = 0, + workInProgressDeferredLane = 0, workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, globalMostRecentFallbackTime = 0, @@ -10431,13 +10449,25 @@ function requestUpdateLane(fiber) { fiber = void 0 === fiber ? 32 : getEventPriority(fiber.type); return fiber; } +function requestDeferredLane() { + 0 === workInProgressDeferredLane && + (workInProgressDeferredLane = + 0 !== (workInProgressRootRenderLanes & 536870912) + ? 536870912 + : requestTransitionLane()); + return workInProgressDeferredLane; +} function scheduleUpdateOnFiber(root, fiber, lane) { if ( (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || null !== root.cancelPendingCommit ) prepareFreshStack(root, 0), - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); markRootUpdated(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) { isDevToolsPresent && addFiberToLanesMap(root, fiber, lane); @@ -10476,7 +10506,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { (0 === (executionContext & 2) && (workInProgressRootInterleavedUpdatedLanes |= lane), 4 === workInProgressRootExitStatus && - markRootSuspended(root, workInProgressRootRenderLanes)); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + )); ensureRootIsScheduled(root); 2 === lane && 0 === executionContext && @@ -10505,7 +10539,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (0 !== exitStatus) { var renderWasConcurrent = didTimeout; do { - if (6 === exitStatus) markRootSuspended(root, lanes); + if (6 === exitStatus) markRootSuspended(root, lanes, 0); else { didTimeout = root.current.alternate; if ( @@ -10534,7 +10568,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { throw ( ((originalCallbackNode = workInProgressRootFatalError), prepareFreshStack(root, 0), - markRootSuspended(root, lanes), + markRootSuspended(root, lanes, 0), ensureRootIsScheduled(root), originalCallbackNode) ); @@ -10547,8 +10581,12 @@ function performConcurrentWorkOnRoot(root, didTimeout) { case 1: throw Error(formatProdErrorMessage(345)); case 4: - if ((lanes & 8388480) === lanes) { - markRootSuspended(renderWasConcurrent, lanes); + if ((lanes & 4194176) === lanes) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); break a; } break; @@ -10560,12 +10598,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { throw Error(formatProdErrorMessage(329)); } if ( - (lanes & 125829120) === lanes && + (lanes & 62914560) === lanes && (alwaysThrottleRetries || 3 === exitStatus) && ((exitStatus = globalMostRecentFallbackTime + 300 - now$1()), 10 < exitStatus) ) { - markRootSuspended(renderWasConcurrent, lanes); + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; renderWasConcurrent.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( @@ -10574,7 +10616,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ), exitStatus ); @@ -10585,7 +10628,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ); } } @@ -10635,7 +10679,8 @@ function commitRootWhenReady( finishedWork, recoverableErrors, transitions, - lanes + lanes, + spawnedLane ) { if ( 0 === (lanes & 42) && @@ -10647,10 +10692,10 @@ function commitRootWhenReady( root.cancelPendingCommit = finishedWork( commitRoot.bind(null, root, recoverableErrors, transitions) ); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, spawnedLane); return; } - commitRoot(root, recoverableErrors, transitions); + commitRoot(root, recoverableErrors, transitions, spawnedLane); } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { @@ -10686,17 +10731,23 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootSuspended(root, suspendedLanes) { +function markRootSuspended(root, suspendedLanes, spawnedLane) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for (root = root.expirationTimes; 0 < suspendedLanes; ) { - var index$4 = 31 - clz32(suspendedLanes), + for ( + var expirationTimes = root.expirationTimes, lanes = suspendedLanes; + 0 < lanes; + + ) { + var index$4 = 31 - clz32(lanes), lane = 1 << index$4; - root[index$4] = -1; - suspendedLanes &= ~lane; + expirationTimes[index$4] = -1; + lanes &= ~lane; } + 0 !== spawnedLane && + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } function batchedUpdates$1(fn, a) { var prevExecutionContext = executionContext; @@ -10768,7 +10819,8 @@ function prepareFreshStack(root, lanes) { workInProgressRootDidAttachPingListener = !1; workInProgressRootExitStatus = 0; workInProgressRootFatalError = null; - workInProgressRootPingedLanes = + workInProgressDeferredLane = + workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; @@ -10799,8 +10851,8 @@ function handleThrow(root, thrownValue) { ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = shouldRemainOnPreviousScreen() && - 0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455) + 0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) ? 2 : 3)) : thrownValue === SuspenseyCommitException @@ -10852,14 +10904,14 @@ function shouldRemainOnPreviousScreen() { var handler = suspenseHandlerStackCursor.current; return null === handler ? !0 - : (workInProgressRootRenderLanes & 8388480) === + : (workInProgressRootRenderLanes & 4194176) === workInProgressRootRenderLanes ? null === shellBoundary ? !0 : !1 - : (workInProgressRootRenderLanes & 125829120) === + : (workInProgressRootRenderLanes & 62914560) === workInProgressRootRenderLanes || - 0 !== (workInProgressRootRenderLanes & 1073741824) + 0 !== (workInProgressRootRenderLanes & 536870912) ? handler === shellBoundary : !1; } @@ -10875,10 +10927,14 @@ function pushCacheDispatcher() { } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = 4; - null === workInProgressRoot || - (0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455)) || - markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes); + (0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || + null === workInProgressRoot || + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } function renderRootSync(root, lanes) { var prevExecutionContext = executionContext; @@ -11212,7 +11268,7 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } -function commitRoot(root, recoverableErrors, transitions) { +function commitRoot(root, recoverableErrors, transitions, spawnedLane) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig$1.transition; try { @@ -11222,7 +11278,8 @@ function commitRoot(root, recoverableErrors, transitions) { root, recoverableErrors, transitions, - previousUpdateLanePriority + previousUpdateLanePriority, + spawnedLane ); } finally { (ReactCurrentBatchConfig$1.transition = prevTransition), @@ -11234,7 +11291,8 @@ function commitRootImpl( root, recoverableErrors, transitions, - renderPriorityLevel + renderPriorityLevel, + spawnedLane ) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); @@ -11256,7 +11314,7 @@ function commitRootImpl( root.cancelPendingCommit = null; var remainingLanes = finishedWork.lanes | finishedWork.childLanes; remainingLanes |= concurrentlyUpdatedLanes; - markRootFinished(root, remainingLanes); + markRootFinished(root, remainingLanes, spawnedLane); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -11274,7 +11332,7 @@ function commitRootImpl( if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { transitions = ReactCurrentBatchConfig$1.transition; ReactCurrentBatchConfig$1.transition = null; - var previousPriority = currentUpdatePriority; + spawnedLane = currentUpdatePriority; currentUpdatePriority = 2; var prevExecutionContext = executionContext; executionContext |= 4; @@ -11310,7 +11368,7 @@ function commitRootImpl( (rootCommittingMutationOrLayoutEffects = null); requestPaint(); executionContext = prevExecutionContext; - currentUpdatePriority = previousPriority; + currentUpdatePriority = spawnedLane; ReactCurrentBatchConfig$1.transition = transitions; } else (root.current = finishedWork), (commitTime = now()); rootDoesHavePassiveEffects @@ -11346,7 +11404,7 @@ function commitRootImpl( 0 !== root.tag && flushPassiveEffects(); remainingLanes = root.pendingLanes; - 0 !== (lanes & 8388522) && 0 !== (remainingLanes & SyncUpdateLanes) + 0 !== (lanes & 4194218) && 0 !== (remainingLanes & SyncUpdateLanes) ? ((nestedUpdateScheduled = !0), root === rootWithNestedUpdates ? nestedUpdateCount++ @@ -11538,7 +11596,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 125829120) === + (workInProgressRootRenderLanes & 62914560) === workInProgressRootRenderLanes && 300 > now$1() - globalMostRecentFallbackTime) ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) @@ -12764,9 +12822,9 @@ function markRetryLaneIfNotHydrated(fiber, retryLane) { } function attemptContinuousHydration(fiber) { if (13 === fiber.tag) { - var root = enqueueConcurrentRenderForLane(fiber, 134217728); - null !== root && scheduleUpdateOnFiber(root, fiber, 134217728); - markRetryLaneIfNotHydrated(fiber, 134217728); + var root = enqueueConcurrentRenderForLane(fiber, 67108864); + null !== root && scheduleUpdateOnFiber(root, fiber, 67108864); + markRetryLaneIfNotHydrated(fiber, 67108864); } } function emptyFindFiberByHostInstance() { @@ -13305,14 +13363,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$366; if (canUseDOM) { - var isSupported$jscomp$inline_1610 = "oninput" in document; - if (!isSupported$jscomp$inline_1610) { - var element$jscomp$inline_1611 = document.createElement("div"); - element$jscomp$inline_1611.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1610 = - "function" === typeof element$jscomp$inline_1611.oninput; + var isSupported$jscomp$inline_1613 = "oninput" in document; + if (!isSupported$jscomp$inline_1613) { + var element$jscomp$inline_1614 = document.createElement("div"); + element$jscomp$inline_1614.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1613 = + "function" === typeof element$jscomp$inline_1614.oninput; } - JSCompiler_inline_result$jscomp$366 = isSupported$jscomp$inline_1610; + JSCompiler_inline_result$jscomp$366 = isSupported$jscomp$inline_1613; } else JSCompiler_inline_result$jscomp$366 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$366 && @@ -13624,20 +13682,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1651 = 0; - i$jscomp$inline_1651 < simpleEventPluginEvents.length; - i$jscomp$inline_1651++ + var i$jscomp$inline_1654 = 0; + i$jscomp$inline_1654 < simpleEventPluginEvents.length; + i$jscomp$inline_1654++ ) { - var eventName$jscomp$inline_1652 = - simpleEventPluginEvents[i$jscomp$inline_1651], - domEventName$jscomp$inline_1653 = - eventName$jscomp$inline_1652.toLowerCase(), - capitalizedEvent$jscomp$inline_1654 = - eventName$jscomp$inline_1652[0].toUpperCase() + - eventName$jscomp$inline_1652.slice(1); + var eventName$jscomp$inline_1655 = + simpleEventPluginEvents[i$jscomp$inline_1654], + domEventName$jscomp$inline_1656 = + eventName$jscomp$inline_1655.toLowerCase(), + capitalizedEvent$jscomp$inline_1657 = + eventName$jscomp$inline_1655[0].toUpperCase() + + eventName$jscomp$inline_1655.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1653, - "on" + capitalizedEvent$jscomp$inline_1654 + domEventName$jscomp$inline_1656, + "on" + capitalizedEvent$jscomp$inline_1657 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16965,7 +17023,7 @@ function getEventPriority(domEventName) { case LowPriority: return 32; case IdlePriority: - return 536870912; + return 268435456; default: return 32; } @@ -17177,10 +17235,10 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1877 = { +var devToolsConfig$jscomp$inline_1880 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-cb867dc6", + version: "18.3.0-www-classic-946dac52", rendererPackageName: "react-dom" }; (function (internals) { @@ -17198,10 +17256,10 @@ var devToolsConfig$jscomp$inline_1877 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1877.bundleType, - version: devToolsConfig$jscomp$inline_1877.version, - rendererPackageName: devToolsConfig$jscomp$inline_1877.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1877.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1880.bundleType, + version: devToolsConfig$jscomp$inline_1880.version, + rendererPackageName: devToolsConfig$jscomp$inline_1880.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1880.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17217,14 +17275,14 @@ var devToolsConfig$jscomp$inline_1877 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1877.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1880.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-cb867dc6" + reconcilerVersion: "18.3.0-www-classic-946dac52" }); assign(Internals, { ReactBrowserEventEmitter: { @@ -17548,7 +17606,7 @@ exports.useFormState = function () { exports.useFormStatus = function () { throw Error(formatProdErrorMessage(248)); }; -exports.version = "18.3.0-www-classic-cb867dc6"; +exports.version = "18.3.0-www-classic-946dac52"; /* 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 7a70f56519..49a2101a05 100644 --- a/compiled/facebook-www/ReactDOM-profiling.modern.js +++ b/compiled/facebook-www/ReactDOM-profiling.modern.js @@ -206,7 +206,7 @@ function onCommitRoot(root, eventPriority) { case 32: schedulerPriority = NormalPriority$1; break; - case 536870912: + case 268435456: schedulerPriority = IdlePriority; break; default: @@ -301,16 +301,17 @@ function getLabelForLane(lane) { if (lane & 16) return "DefaultHydration"; if (lane & 32) return "Default"; if (lane & 64) return "TransitionHydration"; - if (lane & 8388480) return "Transition"; - if (lane & 125829120) return "Retry"; - if (lane & 134217728) return "SelectiveHydration"; - if (lane & 268435456) return "IdleHydration"; - if (lane & 536870912) return "Idle"; - if (lane & 1073741824) return "Offscreen"; + if (lane & 4194176) return "Transition"; + if (lane & 62914560) return "Retry"; + if (lane & 67108864) return "SelectiveHydration"; + if (lane & 134217728) return "IdleHydration"; + if (lane & 268435456) return "Idle"; + if (lane & 536870912) return "Offscreen"; + if (lane & 1073741824) return "Deferred"; } } var nextTransitionLane = 128, - nextRetryLane = 8388608; + nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { if (enableUnifiedSyncLane) { var pendingSyncLanes = lanes & SyncUpdateLanes; @@ -346,13 +347,14 @@ function getHighestPriorityLanes(lanes) { case 524288: case 1048576: case 2097152: + return lanes & 4194176; case 4194304: - return lanes & 8388480; case 8388608: case 16777216: case 33554432: + return lanes & 62914560; case 67108864: - return lanes & 125829120; + return 67108864; case 134217728: return 134217728; case 268435456: @@ -360,7 +362,7 @@ function getHighestPriorityLanes(lanes) { case 536870912: return 536870912; case 1073741824: - return 1073741824; + return 0; default: return lanes; } @@ -371,7 +373,7 @@ function getNextLanes(root, wipLanes) { var nextLanes = 0, suspendedLanes = root.suspendedLanes; root = root.pingedLanes; - var nonIdlePendingLanes = pendingLanes & 268435455; + var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes @@ -390,7 +392,7 @@ function getNextLanes(root, wipLanes) { ((suspendedLanes = nextLanes & -nextLanes), (root = wipLanes & -wipLanes), suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 8388480))) + (32 === suspendedLanes && 0 !== (root & 4194176))) ? wipLanes : nextLanes; } @@ -419,13 +421,13 @@ function computeExpirationTime(lane, currentTime) { case 524288: case 1048576: case 2097152: - case 4194304: return currentTime + 5e3; + case 4194304: case 8388608: case 16777216: case 33554432: - case 67108864: return -1; + case 67108864: case 134217728: case 268435456: case 536870912: @@ -437,22 +439,16 @@ function computeExpirationTime(lane, currentTime) { } function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) return 0; - root = root.pendingLanes & -1073741825; - return 0 !== root ? root : root & 1073741824 ? 1073741824 : 0; + root = root.pendingLanes & -536870913; + return 0 !== root ? root : root & 536870912 ? 536870912 : 0; } function includesBlockingLane(root, lanes) { return 0 !== (root.current.mode & 32) ? !1 : 0 !== (lanes & 60); } -function claimNextTransitionLane() { - var lane = nextTransitionLane; - nextTransitionLane <<= 1; - 0 === (nextTransitionLane & 8388480) && (nextTransitionLane = 128); - return lane; -} function claimNextRetryLane() { var lane = nextRetryLane; nextRetryLane <<= 1; - 0 === (nextRetryLane & 125829120) && (nextRetryLane = 8388608); + 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304); return lane; } function createLaneMap(initial) { @@ -461,10 +457,10 @@ function createLaneMap(initial) { } function markRootUpdated(root, updateLane) { root.pendingLanes |= updateLane; - 536870912 !== updateLane && + 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0)); } -function markRootFinished(root, remainingLanes) { +function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; @@ -474,24 +470,37 @@ function markRootFinished(root, remainingLanes) { root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; remainingLanes = root.entanglements; - var expirationTimes = root.expirationTimes; - for (root = root.hiddenUpdates; 0 < noLongerPendingLanes; ) { + for ( + var expirationTimes = root.expirationTimes, + hiddenUpdates = root.hiddenUpdates; + 0 < noLongerPendingLanes; + + ) { var index$4 = 31 - clz32(noLongerPendingLanes), lane = 1 << index$4; remainingLanes[index$4] = 0; expirationTimes[index$4] = -1; - var hiddenUpdatesForLane = root[index$4]; + var hiddenUpdatesForLane = hiddenUpdates[index$4]; if (null !== hiddenUpdatesForLane) for ( - root[index$4] = null, index$4 = 0; + hiddenUpdates[index$4] = null, index$4 = 0; index$4 < hiddenUpdatesForLane.length; index$4++ ) { var update = hiddenUpdatesForLane[index$4]; - null !== update && (update.lane &= -1073741825); + null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; } + 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); +} +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; + var spawnedLaneIndex = 31 - clz32(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] = + root.entanglements[spawnedLaneIndex] | 1073741824 | entangledLanes; } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); @@ -578,9 +587,9 @@ function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes ? 8 < lanes - ? 0 !== (lanes & 268435455) + ? 0 !== (lanes & 134217727) ? 32 - : 536870912 + : 268435456 : 8 : 2; } @@ -1679,7 +1688,7 @@ function tryHydrateSuspense(fiber, nextInstance) { (fiber.memoizedState = { dehydrated: nextInstance, treeContext: instance, - retryLane: 1073741824 + retryLane: 536870912 }), (instance = createFiber(18, null, null, 0)), (instance.stateNode = nextInstance), @@ -1838,7 +1847,7 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { null === sourceFiber ? (parent[isHidden] = [update]) : sourceFiber.push(update), - (update.lane = lane | 1073741824)); + (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { if (50 < nestedUpdateCount) @@ -1894,7 +1903,7 @@ function enqueueUpdate(fiber, update, lane) { } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 4194176))) { var queueLanes = fiber.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -1982,7 +1991,7 @@ function processUpdateQueue( current = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { - var updateLane = pendingQueue.lane & -1073741825, + var updateLane = pendingQueue.lane & -536870913, isHiddenUpdate = updateLane !== pendingQueue.lane; if ( isHiddenUpdate @@ -3087,7 +3096,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { prepareFreshStack(workInProgressRootRenderLanes$53, 0), markRootSuspended( workInProgressRootRenderLanes$53, - nextLanes + nextLanes, + 0 ), ensureRootIsScheduled(workInProgressRootRenderLanes$53), originallyAttemptedLanes) @@ -3095,7 +3105,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { 6 === exitStatus ? markRootSuspended( workInProgressRootRenderLanes$53, - nextLanes + nextLanes, + 0 ) : ((workInProgressRootRenderLanes$53.finishedWork = workInProgressRootRenderLanes$53.current.alternate), @@ -3104,7 +3115,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { commitRoot( workInProgressRootRenderLanes$53, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane )); } ensureRootIsScheduled(workInProgressRootRenderLanes$53); @@ -3166,7 +3178,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { var suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, - lanes = root.pendingLanes & -125829121; + lanes = root.pendingLanes & -62914561; 0 < lanes; ) { @@ -3220,7 +3232,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { case 32: suspendedLanes = NormalPriority$1; break; - case 536870912: + case 268435456: suspendedLanes = IdlePriority; break; default: @@ -3240,8 +3252,12 @@ function scheduleImmediateTask(cb) { }); } function requestTransitionLane() { - 0 === currentEventTransitionLane && - (currentEventTransitionLane = claimNextTransitionLane()); + if (0 === currentEventTransitionLane) { + var lane = nextTransitionLane; + nextTransitionLane <<= 1; + 0 === (nextTransitionLane & 4194176) && (nextTransitionLane = 128); + currentEventTransitionLane = lane; + } return currentEventTransitionLane; } var currentEntangledListeners = null, @@ -3570,7 +3586,7 @@ function updateReducerImpl(hook, current, reducer) { newBaseQueueLast = null, update = current; do { - var updateLane = update.lane & -1073741825; + var updateLane = update.lane & -536870913; if ( updateLane !== update.lane ? (workInProgressRootRenderLanes & updateLane) === updateLane @@ -3914,9 +3930,11 @@ function updateMemo(nextCreate, deps) { return nextCreate; } function mountDeferredValueImpl(hook, value, initialValue) { - return enableUseDeferredValueInitialArg && void 0 !== initialValue + return enableUseDeferredValueInitialArg && + void 0 !== initialValue && + 0 === (renderLanes & 1073741824) ? ((hook.memoizedState = initialValue), - (value = claimNextTransitionLane()), + (value = requestDeferredLane()), (currentlyRenderingFiber$1.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0), @@ -3930,7 +3948,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { (hook.memoizedState = value) ); objectIs(value, prevValue) || - ((value = claimNextTransitionLane()), + ((value = requestDeferredLane()), (currentlyRenderingFiber$1.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); @@ -4117,7 +4135,7 @@ function enqueueRenderPhaseUpdate(queue, update) { queue.pending = update; } function entangleTransitionUpdate(root, queue, lane) { - if (0 !== (lane & 8388480)) { + if (0 !== (lane & 4194176)) { var queueLanes = queue.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -5174,7 +5192,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) { null !== current && pushTransition(workInProgress, null, null), reuseHiddenContextOnStack(), pushOffscreenSuspenseHandler(workInProgress); - else if (0 !== (renderLanes & 1073741824)) + else if (0 !== (renderLanes & 536870912)) (workInProgress.memoizedState = { baseLanes: 0, cachePool: null }), null !== current && pushTransition( @@ -5188,7 +5206,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) { pushOffscreenSuspenseHandler(workInProgress); else return ( - (workInProgress.lanes = workInProgress.childLanes = 1073741824), + (workInProgress.lanes = workInProgress.childLanes = 536870912), deferHiddenOffscreenComponent( current, workInProgress, @@ -5604,7 +5622,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? (workInProgress.lanes = 2) : "$!" === current.data ? (workInProgress.lanes = 16) - : (workInProgress.lanes = 1073741824), + : (workInProgress.lanes = 536870912), null ); popSuspenseHandler(workInProgress); @@ -5654,7 +5672,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.child.memoizedState = mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress.lanes = 8388608), + (workInProgress.lanes = 4194304), current ); pushPrimaryTreeSuspenseHandler(workInProgress); @@ -5955,11 +5973,10 @@ function updateDehydratedSuspenseComponent( case 8388608: case 16777216: case 33554432: - case 67108864: digest = 64; break; - case 536870912: - digest = 268435456; + case 268435456: + digest = 134217728; break; default: digest = 0; @@ -6734,7 +6751,7 @@ function scheduleRetryEffect(workInProgress, retryQueue) { ? (workInProgress.flags |= 4) : workInProgress.flags & 16384 && ((retryQueue = - 22 !== workInProgress.tag ? claimNextRetryLane() : 1073741824), + 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), (workInProgress.lanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { @@ -7250,7 +7267,7 @@ function completeWork(current, workInProgress, renderLanes) { ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(currentResource, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); } else { if (!newProps) @@ -7271,11 +7288,11 @@ function completeWork(current, workInProgress, renderLanes) { } else 2 * now$1() - currentResource.renderingStartTime > workInProgressRootRenderTargetTime && - 1073741824 !== renderLanes && + 536870912 !== renderLanes && ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(currentResource, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); currentResource.isBackwards ? ((cache$131.sibling = workInProgress.child), (workInProgress.child = cache$131)) @@ -7328,7 +7345,7 @@ function completeWork(current, workInProgress, renderLanes) { (workInProgress.flags |= 8192) : newProps && (workInProgress.flags |= 8192)), newProps && 0 !== (workInProgress.mode & 1) - ? 0 !== (renderLanes & 1073741824) && + ? 0 !== (renderLanes & 536870912) && 0 === (workInProgress.flags & 128) && (bubbleProperties(workInProgress), 23 !== workInProgress.tag && @@ -10170,6 +10187,7 @@ var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, workInProgressRootPingedLanes = 0, + workInProgressDeferredLane = 0, workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, globalMostRecentFallbackTime = 0, @@ -10265,13 +10283,25 @@ function requestUpdateLane(fiber) { fiber = void 0 === fiber ? 32 : getEventPriority(fiber.type); return fiber; } +function requestDeferredLane() { + 0 === workInProgressDeferredLane && + (workInProgressDeferredLane = + 0 !== (workInProgressRootRenderLanes & 536870912) + ? 536870912 + : requestTransitionLane()); + return workInProgressDeferredLane; +} function scheduleUpdateOnFiber(root, fiber, lane) { if ( (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || null !== root.cancelPendingCommit ) prepareFreshStack(root, 0), - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); markRootUpdated(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) { isDevToolsPresent && addFiberToLanesMap(root, fiber, lane); @@ -10310,7 +10340,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { (0 === (executionContext & 2) && (workInProgressRootInterleavedUpdatedLanes |= lane), 4 === workInProgressRootExitStatus && - markRootSuspended(root, workInProgressRootRenderLanes)); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + )); ensureRootIsScheduled(root); 2 === lane && 0 === executionContext && @@ -10339,7 +10373,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (0 !== exitStatus) { var renderWasConcurrent = didTimeout; do { - if (6 === exitStatus) markRootSuspended(root, lanes); + if (6 === exitStatus) markRootSuspended(root, lanes, 0); else { didTimeout = root.current.alternate; if ( @@ -10368,7 +10402,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { throw ( ((originalCallbackNode = workInProgressRootFatalError), prepareFreshStack(root, 0), - markRootSuspended(root, lanes), + markRootSuspended(root, lanes, 0), ensureRootIsScheduled(root), originalCallbackNode) ); @@ -10381,8 +10415,12 @@ function performConcurrentWorkOnRoot(root, didTimeout) { case 1: throw Error(formatProdErrorMessage(345)); case 4: - if ((lanes & 8388480) === lanes) { - markRootSuspended(renderWasConcurrent, lanes); + if ((lanes & 4194176) === lanes) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); break a; } break; @@ -10394,12 +10432,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { throw Error(formatProdErrorMessage(329)); } if ( - (lanes & 125829120) === lanes && + (lanes & 62914560) === lanes && (alwaysThrottleRetries || 3 === exitStatus) && ((exitStatus = globalMostRecentFallbackTime + 300 - now$1()), 10 < exitStatus) ) { - markRootSuspended(renderWasConcurrent, lanes); + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; renderWasConcurrent.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( @@ -10408,7 +10450,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ), exitStatus ); @@ -10419,7 +10462,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ); } } @@ -10469,7 +10513,8 @@ function commitRootWhenReady( finishedWork, recoverableErrors, transitions, - lanes + lanes, + spawnedLane ) { if ( 0 === (lanes & 42) && @@ -10481,10 +10526,10 @@ function commitRootWhenReady( root.cancelPendingCommit = finishedWork( commitRoot.bind(null, root, recoverableErrors, transitions) ); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, spawnedLane); return; } - commitRoot(root, recoverableErrors, transitions); + commitRoot(root, recoverableErrors, transitions, spawnedLane); } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { @@ -10520,17 +10565,23 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootSuspended(root, suspendedLanes) { +function markRootSuspended(root, suspendedLanes, spawnedLane) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for (root = root.expirationTimes; 0 < suspendedLanes; ) { - var index$3 = 31 - clz32(suspendedLanes), + for ( + var expirationTimes = root.expirationTimes, lanes = suspendedLanes; + 0 < lanes; + + ) { + var index$3 = 31 - clz32(lanes), lane = 1 << index$3; - root[index$3] = -1; - suspendedLanes &= ~lane; + expirationTimes[index$3] = -1; + lanes &= ~lane; } + 0 !== spawnedLane && + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } function batchedUpdates$1(fn, a) { var prevExecutionContext = executionContext; @@ -10602,7 +10653,8 @@ function prepareFreshStack(root, lanes) { workInProgressRootDidAttachPingListener = !1; workInProgressRootExitStatus = 0; workInProgressRootFatalError = null; - workInProgressRootPingedLanes = + workInProgressDeferredLane = + workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; @@ -10633,8 +10685,8 @@ function handleThrow(root, thrownValue) { ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = shouldRemainOnPreviousScreen() && - 0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455) + 0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) ? 2 : 3)) : thrownValue === SuspenseyCommitException @@ -10686,14 +10738,14 @@ function shouldRemainOnPreviousScreen() { var handler = suspenseHandlerStackCursor.current; return null === handler ? !0 - : (workInProgressRootRenderLanes & 8388480) === + : (workInProgressRootRenderLanes & 4194176) === workInProgressRootRenderLanes ? null === shellBoundary ? !0 : !1 - : (workInProgressRootRenderLanes & 125829120) === + : (workInProgressRootRenderLanes & 62914560) === workInProgressRootRenderLanes || - 0 !== (workInProgressRootRenderLanes & 1073741824) + 0 !== (workInProgressRootRenderLanes & 536870912) ? handler === shellBoundary : !1; } @@ -10709,10 +10761,14 @@ function pushCacheDispatcher() { } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = 4; - null === workInProgressRoot || - (0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455)) || - markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes); + (0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || + null === workInProgressRoot || + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } function renderRootSync(root, lanes) { var prevExecutionContext = executionContext; @@ -11042,7 +11098,7 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } -function commitRoot(root, recoverableErrors, transitions) { +function commitRoot(root, recoverableErrors, transitions, spawnedLane) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig$1.transition; try { @@ -11052,7 +11108,8 @@ function commitRoot(root, recoverableErrors, transitions) { root, recoverableErrors, transitions, - previousUpdateLanePriority + previousUpdateLanePriority, + spawnedLane ); } finally { (ReactCurrentBatchConfig$1.transition = prevTransition), @@ -11064,7 +11121,8 @@ function commitRootImpl( root, recoverableErrors, transitions, - renderPriorityLevel + renderPriorityLevel, + spawnedLane ) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); @@ -11086,7 +11144,7 @@ function commitRootImpl( root.cancelPendingCommit = null; var remainingLanes = finishedWork.lanes | finishedWork.childLanes; remainingLanes |= concurrentlyUpdatedLanes; - markRootFinished(root, remainingLanes); + markRootFinished(root, remainingLanes, spawnedLane); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -11104,7 +11162,7 @@ function commitRootImpl( if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { transitions = ReactCurrentBatchConfig$1.transition; ReactCurrentBatchConfig$1.transition = null; - var previousPriority = currentUpdatePriority; + spawnedLane = currentUpdatePriority; currentUpdatePriority = 2; var prevExecutionContext = executionContext; executionContext |= 4; @@ -11140,7 +11198,7 @@ function commitRootImpl( (rootCommittingMutationOrLayoutEffects = null); requestPaint(); executionContext = prevExecutionContext; - currentUpdatePriority = previousPriority; + currentUpdatePriority = spawnedLane; ReactCurrentBatchConfig$1.transition = transitions; } else (root.current = finishedWork), (commitTime = now()); rootDoesHavePassiveEffects @@ -11176,7 +11234,7 @@ function commitRootImpl( 0 !== root.tag && flushPassiveEffects(); remainingLanes = root.pendingLanes; - 0 !== (lanes & 8388522) && 0 !== (remainingLanes & SyncUpdateLanes) + 0 !== (lanes & 4194218) && 0 !== (remainingLanes & SyncUpdateLanes) ? ((nestedUpdateScheduled = !0), root === rootWithNestedUpdates ? nestedUpdateCount++ @@ -11368,7 +11426,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 125829120) === + (workInProgressRootRenderLanes & 62914560) === workInProgressRootRenderLanes && 300 > now$1() - globalMostRecentFallbackTime) ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) @@ -12478,9 +12536,9 @@ function markRetryLaneIfNotHydrated(fiber, retryLane) { } function attemptContinuousHydration(fiber) { if (13 === fiber.tag) { - var root = enqueueConcurrentRenderForLane(fiber, 134217728); - null !== root && scheduleUpdateOnFiber(root, fiber, 134217728); - markRetryLaneIfNotHydrated(fiber, 134217728); + var root = enqueueConcurrentRenderForLane(fiber, 67108864); + null !== root && scheduleUpdateOnFiber(root, fiber, 67108864); + markRetryLaneIfNotHydrated(fiber, 67108864); } } function emptyFindFiberByHostInstance() { @@ -13340,7 +13398,7 @@ function getEventPriority(domEventName) { case LowPriority: return 32; case IdlePriority: - return 536870912; + return 268435456; default: return 32; } @@ -13543,14 +13601,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$364; if (canUseDOM) { - var isSupported$jscomp$inline_1609 = "oninput" in document; - if (!isSupported$jscomp$inline_1609) { - var element$jscomp$inline_1610 = document.createElement("div"); - element$jscomp$inline_1610.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1609 = - "function" === typeof element$jscomp$inline_1610.oninput; + var isSupported$jscomp$inline_1612 = "oninput" in document; + if (!isSupported$jscomp$inline_1612) { + var element$jscomp$inline_1613 = document.createElement("div"); + element$jscomp$inline_1613.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1612 = + "function" === typeof element$jscomp$inline_1613.oninput; } - JSCompiler_inline_result$jscomp$364 = isSupported$jscomp$inline_1609; + JSCompiler_inline_result$jscomp$364 = isSupported$jscomp$inline_1612; } else JSCompiler_inline_result$jscomp$364 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$364 && @@ -13862,20 +13920,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1650 = 0; - i$jscomp$inline_1650 < simpleEventPluginEvents.length; - i$jscomp$inline_1650++ + var i$jscomp$inline_1653 = 0; + i$jscomp$inline_1653 < simpleEventPluginEvents.length; + i$jscomp$inline_1653++ ) { - var eventName$jscomp$inline_1651 = - simpleEventPluginEvents[i$jscomp$inline_1650], - domEventName$jscomp$inline_1652 = - eventName$jscomp$inline_1651.toLowerCase(), - capitalizedEvent$jscomp$inline_1653 = - eventName$jscomp$inline_1651[0].toUpperCase() + - eventName$jscomp$inline_1651.slice(1); + var eventName$jscomp$inline_1654 = + simpleEventPluginEvents[i$jscomp$inline_1653], + domEventName$jscomp$inline_1655 = + eventName$jscomp$inline_1654.toLowerCase(), + capitalizedEvent$jscomp$inline_1656 = + eventName$jscomp$inline_1654[0].toUpperCase() + + eventName$jscomp$inline_1654.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1652, - "on" + capitalizedEvent$jscomp$inline_1653 + domEventName$jscomp$inline_1655, + "on" + capitalizedEvent$jscomp$inline_1656 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16697,10 +16755,10 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1836 = { +var devToolsConfig$jscomp$inline_1839 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-6f780ed3", + version: "18.3.0-www-modern-e1100111", rendererPackageName: "react-dom" }; (function (internals) { @@ -16718,10 +16776,10 @@ var devToolsConfig$jscomp$inline_1836 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1836.bundleType, - version: devToolsConfig$jscomp$inline_1836.version, - rendererPackageName: devToolsConfig$jscomp$inline_1836.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1836.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1839.bundleType, + version: devToolsConfig$jscomp$inline_1839.version, + rendererPackageName: devToolsConfig$jscomp$inline_1839.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1839.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16738,14 +16796,14 @@ var devToolsConfig$jscomp$inline_1836 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1836.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1839.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-6f780ed3" + reconcilerVersion: "18.3.0-www-modern-e1100111" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.createPortal = function (children, container) { @@ -16997,7 +17055,7 @@ exports.useFormState = function () { exports.useFormStatus = function () { throw Error(formatProdErrorMessage(248)); }; -exports.version = "18.3.0-www-modern-6f780ed3"; +exports.version = "18.3.0-www-modern-e1100111"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled/facebook-www/ReactDOMServer-dev.modern.js b/compiled/facebook-www/ReactDOMServer-dev.modern.js index 13727d50f1..11a40e55f5 100644 --- a/compiled/facebook-www/ReactDOMServer-dev.modern.js +++ b/compiled/facebook-www/ReactDOMServer-dev.modern.js @@ -19,7 +19,7 @@ if (__DEV__) { var React = require("react"); var ReactDOM = require("react-dom"); -var ReactVersion = "18.3.0-www-modern-e16a234e"; +var ReactVersion = "18.3.0-www-modern-bbf5dd10"; // This refers to a WWW module. var warningWWW = require("warning"); diff --git a/compiled/facebook-www/ReactDOMServer-prod.modern.js b/compiled/facebook-www/ReactDOMServer-prod.modern.js index 67a28e484c..eac38aed1e 100644 --- a/compiled/facebook-www/ReactDOMServer-prod.modern.js +++ b/compiled/facebook-www/ReactDOMServer-prod.modern.js @@ -4985,4 +4985,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "18.3.0-www-modern-9da1579a"; +exports.version = "18.3.0-www-modern-504a3f39"; diff --git a/compiled/facebook-www/ReactDOMTesting-dev.classic.js b/compiled/facebook-www/ReactDOMTesting-dev.classic.js index d07b11030a..72289560ac 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.classic.js @@ -1750,7 +1750,7 @@ var TransitionHydrationLane = 64; var TransitionLanes = /* */ - 8388480; + 4194176; var TransitionLane1 = /* */ 128; @@ -1796,39 +1796,39 @@ var TransitionLane14 = var TransitionLane15 = /* */ 2097152; -var TransitionLane16 = - /* */ - 4194304; var RetryLanes = /* */ - 125829120; + 62914560; var RetryLane1 = /* */ - 8388608; + 4194304; var RetryLane2 = /* */ - 16777216; + 8388608; var RetryLane3 = /* */ - 33554432; + 16777216; var RetryLane4 = /* */ - 67108864; + 33554432; var SomeRetryLane = RetryLane1; var SelectiveHydrationLane = /* */ - 134217728; + 67108864; var NonIdleLanes = /* */ - 268435455; + 134217727; var IdleHydrationLane = /* */ - 268435456; + 134217728; var IdleLane = /* */ - 536870912; + 268435456; var OffscreenLane = /* */ + 536870912; +var DeferredLane = + /* */ 1073741824; // Any lane that might schedule an update. This is used to detect infinite // update loops, so it doesn't include hydration lanes or retries. @@ -1889,6 +1889,10 @@ function getLabelForLane(lane) { if (lane & OffscreenLane) { return "Offscreen"; } + + if (lane & DeferredLane) { + return "Deferred"; + } } } var NoTimestamp = -1; @@ -1941,7 +1945,6 @@ function getHighestPriorityLanes(lanes) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: return lanes & TransitionLanes; case RetryLane1: @@ -1962,6 +1965,11 @@ function getHighestPriorityLanes(lanes) { case OffscreenLane: return OffscreenLane; + case DeferredLane: + // This shouldn't be reachable because deferred work is always entangled + // with something else. + return NoLanes; + default: { error("Should have found matching lanes. This is a bug in React."); @@ -2128,7 +2136,6 @@ function computeExpirationTime(lane, currentTime) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: return currentTime + 5000; case RetryLane1: @@ -2146,6 +2153,7 @@ function computeExpirationTime(lane, currentTime) { case IdleHydrationLane: case IdleLane: case OffscreenLane: + case DeferredLane: // Anything idle priority or lower should never expire. return NoTimestamp; @@ -2358,7 +2366,7 @@ function markRootUpdated(root, updateLane) { root.pingedLanes = NoLanes; } } -function markRootSuspended$1(root, suspendedLanes) { +function markRootSuspended$1(root, suspendedLanes, spawnedLane) { root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. @@ -2371,11 +2379,15 @@ function markRootSuspended$1(root, suspendedLanes) { expirationTimes[index] = NoTimestamp; lanes &= ~lane; } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); + } } function markRootPinged(root, pingedLanes) { root.pingedLanes |= root.suspendedLanes & pingedLanes; } -function markRootFinished(root, remainingLanes) { +function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; // Let's try everything again @@ -2415,7 +2427,32 @@ function markRootFinished(root, remainingLanes) { lanes &= ~lane; } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane( + root, + spawnedLane, // This render finished successfully without suspending, so we don't need + // to entangle the spawned task with the parent task. + NoLanes + ); + } +} + +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + // This render spawned a deferred task. Mark it as pending. + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; // Entangle the spawned lane with the DeferredLane bit so that we know it + // was the result of another render. This lets us avoid a useDeferredValue + // waterfall — only the first level will defer. + + var spawnedLaneIndex = laneToIndex(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] |= + DeferredLane | // If the parent render task suspended, we must also entangle those lanes + // with the spawned task. + entangledLanes; } + function markRootEntangled(root, entangledLanes) { // In addition to entangling each of the given lanes with each other, we also // have to consider _transitive_ entanglements. For each lane that is already @@ -2518,7 +2555,6 @@ function getBumpedLaneForHydration(root, renderLanes) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: case RetryLane1: case RetryLane2: case RetryLane3: @@ -14478,15 +14514,18 @@ function rerenderDeferredValue(value, initialValue) { } function mountDeferredValueImpl(hook, value, initialValue) { - if (enableUseDeferredValueInitialArg && initialValue !== undefined) { - // When `initialValue` is provided, we defer the initial render even if the + if ( + enableUseDeferredValueInitialArg && // When `initialValue` is provided, we defer the initial render even if the // current render is not synchronous. - // TODO: However, to avoid waterfalls, we should not defer if this render - // was itself spawned by an earlier useDeferredValue. Plan is to add a - // Deferred lane to track this. - hook.memoizedState = initialValue; // Schedule a deferred render + initialValue !== undefined && // However, to avoid waterfalls, we do not defer if this render + // was itself spawned by an earlier useDeferredValue. Check if DeferredLane + // is part of the render lanes. + !includesSomeLane(renderLanes, DeferredLane) + ) { + // Render with the initial value + hook.memoizedState = initialValue; // Schedule a deferred render to switch to the final value. - var deferredLane = claimNextTransitionLane(); + var deferredLane = requestDeferredLane(); currentlyRenderingFiber$1.lanes = mergeLanes( currentlyRenderingFiber$1.lanes, deferredLane @@ -14514,7 +14553,7 @@ function updateDeferredValueImpl(hook, prevValue, value, initialValue) { // previous value and spawn a deferred render to update it later. if (!objectIs(value, prevValue)) { // Schedule a deferred render - var deferredLane = claimNextTransitionLane(); + var deferredLane = requestDeferredLane(); currentlyRenderingFiber$1.lanes = mergeLanes( currentlyRenderingFiber$1.lanes, deferredLane @@ -29979,7 +30018,9 @@ var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event). -var workInProgressRootPingedLanes = NoLanes; // Errors that are thrown during the render phase. +var workInProgressRootPingedLanes = NoLanes; // If this lane scheduled deferred work, this is the lane of the deferred task. + +var workInProgressDeferredLane = NoLane; // Errors that are thrown during the render phase. var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI. // We will log them once the tree commits. @@ -30262,6 +30303,27 @@ function requestRetryLane(fiber) { return claimNextRetryLane(); } +function requestDeferredLane() { + if (workInProgressDeferredLane === NoLane) { + // If there are multiple useDeferredValue hooks in the same render, the + // tasks that they spawn should all be batched together, so they should all + // receive the same lane. + if (includesSomeLane(workInProgressRootRenderLanes, OffscreenLane)) { + // There's only one OffscreenLane, so if it contains deferred work, we + // should just reschedule using the same lane. + // TODO: We also use OffscreenLane for hydration, on the basis that the + // initial HTML is the same as the hydrated UI, but since the deferred + // task will change the UI, it should be treated like an update. Use + // TransitionHydrationLane to trigger selective hydration. + workInProgressDeferredLane = OffscreenLane; + } else { + // Everything else is spawned as a transition. + workInProgressDeferredLane = requestTransitionLane(); + } + } + + return workInProgressDeferredLane; +} function scheduleUpdateOnFiber(root, fiber, lane) { { if (isRunningInsertionEffect) { @@ -30285,7 +30347,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { // The incoming update might unblock the current render. Interrupt the // current attempt and restart from the top. prepareFreshStack(root, NoLanes); - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } // Mark that the root has a pending update. markRootUpdated(root, lane); @@ -30366,7 +30432,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { // effect of interrupting the current render and switching to the update. // TODO: Make sure this doesn't override pings that happen while we've // already started rendering. - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } } @@ -30469,7 +30539,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); } else { // The render completed. // Check if this render may have yielded to a concurrent event, and if so, @@ -30514,7 +30584,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); throw fatalError; } // We now have a consistent tree. The next step is either to commit it, @@ -30634,7 +30704,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { // This is a transition, so we should exit without committing a // placeholder and without scheduling a timeout. Delay indefinitely // until we receive more data. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, workInProgressDeferredLane); return; } // Commit the placeholder. @@ -30657,7 +30727,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { commitRoot( root, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane ); } else { if ( @@ -30670,7 +30741,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now$1(); // Don't bother with a very short suspense time. if (msUntilTimeout > 10) { - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, workInProgressDeferredLane); var nextLanes = getNextLanes(root, NoLanes); if (nextLanes !== NoLanes) { @@ -30690,7 +30761,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { finishedWork, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ), msUntilTimeout ); @@ -30703,7 +30775,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { finishedWork, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ); } } @@ -30713,7 +30786,8 @@ function commitRootWhenReady( finishedWork, recoverableErrors, transitions, - lanes + lanes, + spawnedLane ) { // TODO: Combine retry throttling with Suspensey commits. Right now they run // one after the other. @@ -30741,12 +30815,12 @@ function commitRootWhenReady( root.cancelPendingCommit = schedulePendingCommit( commitRoot.bind(null, root, recoverableErrors, transitions) ); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, spawnedLane); return; } } // Otherwise, commit immediately. - commitRoot(root, recoverableErrors, transitions); + commitRoot(root, recoverableErrors, transitions, spawnedLane); } function isRenderConsistentWithExternalStores(finishedWork) { @@ -30811,7 +30885,7 @@ function isRenderConsistentWithExternalStores(finishedWork) { return true; } -function markRootSuspended(root, suspendedLanes) { +function markRootSuspended(root, suspendedLanes, spawnedLane) { // When suspending, we should always exclude lanes that were pinged or (more // rarely, since we try to avoid it) updated during the render phase. // TODO: Lol maybe there's a better way to factor this besides this @@ -30821,7 +30895,7 @@ function markRootSuspended(root, suspendedLanes) { suspendedLanes, workInProgressRootInterleavedUpdatedLanes ); - markRootSuspended$1(root, suspendedLanes); + markRootSuspended$1(root, suspendedLanes, spawnedLane); } // This is the entry point for synchronous tasks that don't go // through Scheduler @@ -30873,7 +30947,7 @@ function performSyncWorkOnRoot(root, lanes) { if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); throw fatalError; } @@ -30882,7 +30956,7 @@ function performSyncWorkOnRoot(root, lanes) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); return null; } // We now have a consistent tree. Because this is a sync render, we @@ -30894,7 +30968,8 @@ function performSyncWorkOnRoot(root, lanes) { commitRoot( root, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane ); // Before exiting, make sure there's a callback scheduled for the next // pending level. @@ -31056,6 +31131,7 @@ function prepareFreshStack(root, lanes) { workInProgressRootSkippedLanes = NoLanes; workInProgressRootInterleavedUpdatedLanes = NoLanes; workInProgressRootPingedLanes = NoLanes; + workInProgressDeferredLane = NoLane; workInProgressRootConcurrentErrors = null; workInProgressRootRecoverableErrors = null; // Get the lanes that are entangled with whatever we're about to render. We // track these separately so we can distinguish the priority of the render @@ -31298,9 +31374,9 @@ function renderDidSuspendDelayIfPossible() { // this render. if ( - workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || - includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) + includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) && + workInProgressRoot !== null ) { // Mark the current render as suspended so that we switch to working on // the updates that were skipped. Usually we only suspend at the end of @@ -31311,8 +31387,11 @@ function renderDidSuspendDelayIfPossible() { // pinged or updated while we were rendering. // TODO: Consider unwinding immediately, using the // SuspendedOnHydration mechanism. - // $FlowFixMe[incompatible-call] need null check workInProgressRoot - markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes); + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } } function renderDidError(error) { @@ -32091,7 +32170,7 @@ function unwindUnitOfWork(unitOfWork) { workInProgress = null; } -function commitRoot(root, recoverableErrors, transitions) { +function commitRoot(root, recoverableErrors, transitions, spawnedLane) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. var previousUpdateLanePriority = getCurrentUpdatePriority(); @@ -32104,7 +32183,8 @@ function commitRoot(root, recoverableErrors, transitions) { root, recoverableErrors, transitions, - previousUpdateLanePriority + previousUpdateLanePriority, + spawnedLane ); } finally { ReactCurrentBatchConfig$1.transition = prevTransition; @@ -32118,7 +32198,8 @@ function commitRootImpl( root, recoverableErrors, transitions, - renderPriorityLevel + renderPriorityLevel, + spawnedLane ) { do { // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which @@ -32193,7 +32274,7 @@ function commitRootImpl( var concurrentlyUpdatedLanes = getConcurrentlyUpdatedLanes(); remainingLanes = mergeLanes(remainingLanes, concurrentlyUpdatedLanes); - markRootFinished(root, remainingLanes); + markRootFinished(root, remainingLanes, spawnedLane); if (root === workInProgressRoot) { // We can reset these now that they are finished. @@ -34688,7 +34769,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-ef12d11d"; +var ReactVersion = "18.3.0-www-classic-a0b316c1"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOMTesting-dev.modern.js b/compiled/facebook-www/ReactDOMTesting-dev.modern.js index d34d006c5f..4df63ef4ed 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.modern.js @@ -1107,7 +1107,7 @@ var TransitionHydrationLane = 64; var TransitionLanes = /* */ - 8388480; + 4194176; var TransitionLane1 = /* */ 128; @@ -1153,39 +1153,39 @@ var TransitionLane14 = var TransitionLane15 = /* */ 2097152; -var TransitionLane16 = - /* */ - 4194304; var RetryLanes = /* */ - 125829120; + 62914560; var RetryLane1 = /* */ - 8388608; + 4194304; var RetryLane2 = /* */ - 16777216; + 8388608; var RetryLane3 = /* */ - 33554432; + 16777216; var RetryLane4 = /* */ - 67108864; + 33554432; var SomeRetryLane = RetryLane1; var SelectiveHydrationLane = /* */ - 134217728; + 67108864; var NonIdleLanes = /* */ - 268435455; + 134217727; var IdleHydrationLane = /* */ - 268435456; + 134217728; var IdleLane = /* */ - 536870912; + 268435456; var OffscreenLane = /* */ + 536870912; +var DeferredLane = + /* */ 1073741824; // Any lane that might schedule an update. This is used to detect infinite // update loops, so it doesn't include hydration lanes or retries. @@ -1246,6 +1246,10 @@ function getLabelForLane(lane) { if (lane & OffscreenLane) { return "Offscreen"; } + + if (lane & DeferredLane) { + return "Deferred"; + } } } var NoTimestamp = -1; @@ -1298,7 +1302,6 @@ function getHighestPriorityLanes(lanes) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: return lanes & TransitionLanes; case RetryLane1: @@ -1319,6 +1322,11 @@ function getHighestPriorityLanes(lanes) { case OffscreenLane: return OffscreenLane; + case DeferredLane: + // This shouldn't be reachable because deferred work is always entangled + // with something else. + return NoLanes; + default: { error("Should have found matching lanes. This is a bug in React."); @@ -1485,7 +1493,6 @@ function computeExpirationTime(lane, currentTime) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: return currentTime + 5000; case RetryLane1: @@ -1503,6 +1510,7 @@ function computeExpirationTime(lane, currentTime) { case IdleHydrationLane: case IdleLane: case OffscreenLane: + case DeferredLane: // Anything idle priority or lower should never expire. return NoTimestamp; @@ -1715,7 +1723,7 @@ function markRootUpdated(root, updateLane) { root.pingedLanes = NoLanes; } } -function markRootSuspended$1(root, suspendedLanes) { +function markRootSuspended$1(root, suspendedLanes, spawnedLane) { root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. @@ -1728,11 +1736,15 @@ function markRootSuspended$1(root, suspendedLanes) { expirationTimes[index] = NoTimestamp; lanes &= ~lane; } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); + } } function markRootPinged(root, pingedLanes) { root.pingedLanes |= root.suspendedLanes & pingedLanes; } -function markRootFinished(root, remainingLanes) { +function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; // Let's try everything again @@ -1772,7 +1784,32 @@ function markRootFinished(root, remainingLanes) { lanes &= ~lane; } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane( + root, + spawnedLane, // This render finished successfully without suspending, so we don't need + // to entangle the spawned task with the parent task. + NoLanes + ); + } +} + +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + // This render spawned a deferred task. Mark it as pending. + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; // Entangle the spawned lane with the DeferredLane bit so that we know it + // was the result of another render. This lets us avoid a useDeferredValue + // waterfall — only the first level will defer. + + var spawnedLaneIndex = laneToIndex(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] |= + DeferredLane | // If the parent render task suspended, we must also entangle those lanes + // with the spawned task. + entangledLanes; } + function markRootEntangled(root, entangledLanes) { // In addition to entangling each of the given lanes with each other, we also // have to consider _transitive_ entanglements. For each lane that is already @@ -1875,7 +1912,6 @@ function getBumpedLaneForHydration(root, renderLanes) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: case RetryLane1: case RetryLane2: case RetryLane3: @@ -14419,15 +14455,18 @@ function rerenderDeferredValue(value, initialValue) { } function mountDeferredValueImpl(hook, value, initialValue) { - if (enableUseDeferredValueInitialArg && initialValue !== undefined) { - // When `initialValue` is provided, we defer the initial render even if the + if ( + enableUseDeferredValueInitialArg && // When `initialValue` is provided, we defer the initial render even if the // current render is not synchronous. - // TODO: However, to avoid waterfalls, we should not defer if this render - // was itself spawned by an earlier useDeferredValue. Plan is to add a - // Deferred lane to track this. - hook.memoizedState = initialValue; // Schedule a deferred render + initialValue !== undefined && // However, to avoid waterfalls, we do not defer if this render + // was itself spawned by an earlier useDeferredValue. Check if DeferredLane + // is part of the render lanes. + !includesSomeLane(renderLanes, DeferredLane) + ) { + // Render with the initial value + hook.memoizedState = initialValue; // Schedule a deferred render to switch to the final value. - var deferredLane = claimNextTransitionLane(); + var deferredLane = requestDeferredLane(); currentlyRenderingFiber$1.lanes = mergeLanes( currentlyRenderingFiber$1.lanes, deferredLane @@ -14455,7 +14494,7 @@ function updateDeferredValueImpl(hook, prevValue, value, initialValue) { // previous value and spawn a deferred render to update it later. if (!objectIs(value, prevValue)) { // Schedule a deferred render - var deferredLane = claimNextTransitionLane(); + var deferredLane = requestDeferredLane(); currentlyRenderingFiber$1.lanes = mergeLanes( currentlyRenderingFiber$1.lanes, deferredLane @@ -29829,7 +29868,9 @@ var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event). -var workInProgressRootPingedLanes = NoLanes; // Errors that are thrown during the render phase. +var workInProgressRootPingedLanes = NoLanes; // If this lane scheduled deferred work, this is the lane of the deferred task. + +var workInProgressDeferredLane = NoLane; // Errors that are thrown during the render phase. var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI. // We will log them once the tree commits. @@ -30112,6 +30153,27 @@ function requestRetryLane(fiber) { return claimNextRetryLane(); } +function requestDeferredLane() { + if (workInProgressDeferredLane === NoLane) { + // If there are multiple useDeferredValue hooks in the same render, the + // tasks that they spawn should all be batched together, so they should all + // receive the same lane. + if (includesSomeLane(workInProgressRootRenderLanes, OffscreenLane)) { + // There's only one OffscreenLane, so if it contains deferred work, we + // should just reschedule using the same lane. + // TODO: We also use OffscreenLane for hydration, on the basis that the + // initial HTML is the same as the hydrated UI, but since the deferred + // task will change the UI, it should be treated like an update. Use + // TransitionHydrationLane to trigger selective hydration. + workInProgressDeferredLane = OffscreenLane; + } else { + // Everything else is spawned as a transition. + workInProgressDeferredLane = requestTransitionLane(); + } + } + + return workInProgressDeferredLane; +} function scheduleUpdateOnFiber(root, fiber, lane) { { if (isRunningInsertionEffect) { @@ -30135,7 +30197,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { // The incoming update might unblock the current render. Interrupt the // current attempt and restart from the top. prepareFreshStack(root, NoLanes); - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } // Mark that the root has a pending update. markRootUpdated(root, lane); @@ -30216,7 +30282,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { // effect of interrupting the current render and switching to the update. // TODO: Make sure this doesn't override pings that happen while we've // already started rendering. - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } } @@ -30319,7 +30389,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); } else { // The render completed. // Check if this render may have yielded to a concurrent event, and if so, @@ -30364,7 +30434,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); throw fatalError; } // We now have a consistent tree. The next step is either to commit it, @@ -30484,7 +30554,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { // This is a transition, so we should exit without committing a // placeholder and without scheduling a timeout. Delay indefinitely // until we receive more data. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, workInProgressDeferredLane); return; } // Commit the placeholder. @@ -30507,7 +30577,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { commitRoot( root, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane ); } else { if ( @@ -30520,7 +30591,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now$1(); // Don't bother with a very short suspense time. if (msUntilTimeout > 10) { - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, workInProgressDeferredLane); var nextLanes = getNextLanes(root, NoLanes); if (nextLanes !== NoLanes) { @@ -30540,7 +30611,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { finishedWork, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ), msUntilTimeout ); @@ -30553,7 +30625,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { finishedWork, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ); } } @@ -30563,7 +30636,8 @@ function commitRootWhenReady( finishedWork, recoverableErrors, transitions, - lanes + lanes, + spawnedLane ) { // TODO: Combine retry throttling with Suspensey commits. Right now they run // one after the other. @@ -30591,12 +30665,12 @@ function commitRootWhenReady( root.cancelPendingCommit = schedulePendingCommit( commitRoot.bind(null, root, recoverableErrors, transitions) ); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, spawnedLane); return; } } // Otherwise, commit immediately. - commitRoot(root, recoverableErrors, transitions); + commitRoot(root, recoverableErrors, transitions, spawnedLane); } function isRenderConsistentWithExternalStores(finishedWork) { @@ -30661,7 +30735,7 @@ function isRenderConsistentWithExternalStores(finishedWork) { return true; } -function markRootSuspended(root, suspendedLanes) { +function markRootSuspended(root, suspendedLanes, spawnedLane) { // When suspending, we should always exclude lanes that were pinged or (more // rarely, since we try to avoid it) updated during the render phase. // TODO: Lol maybe there's a better way to factor this besides this @@ -30671,7 +30745,7 @@ function markRootSuspended(root, suspendedLanes) { suspendedLanes, workInProgressRootInterleavedUpdatedLanes ); - markRootSuspended$1(root, suspendedLanes); + markRootSuspended$1(root, suspendedLanes, spawnedLane); } // This is the entry point for synchronous tasks that don't go // through Scheduler @@ -30723,7 +30797,7 @@ function performSyncWorkOnRoot(root, lanes) { if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); throw fatalError; } @@ -30732,7 +30806,7 @@ function performSyncWorkOnRoot(root, lanes) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); return null; } // We now have a consistent tree. Because this is a sync render, we @@ -30744,7 +30818,8 @@ function performSyncWorkOnRoot(root, lanes) { commitRoot( root, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane ); // Before exiting, make sure there's a callback scheduled for the next // pending level. @@ -30906,6 +30981,7 @@ function prepareFreshStack(root, lanes) { workInProgressRootSkippedLanes = NoLanes; workInProgressRootInterleavedUpdatedLanes = NoLanes; workInProgressRootPingedLanes = NoLanes; + workInProgressDeferredLane = NoLane; workInProgressRootConcurrentErrors = null; workInProgressRootRecoverableErrors = null; // Get the lanes that are entangled with whatever we're about to render. We // track these separately so we can distinguish the priority of the render @@ -31148,9 +31224,9 @@ function renderDidSuspendDelayIfPossible() { // this render. if ( - workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || - includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) + includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) && + workInProgressRoot !== null ) { // Mark the current render as suspended so that we switch to working on // the updates that were skipped. Usually we only suspend at the end of @@ -31161,8 +31237,11 @@ function renderDidSuspendDelayIfPossible() { // pinged or updated while we were rendering. // TODO: Consider unwinding immediately, using the // SuspendedOnHydration mechanism. - // $FlowFixMe[incompatible-call] need null check workInProgressRoot - markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes); + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } } function renderDidError(error) { @@ -31936,7 +32015,7 @@ function unwindUnitOfWork(unitOfWork) { workInProgress = null; } -function commitRoot(root, recoverableErrors, transitions) { +function commitRoot(root, recoverableErrors, transitions, spawnedLane) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. var previousUpdateLanePriority = getCurrentUpdatePriority(); @@ -31949,7 +32028,8 @@ function commitRoot(root, recoverableErrors, transitions) { root, recoverableErrors, transitions, - previousUpdateLanePriority + previousUpdateLanePriority, + spawnedLane ); } finally { ReactCurrentBatchConfig$1.transition = prevTransition; @@ -31963,7 +32043,8 @@ function commitRootImpl( root, recoverableErrors, transitions, - renderPriorityLevel + renderPriorityLevel, + spawnedLane ) { do { // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which @@ -32038,7 +32119,7 @@ function commitRootImpl( var concurrentlyUpdatedLanes = getConcurrentlyUpdatedLanes(); remainingLanes = mergeLanes(remainingLanes, concurrentlyUpdatedLanes); - markRootFinished(root, remainingLanes); + markRootFinished(root, remainingLanes, spawnedLane); if (root === workInProgressRoot) { // We can reset these now that they are finished. @@ -34533,7 +34614,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-a28e1532"; +var ReactVersion = "18.3.0-www-modern-eba2410d"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOMTesting-prod.classic.js b/compiled/facebook-www/ReactDOMTesting-prod.classic.js index c01a5d8c42..6cbee82050 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.classic.js @@ -434,7 +434,7 @@ function clz32Fallback(x) { } var SyncUpdateLanes = enableUnifiedSyncLane ? 42 : 2, nextTransitionLane = 128, - nextRetryLane = 8388608; + nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { if (enableUnifiedSyncLane) { var pendingSyncLanes = lanes & SyncUpdateLanes; @@ -470,13 +470,14 @@ function getHighestPriorityLanes(lanes) { case 524288: case 1048576: case 2097152: + return lanes & 4194176; case 4194304: - return lanes & 8388480; case 8388608: case 16777216: case 33554432: + return lanes & 62914560; case 67108864: - return lanes & 125829120; + return 67108864; case 134217728: return 134217728; case 268435456: @@ -484,7 +485,7 @@ function getHighestPriorityLanes(lanes) { case 536870912: return 536870912; case 1073741824: - return 1073741824; + return 0; default: return lanes; } @@ -495,7 +496,7 @@ function getNextLanes(root, wipLanes) { var nextLanes = 0, suspendedLanes = root.suspendedLanes; root = root.pingedLanes; - var nonIdlePendingLanes = pendingLanes & 268435455; + var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes @@ -514,7 +515,7 @@ function getNextLanes(root, wipLanes) { ((suspendedLanes = nextLanes & -nextLanes), (root = wipLanes & -wipLanes), suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 8388480))) + (32 === suspendedLanes && 0 !== (root & 4194176))) ? wipLanes : nextLanes; } @@ -543,13 +544,13 @@ function computeExpirationTime(lane, currentTime) { case 524288: case 1048576: case 2097152: - case 4194304: return currentTime + 5e3; + case 4194304: case 8388608: case 16777216: case 33554432: - case 67108864: return -1; + case 67108864: case 134217728: case 268435456: case 536870912: @@ -561,22 +562,16 @@ function computeExpirationTime(lane, currentTime) { } function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) return 0; - root = root.pendingLanes & -1073741825; - return 0 !== root ? root : root & 1073741824 ? 1073741824 : 0; + root = root.pendingLanes & -536870913; + return 0 !== root ? root : root & 536870912 ? 536870912 : 0; } function includesBlockingLane(root, lanes) { return 0 !== (root.current.mode & 32) ? !1 : 0 !== (lanes & 60); } -function claimNextTransitionLane() { - var lane = nextTransitionLane; - nextTransitionLane <<= 1; - 0 === (nextTransitionLane & 8388480) && (nextTransitionLane = 128); - return lane; -} function claimNextRetryLane() { var lane = nextRetryLane; nextRetryLane <<= 1; - 0 === (nextRetryLane & 125829120) && (nextRetryLane = 8388608); + 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304); return lane; } function createLaneMap(initial) { @@ -585,10 +580,10 @@ function createLaneMap(initial) { } function markRootUpdated(root, updateLane) { root.pendingLanes |= updateLane; - 536870912 !== updateLane && + 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0)); } -function markRootFinished(root, remainingLanes) { +function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; @@ -598,24 +593,37 @@ function markRootFinished(root, remainingLanes) { root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; remainingLanes = root.entanglements; - var expirationTimes = root.expirationTimes; - for (root = root.hiddenUpdates; 0 < noLongerPendingLanes; ) { + for ( + var expirationTimes = root.expirationTimes, + hiddenUpdates = root.hiddenUpdates; + 0 < noLongerPendingLanes; + + ) { var index$4 = 31 - clz32(noLongerPendingLanes), lane = 1 << index$4; remainingLanes[index$4] = 0; expirationTimes[index$4] = -1; - var hiddenUpdatesForLane = root[index$4]; + var hiddenUpdatesForLane = hiddenUpdates[index$4]; if (null !== hiddenUpdatesForLane) for ( - root[index$4] = null, index$4 = 0; + hiddenUpdates[index$4] = null, index$4 = 0; index$4 < hiddenUpdatesForLane.length; index$4++ ) { var update = hiddenUpdatesForLane[index$4]; - null !== update && (update.lane &= -1073741825); + null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; } + 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); +} +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; + var spawnedLaneIndex = 31 - clz32(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] = + root.entanglements[spawnedLaneIndex] | 1073741824 | entangledLanes; } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); @@ -672,9 +680,9 @@ function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes ? 8 < lanes - ? 0 !== (lanes & 268435455) + ? 0 !== (lanes & 134217727) ? 32 - : 536870912 + : 268435456 : 8 : 2; } @@ -1724,7 +1732,7 @@ function tryHydrateSuspense(fiber, nextInstance) { (fiber.memoizedState = { dehydrated: nextInstance, treeContext: instance, - retryLane: 1073741824 + retryLane: 536870912 }), (instance = createFiber(18, null, null, 0)), (instance.stateNode = nextInstance), @@ -1883,7 +1891,7 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { null === sourceFiber ? (parent[isHidden] = [update]) : sourceFiber.push(update), - (update.lane = lane | 1073741824)); + (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { if (50 < nestedUpdateCount) @@ -1939,7 +1947,7 @@ function enqueueUpdate(fiber, update, lane) { } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 4194176))) { var queueLanes = fiber.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -2027,7 +2035,7 @@ function processUpdateQueue( current = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { - var updateLane = pendingQueue.lane & -1073741825, + var updateLane = pendingQueue.lane & -536870913, isHiddenUpdate = updateLane !== pendingQueue.lane; if ( isHiddenUpdate @@ -3130,7 +3138,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { prepareFreshStack(workInProgressRootRenderLanes$50, 0), markRootSuspended( workInProgressRootRenderLanes$50, - nextLanes + nextLanes, + 0 ), ensureRootIsScheduled(workInProgressRootRenderLanes$50), originallyAttemptedLanes) @@ -3138,7 +3147,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { 6 === exitStatus ? markRootSuspended( workInProgressRootRenderLanes$50, - nextLanes + nextLanes, + 0 ) : ((workInProgressRootRenderLanes$50.finishedWork = workInProgressRootRenderLanes$50.current.alternate), @@ -3147,7 +3157,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { commitRoot( workInProgressRootRenderLanes$50, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane )); } ensureRootIsScheduled(workInProgressRootRenderLanes$50); @@ -3209,7 +3220,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { var suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, - lanes = root.pendingLanes & -125829121; + lanes = root.pendingLanes & -62914561; 0 < lanes; ) { @@ -3263,7 +3274,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { case 32: suspendedLanes = NormalPriority$1; break; - case 536870912: + case 268435456: suspendedLanes = IdlePriority; break; default: @@ -3283,8 +3294,12 @@ function scheduleImmediateTask(cb) { }); } function requestTransitionLane() { - 0 === currentEventTransitionLane && - (currentEventTransitionLane = claimNextTransitionLane()); + if (0 === currentEventTransitionLane) { + var lane = nextTransitionLane; + nextTransitionLane <<= 1; + 0 === (nextTransitionLane & 4194176) && (nextTransitionLane = 128); + currentEventTransitionLane = lane; + } return currentEventTransitionLane; } var currentEntangledListeners = null, @@ -3613,7 +3628,7 @@ function updateReducerImpl(hook, current, reducer) { newBaseQueueLast = null, update = current; do { - var updateLane = update.lane & -1073741825; + var updateLane = update.lane & -536870913; if ( updateLane !== update.lane ? (workInProgressRootRenderLanes & updateLane) === updateLane @@ -3957,9 +3972,11 @@ function updateMemo(nextCreate, deps) { return nextCreate; } function mountDeferredValueImpl(hook, value, initialValue) { - return enableUseDeferredValueInitialArg && void 0 !== initialValue + return enableUseDeferredValueInitialArg && + void 0 !== initialValue && + 0 === (renderLanes & 1073741824) ? ((hook.memoizedState = initialValue), - (value = claimNextTransitionLane()), + (value = requestDeferredLane()), (currentlyRenderingFiber$1.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0), @@ -3973,7 +3990,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { (hook.memoizedState = value) ); objectIs(value, prevValue) || - ((value = claimNextTransitionLane()), + ((value = requestDeferredLane()), (currentlyRenderingFiber$1.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); @@ -4157,7 +4174,7 @@ function enqueueRenderPhaseUpdate(queue, update) { queue.pending = update; } function entangleTransitionUpdate(root, queue, lane) { - if (0 !== (lane & 8388480)) { + if (0 !== (lane & 4194176)) { var queueLanes = queue.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -5157,7 +5174,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) { null !== current && pushTransition(workInProgress, null, null), reuseHiddenContextOnStack(), pushOffscreenSuspenseHandler(workInProgress); - else if (0 !== (renderLanes & 1073741824)) + else if (0 !== (renderLanes & 536870912)) (workInProgress.memoizedState = { baseLanes: 0, cachePool: null }), null !== current && pushTransition( @@ -5171,7 +5188,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) { pushOffscreenSuspenseHandler(workInProgress); else return ( - (workInProgress.lanes = workInProgress.childLanes = 1073741824), + (workInProgress.lanes = workInProgress.childLanes = 536870912), deferHiddenOffscreenComponent( current, workInProgress, @@ -5614,7 +5631,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? (workInProgress.lanes = 2) : "$!" === current.data ? (workInProgress.lanes = 16) - : (workInProgress.lanes = 1073741824), + : (workInProgress.lanes = 536870912), null ); popSuspenseHandler(workInProgress); @@ -5664,7 +5681,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.child.memoizedState = mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress.lanes = 8388608), + (workInProgress.lanes = 4194304), current ); pushPrimaryTreeSuspenseHandler(workInProgress); @@ -5955,11 +5972,10 @@ function updateDehydratedSuspenseComponent( case 8388608: case 16777216: case 33554432: - case 67108864: digest = 64; break; - case 536870912: - digest = 268435456; + case 268435456: + digest = 134217728; break; default: digest = 0; @@ -6730,7 +6746,7 @@ function scheduleRetryEffect(workInProgress, retryQueue) { ? (workInProgress.flags |= 4) : workInProgress.flags & 16384 && ((retryQueue = - 22 !== workInProgress.tag ? claimNextRetryLane() : 1073741824), + 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), (workInProgress.lanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { @@ -7197,7 +7213,7 @@ function completeWork(current, workInProgress, renderLanes) { ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(currentResource, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); } else { if (!newProps) @@ -7218,11 +7234,11 @@ function completeWork(current, workInProgress, renderLanes) { } else 2 * now() - currentResource.renderingStartTime > workInProgressRootRenderTargetTime && - 1073741824 !== renderLanes && + 536870912 !== renderLanes && ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(currentResource, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); currentResource.isBackwards ? ((cache$120.sibling = workInProgress.child), (workInProgress.child = cache$120)) @@ -7275,7 +7291,7 @@ function completeWork(current, workInProgress, renderLanes) { (workInProgress.flags |= 8192) : newProps && (workInProgress.flags |= 8192)), newProps && 0 !== (workInProgress.mode & 1) - ? 0 !== (renderLanes & 1073741824) && + ? 0 !== (renderLanes & 536870912) && 0 === (workInProgress.flags & 128) && (bubbleProperties(workInProgress), 23 !== workInProgress.tag && @@ -10016,6 +10032,7 @@ var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, workInProgressRootPingedLanes = 0, + workInProgressDeferredLane = 0, workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, globalMostRecentFallbackTime = 0, @@ -10109,13 +10126,25 @@ function requestUpdateLane(fiber) { fiber = void 0 === fiber ? 32 : getEventPriority(fiber.type); return fiber; } +function requestDeferredLane() { + 0 === workInProgressDeferredLane && + (workInProgressDeferredLane = + 0 !== (workInProgressRootRenderLanes & 536870912) + ? 536870912 + : requestTransitionLane()); + return workInProgressDeferredLane; +} function scheduleUpdateOnFiber(root, fiber, lane) { if ( (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || null !== root.cancelPendingCommit ) prepareFreshStack(root, 0), - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); markRootUpdated(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) { if (enableTransitionTracing) { @@ -10138,7 +10167,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { (0 === (executionContext & 2) && (workInProgressRootInterleavedUpdatedLanes |= lane), 4 === workInProgressRootExitStatus && - markRootSuspended(root, workInProgressRootRenderLanes)); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + )); ensureRootIsScheduled(root); 2 === lane && 0 === executionContext && @@ -10166,7 +10199,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (0 !== exitStatus) { var renderWasConcurrent = didTimeout; do { - if (6 === exitStatus) markRootSuspended(root, lanes); + if (6 === exitStatus) markRootSuspended(root, lanes, 0); else { didTimeout = root.current.alternate; if ( @@ -10195,7 +10228,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { throw ( ((originalCallbackNode = workInProgressRootFatalError), prepareFreshStack(root, 0), - markRootSuspended(root, lanes), + markRootSuspended(root, lanes, 0), ensureRootIsScheduled(root), originalCallbackNode) ); @@ -10208,8 +10241,12 @@ function performConcurrentWorkOnRoot(root, didTimeout) { case 1: throw Error(formatProdErrorMessage(345)); case 4: - if ((lanes & 8388480) === lanes) { - markRootSuspended(renderWasConcurrent, lanes); + if ((lanes & 4194176) === lanes) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); break a; } break; @@ -10221,12 +10258,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { throw Error(formatProdErrorMessage(329)); } if ( - (lanes & 125829120) === lanes && + (lanes & 62914560) === lanes && (alwaysThrottleRetries || 3 === exitStatus) && ((exitStatus = globalMostRecentFallbackTime + 300 - now()), 10 < exitStatus) ) { - markRootSuspended(renderWasConcurrent, lanes); + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; renderWasConcurrent.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( @@ -10235,7 +10276,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ), exitStatus ); @@ -10246,7 +10288,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ); } } @@ -10296,7 +10339,8 @@ function commitRootWhenReady( finishedWork, recoverableErrors, transitions, - lanes + lanes, + spawnedLane ) { if ( 0 === (lanes & 42) && @@ -10308,10 +10352,10 @@ function commitRootWhenReady( root.cancelPendingCommit = finishedWork( commitRoot.bind(null, root, recoverableErrors, transitions) ); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, spawnedLane); return; } - commitRoot(root, recoverableErrors, transitions); + commitRoot(root, recoverableErrors, transitions, spawnedLane); } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { @@ -10347,17 +10391,23 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootSuspended(root, suspendedLanes) { +function markRootSuspended(root, suspendedLanes, spawnedLane) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for (root = root.expirationTimes; 0 < suspendedLanes; ) { - var index$3 = 31 - clz32(suspendedLanes), + for ( + var expirationTimes = root.expirationTimes, lanes = suspendedLanes; + 0 < lanes; + + ) { + var index$3 = 31 - clz32(lanes), lane = 1 << index$3; - root[index$3] = -1; - suspendedLanes &= ~lane; + expirationTimes[index$3] = -1; + lanes &= ~lane; } + 0 !== spawnedLane && + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } function batchedUpdates$1(fn, a) { var prevExecutionContext = executionContext; @@ -10429,7 +10479,8 @@ function prepareFreshStack(root, lanes) { workInProgressRootDidAttachPingListener = !1; workInProgressRootExitStatus = 0; workInProgressRootFatalError = null; - workInProgressRootPingedLanes = + workInProgressDeferredLane = + workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; @@ -10460,8 +10511,8 @@ function handleThrow(root, thrownValue) { ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = shouldRemainOnPreviousScreen() && - 0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455) + 0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) ? 2 : 3)) : thrownValue === SuspenseyCommitException @@ -10484,14 +10535,14 @@ function shouldRemainOnPreviousScreen() { var handler = suspenseHandlerStackCursor.current; return null === handler ? !0 - : (workInProgressRootRenderLanes & 8388480) === + : (workInProgressRootRenderLanes & 4194176) === workInProgressRootRenderLanes ? null === shellBoundary ? !0 : !1 - : (workInProgressRootRenderLanes & 125829120) === + : (workInProgressRootRenderLanes & 62914560) === workInProgressRootRenderLanes || - 0 !== (workInProgressRootRenderLanes & 1073741824) + 0 !== (workInProgressRootRenderLanes & 536870912) ? handler === shellBoundary : !1; } @@ -10507,10 +10558,14 @@ function pushCacheDispatcher() { } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = 4; - null === workInProgressRoot || - (0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455)) || - markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes); + (0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || + null === workInProgressRoot || + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } function renderRootSync(root, lanes) { var prevExecutionContext = executionContext; @@ -10796,7 +10851,7 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } -function commitRoot(root, recoverableErrors, transitions) { +function commitRoot(root, recoverableErrors, transitions, spawnedLane) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig$1.transition; try { @@ -10806,7 +10861,8 @@ function commitRoot(root, recoverableErrors, transitions) { root, recoverableErrors, transitions, - previousUpdateLanePriority + previousUpdateLanePriority, + spawnedLane ); } finally { (ReactCurrentBatchConfig$1.transition = prevTransition), @@ -10818,7 +10874,8 @@ function commitRootImpl( root, recoverableErrors, transitions, - renderPriorityLevel + renderPriorityLevel, + spawnedLane ) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); @@ -10834,7 +10891,7 @@ function commitRootImpl( root.cancelPendingCommit = null; var remainingLanes = finishedWork.lanes | finishedWork.childLanes; remainingLanes |= concurrentlyUpdatedLanes; - markRootFinished(root, remainingLanes); + markRootFinished(root, remainingLanes, spawnedLane); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -10852,7 +10909,7 @@ function commitRootImpl( if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { transitions = ReactCurrentBatchConfig$1.transition; ReactCurrentBatchConfig$1.transition = null; - var previousPriority = currentUpdatePriority; + spawnedLane = currentUpdatePriority; currentUpdatePriority = 2; var prevExecutionContext = executionContext; executionContext |= 4; @@ -10873,7 +10930,7 @@ function commitRootImpl( commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); requestPaint(); executionContext = prevExecutionContext; - currentUpdatePriority = previousPriority; + currentUpdatePriority = spawnedLane; ReactCurrentBatchConfig$1.transition = transitions; } else root.current = finishedWork; rootDoesHavePassiveEffects @@ -10908,7 +10965,7 @@ function commitRootImpl( 0 !== root.tag && flushPassiveEffects(); remainingLanes = root.pendingLanes; - 0 !== (lanes & 8388522) && 0 !== (remainingLanes & SyncUpdateLanes) + 0 !== (lanes & 4194218) && 0 !== (remainingLanes & SyncUpdateLanes) ? root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) @@ -11071,7 +11128,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 125829120) === + (workInProgressRootRenderLanes & 62914560) === workInProgressRootRenderLanes && 300 > now() - globalMostRecentFallbackTime) ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) @@ -12261,9 +12318,9 @@ function markRetryLaneIfNotHydrated(fiber, retryLane) { } function attemptContinuousHydration(fiber) { if (13 === fiber.tag) { - var root = enqueueConcurrentRenderForLane(fiber, 134217728); - null !== root && scheduleUpdateOnFiber(root, fiber, 134217728); - markRetryLaneIfNotHydrated(fiber, 134217728); + var root = enqueueConcurrentRenderForLane(fiber, 67108864); + null !== root && scheduleUpdateOnFiber(root, fiber, 67108864); + markRetryLaneIfNotHydrated(fiber, 67108864); } } function emptyFindFiberByHostInstance() { @@ -12802,14 +12859,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$347; if (canUseDOM) { - 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; + var isSupported$jscomp$inline_1557 = "oninput" in document; + if (!isSupported$jscomp$inline_1557) { + var element$jscomp$inline_1558 = document.createElement("div"); + element$jscomp$inline_1558.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1557 = + "function" === typeof element$jscomp$inline_1558.oninput; } - JSCompiler_inline_result$jscomp$347 = isSupported$jscomp$inline_1554; + JSCompiler_inline_result$jscomp$347 = isSupported$jscomp$inline_1557; } else JSCompiler_inline_result$jscomp$347 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$347 && @@ -13121,20 +13178,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1595 = 0; - i$jscomp$inline_1595 < simpleEventPluginEvents.length; - i$jscomp$inline_1595++ + var i$jscomp$inline_1598 = 0; + i$jscomp$inline_1598 < simpleEventPluginEvents.length; + i$jscomp$inline_1598++ ) { - 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); + var eventName$jscomp$inline_1599 = + simpleEventPluginEvents[i$jscomp$inline_1598], + domEventName$jscomp$inline_1600 = + eventName$jscomp$inline_1599.toLowerCase(), + capitalizedEvent$jscomp$inline_1601 = + eventName$jscomp$inline_1599[0].toUpperCase() + + eventName$jscomp$inline_1599.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1597, - "on" + capitalizedEvent$jscomp$inline_1598 + domEventName$jscomp$inline_1600, + "on" + capitalizedEvent$jscomp$inline_1601 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16519,7 +16576,7 @@ function getEventPriority(domEventName) { case LowPriority: return 32; case IdlePriority: - return 536870912; + return 268435456; default: return 32; } @@ -16731,17 +16788,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1821 = { +var devToolsConfig$jscomp$inline_1824 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-b6ac59ca", + version: "18.3.0-www-classic-8c719f5e", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2172 = { - bundleType: devToolsConfig$jscomp$inline_1821.bundleType, - version: devToolsConfig$jscomp$inline_1821.version, - rendererPackageName: devToolsConfig$jscomp$inline_1821.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1821.rendererConfig, +var internals$jscomp$inline_2175 = { + bundleType: devToolsConfig$jscomp$inline_1824.bundleType, + version: devToolsConfig$jscomp$inline_1824.version, + rendererPackageName: devToolsConfig$jscomp$inline_1824.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1824.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16757,26 +16814,26 @@ var internals$jscomp$inline_2172 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1821.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1824.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-b6ac59ca" + reconcilerVersion: "18.3.0-www-classic-8c719f5e" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2173 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2176 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2173.isDisabled && - hook$jscomp$inline_2173.supportsFiber + !hook$jscomp$inline_2176.isDisabled && + hook$jscomp$inline_2176.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2173.inject( - internals$jscomp$inline_2172 + (rendererID = hook$jscomp$inline_2176.inject( + internals$jscomp$inline_2175 )), - (injectedHook = hook$jscomp$inline_2173); + (injectedHook = hook$jscomp$inline_2176); } catch (err) {} } assign(Internals, { @@ -17252,4 +17309,4 @@ exports.useFormState = function () { exports.useFormStatus = function () { throw Error(formatProdErrorMessage(248)); }; -exports.version = "18.3.0-www-classic-b6ac59ca"; +exports.version = "18.3.0-www-classic-8c719f5e"; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.modern.js b/compiled/facebook-www/ReactDOMTesting-prod.modern.js index 7046782dc8..127b8de513 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.modern.js @@ -196,7 +196,7 @@ function clz32Fallback(x) { } var SyncUpdateLanes = enableUnifiedSyncLane ? 42 : 2, nextTransitionLane = 128, - nextRetryLane = 8388608; + nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { if (enableUnifiedSyncLane) { var pendingSyncLanes = lanes & SyncUpdateLanes; @@ -232,13 +232,14 @@ function getHighestPriorityLanes(lanes) { case 524288: case 1048576: case 2097152: + return lanes & 4194176; case 4194304: - return lanes & 8388480; case 8388608: case 16777216: case 33554432: + return lanes & 62914560; case 67108864: - return lanes & 125829120; + return 67108864; case 134217728: return 134217728; case 268435456: @@ -246,7 +247,7 @@ function getHighestPriorityLanes(lanes) { case 536870912: return 536870912; case 1073741824: - return 1073741824; + return 0; default: return lanes; } @@ -257,7 +258,7 @@ function getNextLanes(root, wipLanes) { var nextLanes = 0, suspendedLanes = root.suspendedLanes; root = root.pingedLanes; - var nonIdlePendingLanes = pendingLanes & 268435455; + var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes @@ -276,7 +277,7 @@ function getNextLanes(root, wipLanes) { ((suspendedLanes = nextLanes & -nextLanes), (root = wipLanes & -wipLanes), suspendedLanes >= root || - (32 === suspendedLanes && 0 !== (root & 8388480))) + (32 === suspendedLanes && 0 !== (root & 4194176))) ? wipLanes : nextLanes; } @@ -305,13 +306,13 @@ function computeExpirationTime(lane, currentTime) { case 524288: case 1048576: case 2097152: - case 4194304: return currentTime + 5e3; + case 4194304: case 8388608: case 16777216: case 33554432: - case 67108864: return -1; + case 67108864: case 134217728: case 268435456: case 536870912: @@ -323,22 +324,16 @@ function computeExpirationTime(lane, currentTime) { } function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) return 0; - root = root.pendingLanes & -1073741825; - return 0 !== root ? root : root & 1073741824 ? 1073741824 : 0; + root = root.pendingLanes & -536870913; + return 0 !== root ? root : root & 536870912 ? 536870912 : 0; } function includesBlockingLane(root, lanes) { return 0 !== (root.current.mode & 32) ? !1 : 0 !== (lanes & 60); } -function claimNextTransitionLane() { - var lane = nextTransitionLane; - nextTransitionLane <<= 1; - 0 === (nextTransitionLane & 8388480) && (nextTransitionLane = 128); - return lane; -} function claimNextRetryLane() { var lane = nextRetryLane; nextRetryLane <<= 1; - 0 === (nextRetryLane & 125829120) && (nextRetryLane = 8388608); + 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304); return lane; } function createLaneMap(initial) { @@ -347,10 +342,10 @@ function createLaneMap(initial) { } function markRootUpdated(root, updateLane) { root.pendingLanes |= updateLane; - 536870912 !== updateLane && + 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0)); } -function markRootFinished(root, remainingLanes) { +function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; @@ -360,24 +355,37 @@ function markRootFinished(root, remainingLanes) { root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; remainingLanes = root.entanglements; - var expirationTimes = root.expirationTimes; - for (root = root.hiddenUpdates; 0 < noLongerPendingLanes; ) { + for ( + var expirationTimes = root.expirationTimes, + hiddenUpdates = root.hiddenUpdates; + 0 < noLongerPendingLanes; + + ) { var index$3 = 31 - clz32(noLongerPendingLanes), lane = 1 << index$3; remainingLanes[index$3] = 0; expirationTimes[index$3] = -1; - var hiddenUpdatesForLane = root[index$3]; + var hiddenUpdatesForLane = hiddenUpdates[index$3]; if (null !== hiddenUpdatesForLane) for ( - root[index$3] = null, index$3 = 0; + hiddenUpdates[index$3] = null, index$3 = 0; index$3 < hiddenUpdatesForLane.length; index$3++ ) { var update = hiddenUpdatesForLane[index$3]; - null !== update && (update.lane &= -1073741825); + null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; } + 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); +} +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; + var spawnedLaneIndex = 31 - clz32(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] = + root.entanglements[spawnedLaneIndex] | 1073741824 | entangledLanes; } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); @@ -434,9 +442,9 @@ function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes ? 8 < lanes - ? 0 !== (lanes & 268435455) + ? 0 !== (lanes & 134217727) ? 32 - : 536870912 + : 268435456 : 8 : 2; } @@ -1672,7 +1680,7 @@ function tryHydrateSuspense(fiber, nextInstance) { (fiber.memoizedState = { dehydrated: nextInstance, treeContext: instance, - retryLane: 1073741824 + retryLane: 536870912 }), (instance = createFiber(18, null, null, 0)), (instance.stateNode = nextInstance), @@ -1831,7 +1839,7 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { null === sourceFiber ? (parent[isHidden] = [update]) : sourceFiber.push(update), - (update.lane = lane | 1073741824)); + (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { if (50 < nestedUpdateCount) @@ -1887,7 +1895,7 @@ function enqueueUpdate(fiber, update, lane) { } function entangleTransitions(root, fiber, lane) { fiber = fiber.updateQueue; - if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 8388480))) { + if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 4194176))) { var queueLanes = fiber.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -1975,7 +1983,7 @@ function processUpdateQueue( current = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { - var updateLane = pendingQueue.lane & -1073741825, + var updateLane = pendingQueue.lane & -536870913, isHiddenUpdate = updateLane !== pendingQueue.lane; if ( isHiddenUpdate @@ -3078,7 +3086,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { prepareFreshStack(workInProgressRootRenderLanes$50, 0), markRootSuspended( workInProgressRootRenderLanes$50, - nextLanes + nextLanes, + 0 ), ensureRootIsScheduled(workInProgressRootRenderLanes$50), originallyAttemptedLanes) @@ -3086,7 +3095,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { 6 === exitStatus ? markRootSuspended( workInProgressRootRenderLanes$50, - nextLanes + nextLanes, + 0 ) : ((workInProgressRootRenderLanes$50.finishedWork = workInProgressRootRenderLanes$50.current.alternate), @@ -3095,7 +3105,8 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { commitRoot( workInProgressRootRenderLanes$50, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane )); } ensureRootIsScheduled(workInProgressRootRenderLanes$50); @@ -3157,7 +3168,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { var suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, - lanes = root.pendingLanes & -125829121; + lanes = root.pendingLanes & -62914561; 0 < lanes; ) { @@ -3211,7 +3222,7 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { case 32: suspendedLanes = NormalPriority$1; break; - case 536870912: + case 268435456: suspendedLanes = IdlePriority; break; default: @@ -3231,8 +3242,12 @@ function scheduleImmediateTask(cb) { }); } function requestTransitionLane() { - 0 === currentEventTransitionLane && - (currentEventTransitionLane = claimNextTransitionLane()); + if (0 === currentEventTransitionLane) { + var lane = nextTransitionLane; + nextTransitionLane <<= 1; + 0 === (nextTransitionLane & 4194176) && (nextTransitionLane = 128); + currentEventTransitionLane = lane; + } return currentEventTransitionLane; } var currentEntangledListeners = null, @@ -3561,7 +3576,7 @@ function updateReducerImpl(hook, current, reducer) { newBaseQueueLast = null, update = current; do { - var updateLane = update.lane & -1073741825; + var updateLane = update.lane & -536870913; if ( updateLane !== update.lane ? (workInProgressRootRenderLanes & updateLane) === updateLane @@ -3905,9 +3920,11 @@ function updateMemo(nextCreate, deps) { return nextCreate; } function mountDeferredValueImpl(hook, value, initialValue) { - return enableUseDeferredValueInitialArg && void 0 !== initialValue + return enableUseDeferredValueInitialArg && + void 0 !== initialValue && + 0 === (renderLanes & 1073741824) ? ((hook.memoizedState = initialValue), - (value = claimNextTransitionLane()), + (value = requestDeferredLane()), (currentlyRenderingFiber$1.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0), @@ -3921,7 +3938,7 @@ function updateDeferredValueImpl(hook, prevValue, value) { (hook.memoizedState = value) ); objectIs(value, prevValue) || - ((value = claimNextTransitionLane()), + ((value = requestDeferredLane()), (currentlyRenderingFiber$1.lanes |= value), (workInProgressRootSkippedLanes |= value), (hook.baseState = !0)); @@ -4105,7 +4122,7 @@ function enqueueRenderPhaseUpdate(queue, update) { queue.pending = update; } function entangleTransitionUpdate(root, queue, lane) { - if (0 !== (lane & 8388480)) { + if (0 !== (lane & 4194176)) { var queueLanes = queue.lanes; queueLanes &= root.pendingLanes; lane |= queueLanes; @@ -5090,7 +5107,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) { null !== current && pushTransition(workInProgress, null, null), reuseHiddenContextOnStack(), pushOffscreenSuspenseHandler(workInProgress); - else if (0 !== (renderLanes & 1073741824)) + else if (0 !== (renderLanes & 536870912)) (workInProgress.memoizedState = { baseLanes: 0, cachePool: null }), null !== current && pushTransition( @@ -5104,7 +5121,7 @@ function updateOffscreenComponent(current, workInProgress, renderLanes) { pushOffscreenSuspenseHandler(workInProgress); else return ( - (workInProgress.lanes = workInProgress.childLanes = 1073741824), + (workInProgress.lanes = workInProgress.childLanes = 536870912), deferHiddenOffscreenComponent( current, workInProgress, @@ -5515,7 +5532,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? (workInProgress.lanes = 2) : "$!" === current.data ? (workInProgress.lanes = 16) - : (workInProgress.lanes = 1073741824), + : (workInProgress.lanes = 536870912), null ); popSuspenseHandler(workInProgress); @@ -5565,7 +5582,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (workInProgress.child.memoizedState = mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress.lanes = 8388608), + (workInProgress.lanes = 4194304), current ); pushPrimaryTreeSuspenseHandler(workInProgress); @@ -5856,11 +5873,10 @@ function updateDehydratedSuspenseComponent( case 8388608: case 16777216: case 33554432: - case 67108864: digest = 64; break; - case 536870912: - digest = 268435456; + case 268435456: + digest = 134217728; break; default: digest = 0; @@ -6627,7 +6643,7 @@ function scheduleRetryEffect(workInProgress, retryQueue) { ? (workInProgress.flags |= 4) : workInProgress.flags & 16384 && ((retryQueue = - 22 !== workInProgress.tag ? claimNextRetryLane() : 1073741824), + 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912), (workInProgress.lanes |= retryQueue)); } function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { @@ -7084,7 +7100,7 @@ function completeWork(current, workInProgress, renderLanes) { ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(currentResource, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); } else { if (!newProps) @@ -7105,11 +7121,11 @@ function completeWork(current, workInProgress, renderLanes) { } else 2 * now() - currentResource.renderingStartTime > workInProgressRootRenderTargetTime && - 1073741824 !== renderLanes && + 536870912 !== renderLanes && ((workInProgress.flags |= 128), (newProps = !0), cutOffTailIfNeeded(currentResource, !1), - (workInProgress.lanes = 8388608)); + (workInProgress.lanes = 4194304)); currentResource.isBackwards ? ((cache$120.sibling = workInProgress.child), (workInProgress.child = cache$120)) @@ -7162,7 +7178,7 @@ function completeWork(current, workInProgress, renderLanes) { (workInProgress.flags |= 8192) : newProps && (workInProgress.flags |= 8192)), newProps && 0 !== (workInProgress.mode & 1) - ? 0 !== (renderLanes & 1073741824) && + ? 0 !== (renderLanes & 536870912) && 0 === (workInProgress.flags & 128) && (bubbleProperties(workInProgress), 23 !== workInProgress.tag && @@ -9907,6 +9923,7 @@ var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, workInProgressRootPingedLanes = 0, + workInProgressDeferredLane = 0, workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, globalMostRecentFallbackTime = 0, @@ -10000,13 +10017,25 @@ function requestUpdateLane(fiber) { fiber = void 0 === fiber ? 32 : getEventPriority(fiber.type); return fiber; } +function requestDeferredLane() { + 0 === workInProgressDeferredLane && + (workInProgressDeferredLane = + 0 !== (workInProgressRootRenderLanes & 536870912) + ? 536870912 + : requestTransitionLane()); + return workInProgressDeferredLane; +} function scheduleUpdateOnFiber(root, fiber, lane) { if ( (root === workInProgressRoot && 2 === workInProgressSuspendedReason) || null !== root.cancelPendingCommit ) prepareFreshStack(root, 0), - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); markRootUpdated(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) { if (enableTransitionTracing) { @@ -10029,7 +10058,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { (0 === (executionContext & 2) && (workInProgressRootInterleavedUpdatedLanes |= lane), 4 === workInProgressRootExitStatus && - markRootSuspended(root, workInProgressRootRenderLanes)); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + )); ensureRootIsScheduled(root); 2 === lane && 0 === executionContext && @@ -10057,7 +10090,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (0 !== exitStatus) { var renderWasConcurrent = didTimeout; do { - if (6 === exitStatus) markRootSuspended(root, lanes); + if (6 === exitStatus) markRootSuspended(root, lanes, 0); else { didTimeout = root.current.alternate; if ( @@ -10086,7 +10119,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { throw ( ((originalCallbackNode = workInProgressRootFatalError), prepareFreshStack(root, 0), - markRootSuspended(root, lanes), + markRootSuspended(root, lanes, 0), ensureRootIsScheduled(root), originalCallbackNode) ); @@ -10099,8 +10132,12 @@ function performConcurrentWorkOnRoot(root, didTimeout) { case 1: throw Error(formatProdErrorMessage(345)); case 4: - if ((lanes & 8388480) === lanes) { - markRootSuspended(renderWasConcurrent, lanes); + if ((lanes & 4194176) === lanes) { + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); break a; } break; @@ -10112,12 +10149,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { throw Error(formatProdErrorMessage(329)); } if ( - (lanes & 125829120) === lanes && + (lanes & 62914560) === lanes && (alwaysThrottleRetries || 3 === exitStatus) && ((exitStatus = globalMostRecentFallbackTime + 300 - now()), 10 < exitStatus) ) { - markRootSuspended(renderWasConcurrent, lanes); + markRootSuspended( + renderWasConcurrent, + lanes, + workInProgressDeferredLane + ); if (0 !== getNextLanes(renderWasConcurrent, 0)) break a; renderWasConcurrent.timeoutHandle = scheduleTimeout( commitRootWhenReady.bind( @@ -10126,7 +10167,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ), exitStatus ); @@ -10137,7 +10179,8 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ); } } @@ -10187,7 +10230,8 @@ function commitRootWhenReady( finishedWork, recoverableErrors, transitions, - lanes + lanes, + spawnedLane ) { if ( 0 === (lanes & 42) && @@ -10199,10 +10243,10 @@ function commitRootWhenReady( root.cancelPendingCommit = finishedWork( commitRoot.bind(null, root, recoverableErrors, transitions) ); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, spawnedLane); return; } - commitRoot(root, recoverableErrors, transitions); + commitRoot(root, recoverableErrors, transitions, spawnedLane); } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { @@ -10238,17 +10282,23 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootSuspended(root, suspendedLanes) { +function markRootSuspended(root, suspendedLanes, spawnedLane) { suspendedLanes &= ~workInProgressRootPingedLanes; suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; - for (root = root.expirationTimes; 0 < suspendedLanes; ) { - var index$2 = 31 - clz32(suspendedLanes), + for ( + var expirationTimes = root.expirationTimes, lanes = suspendedLanes; + 0 < lanes; + + ) { + var index$2 = 31 - clz32(lanes), lane = 1 << index$2; - root[index$2] = -1; - suspendedLanes &= ~lane; + expirationTimes[index$2] = -1; + lanes &= ~lane; } + 0 !== spawnedLane && + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } function batchedUpdates$1(fn, a) { var prevExecutionContext = executionContext; @@ -10320,7 +10370,8 @@ function prepareFreshStack(root, lanes) { workInProgressRootDidAttachPingListener = !1; workInProgressRootExitStatus = 0; workInProgressRootFatalError = null; - workInProgressRootPingedLanes = + workInProgressDeferredLane = + workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; @@ -10351,8 +10402,8 @@ function handleThrow(root, thrownValue) { ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = shouldRemainOnPreviousScreen() && - 0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455) + 0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727) ? 2 : 3)) : thrownValue === SuspenseyCommitException @@ -10375,14 +10426,14 @@ function shouldRemainOnPreviousScreen() { var handler = suspenseHandlerStackCursor.current; return null === handler ? !0 - : (workInProgressRootRenderLanes & 8388480) === + : (workInProgressRootRenderLanes & 4194176) === workInProgressRootRenderLanes ? null === shellBoundary ? !0 : !1 - : (workInProgressRootRenderLanes & 125829120) === + : (workInProgressRootRenderLanes & 62914560) === workInProgressRootRenderLanes || - 0 !== (workInProgressRootRenderLanes & 1073741824) + 0 !== (workInProgressRootRenderLanes & 536870912) ? handler === shellBoundary : !1; } @@ -10398,10 +10449,14 @@ function pushCacheDispatcher() { } function renderDidSuspendDelayIfPossible() { workInProgressRootExitStatus = 4; - null === workInProgressRoot || - (0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455)) || - markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes); + (0 === (workInProgressRootSkippedLanes & 134217727) && + 0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) || + null === workInProgressRoot || + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } function renderRootSync(root, lanes) { var prevExecutionContext = executionContext; @@ -10683,7 +10738,7 @@ function completeUnitOfWork(unitOfWork) { } while (null !== completedWork); 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } -function commitRoot(root, recoverableErrors, transitions) { +function commitRoot(root, recoverableErrors, transitions, spawnedLane) { var previousUpdateLanePriority = currentUpdatePriority, prevTransition = ReactCurrentBatchConfig$1.transition; try { @@ -10693,7 +10748,8 @@ function commitRoot(root, recoverableErrors, transitions) { root, recoverableErrors, transitions, - previousUpdateLanePriority + previousUpdateLanePriority, + spawnedLane ); } finally { (ReactCurrentBatchConfig$1.transition = prevTransition), @@ -10705,7 +10761,8 @@ function commitRootImpl( root, recoverableErrors, transitions, - renderPriorityLevel + renderPriorityLevel, + spawnedLane ) { do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); @@ -10721,7 +10778,7 @@ function commitRootImpl( root.cancelPendingCommit = null; var remainingLanes = finishedWork.lanes | finishedWork.childLanes; remainingLanes |= concurrentlyUpdatedLanes; - markRootFinished(root, remainingLanes); + markRootFinished(root, remainingLanes, spawnedLane); root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -10739,7 +10796,7 @@ function commitRootImpl( if (0 !== (finishedWork.subtreeFlags & 15990) || transitions) { transitions = ReactCurrentBatchConfig$1.transition; ReactCurrentBatchConfig$1.transition = null; - var previousPriority = currentUpdatePriority; + spawnedLane = currentUpdatePriority; currentUpdatePriority = 2; var prevExecutionContext = executionContext; executionContext |= 4; @@ -10760,7 +10817,7 @@ function commitRootImpl( commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); requestPaint(); executionContext = prevExecutionContext; - currentUpdatePriority = previousPriority; + currentUpdatePriority = spawnedLane; ReactCurrentBatchConfig$1.transition = transitions; } else root.current = finishedWork; rootDoesHavePassiveEffects @@ -10795,7 +10852,7 @@ function commitRootImpl( 0 !== root.tag && flushPassiveEffects(); remainingLanes = root.pendingLanes; - 0 !== (lanes & 8388522) && 0 !== (remainingLanes & SyncUpdateLanes) + 0 !== (lanes & 4194218) && 0 !== (remainingLanes & SyncUpdateLanes) ? root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) @@ -10958,7 +11015,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || (3 === workInProgressRootExitStatus && - (workInProgressRootRenderLanes & 125829120) === + (workInProgressRootRenderLanes & 62914560) === workInProgressRootRenderLanes && 300 > now() - globalMostRecentFallbackTime) ? 0 === (executionContext & 2) && prepareFreshStack(root, 0) @@ -12032,9 +12089,9 @@ function markRetryLaneIfNotHydrated(fiber, retryLane) { } function attemptContinuousHydration(fiber) { if (13 === fiber.tag) { - var root = enqueueConcurrentRenderForLane(fiber, 134217728); - null !== root && scheduleUpdateOnFiber(root, fiber, 134217728); - markRetryLaneIfNotHydrated(fiber, 134217728); + var root = enqueueConcurrentRenderForLane(fiber, 67108864); + null !== root && scheduleUpdateOnFiber(root, fiber, 67108864); + markRetryLaneIfNotHydrated(fiber, 67108864); } } function emptyFindFiberByHostInstance() { @@ -12894,7 +12951,7 @@ function getEventPriority(domEventName) { case LowPriority: return 32; case IdlePriority: - return 536870912; + return 268435456; default: return 32; } @@ -13097,14 +13154,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$345; if (canUseDOM) { - var isSupported$jscomp$inline_1553 = "oninput" in document; - if (!isSupported$jscomp$inline_1553) { - var element$jscomp$inline_1554 = document.createElement("div"); - element$jscomp$inline_1554.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1553 = - "function" === typeof element$jscomp$inline_1554.oninput; + var isSupported$jscomp$inline_1556 = "oninput" in document; + if (!isSupported$jscomp$inline_1556) { + var element$jscomp$inline_1557 = document.createElement("div"); + element$jscomp$inline_1557.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1556 = + "function" === typeof element$jscomp$inline_1557.oninput; } - JSCompiler_inline_result$jscomp$345 = isSupported$jscomp$inline_1553; + JSCompiler_inline_result$jscomp$345 = isSupported$jscomp$inline_1556; } else JSCompiler_inline_result$jscomp$345 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$345 && @@ -13416,20 +13473,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1594 = 0; - i$jscomp$inline_1594 < simpleEventPluginEvents.length; - i$jscomp$inline_1594++ + var i$jscomp$inline_1597 = 0; + i$jscomp$inline_1597 < simpleEventPluginEvents.length; + i$jscomp$inline_1597++ ) { - var eventName$jscomp$inline_1595 = - simpleEventPluginEvents[i$jscomp$inline_1594], - domEventName$jscomp$inline_1596 = - eventName$jscomp$inline_1595.toLowerCase(), - capitalizedEvent$jscomp$inline_1597 = - eventName$jscomp$inline_1595[0].toUpperCase() + - eventName$jscomp$inline_1595.slice(1); + var eventName$jscomp$inline_1598 = + simpleEventPluginEvents[i$jscomp$inline_1597], + domEventName$jscomp$inline_1599 = + eventName$jscomp$inline_1598.toLowerCase(), + capitalizedEvent$jscomp$inline_1600 = + eventName$jscomp$inline_1598[0].toUpperCase() + + eventName$jscomp$inline_1598.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1596, - "on" + capitalizedEvent$jscomp$inline_1597 + domEventName$jscomp$inline_1599, + "on" + capitalizedEvent$jscomp$inline_1600 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16308,17 +16365,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1780 = { +var devToolsConfig$jscomp$inline_1783 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-a6764733", + version: "18.3.0-www-modern-f61d9097", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2136 = { - bundleType: devToolsConfig$jscomp$inline_1780.bundleType, - version: devToolsConfig$jscomp$inline_1780.version, - rendererPackageName: devToolsConfig$jscomp$inline_1780.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1780.rendererConfig, +var internals$jscomp$inline_2139 = { + bundleType: devToolsConfig$jscomp$inline_1783.bundleType, + version: devToolsConfig$jscomp$inline_1783.version, + rendererPackageName: devToolsConfig$jscomp$inline_1783.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1783.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16335,26 +16392,26 @@ var internals$jscomp$inline_2136 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1780.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1783.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-a6764733" + reconcilerVersion: "18.3.0-www-modern-f61d9097" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2137 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2140 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2137.isDisabled && - hook$jscomp$inline_2137.supportsFiber + !hook$jscomp$inline_2140.isDisabled && + hook$jscomp$inline_2140.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2137.inject( - internals$jscomp$inline_2136 + (rendererID = hook$jscomp$inline_2140.inject( + internals$jscomp$inline_2139 )), - (injectedHook = hook$jscomp$inline_2137); + (injectedHook = hook$jscomp$inline_2140); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; @@ -16758,4 +16815,4 @@ exports.useFormState = function () { exports.useFormStatus = function () { throw Error(formatProdErrorMessage(248)); }; -exports.version = "18.3.0-www-modern-a6764733"; +exports.version = "18.3.0-www-modern-f61d9097"; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.classic.js b/compiled/facebook-www/ReactTestRenderer-dev.classic.js index adb0ab4b4c..23e8baed1d 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.classic.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.classic.js @@ -1174,7 +1174,7 @@ var TransitionHydrationLane = 64; var TransitionLanes = /* */ - 8388480; + 4194176; var TransitionLane1 = /* */ 128; @@ -1220,39 +1220,39 @@ var TransitionLane14 = var TransitionLane15 = /* */ 2097152; -var TransitionLane16 = - /* */ - 4194304; var RetryLanes = /* */ - 125829120; + 62914560; var RetryLane1 = /* */ - 8388608; + 4194304; var RetryLane2 = /* */ - 16777216; + 8388608; var RetryLane3 = /* */ - 33554432; + 16777216; var RetryLane4 = /* */ - 67108864; + 33554432; var SomeRetryLane = RetryLane1; var SelectiveHydrationLane = /* */ - 134217728; + 67108864; var NonIdleLanes = /* */ - 268435455; + 134217727; var IdleHydrationLane = /* */ - 268435456; + 134217728; var IdleLane = /* */ - 536870912; + 268435456; var OffscreenLane = /* */ + 536870912; +var DeferredLane = + /* */ 1073741824; // Any lane that might schedule an update. This is used to detect infinite // update loops, so it doesn't include hydration lanes or retries. @@ -1300,7 +1300,6 @@ function getHighestPriorityLanes(lanes) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: return lanes & TransitionLanes; case RetryLane1: @@ -1321,6 +1320,11 @@ function getHighestPriorityLanes(lanes) { case OffscreenLane: return OffscreenLane; + case DeferredLane: + // This shouldn't be reachable because deferred work is always entangled + // with something else. + return NoLanes; + default: { error("Should have found matching lanes. This is a bug in React."); @@ -1487,7 +1491,6 @@ function computeExpirationTime(lane, currentTime) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: return currentTime + 5000; case RetryLane1: @@ -1505,6 +1508,7 @@ function computeExpirationTime(lane, currentTime) { case IdleHydrationLane: case IdleLane: case OffscreenLane: + case DeferredLane: // Anything idle priority or lower should never expire. return NoTimestamp; @@ -1708,7 +1712,7 @@ function markRootUpdated(root, updateLane) { root.pingedLanes = NoLanes; } } -function markRootSuspended$1(root, suspendedLanes) { +function markRootSuspended$1(root, suspendedLanes, spawnedLane) { root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. @@ -1721,11 +1725,15 @@ function markRootSuspended$1(root, suspendedLanes) { expirationTimes[index] = NoTimestamp; lanes &= ~lane; } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); + } } function markRootPinged(root, pingedLanes) { root.pingedLanes |= root.suspendedLanes & pingedLanes; } -function markRootFinished(root, remainingLanes) { +function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; // Let's try everything again @@ -1765,7 +1773,32 @@ function markRootFinished(root, remainingLanes) { lanes &= ~lane; } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane( + root, + spawnedLane, // This render finished successfully without suspending, so we don't need + // to entangle the spawned task with the parent task. + NoLanes + ); + } +} + +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + // This render spawned a deferred task. Mark it as pending. + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; // Entangle the spawned lane with the DeferredLane bit so that we know it + // was the result of another render. This lets us avoid a useDeferredValue + // waterfall — only the first level will defer. + + var spawnedLaneIndex = laneToIndex(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] |= + DeferredLane | // If the parent render task suspended, we must also entangle those lanes + // with the spawned task. + entangledLanes; } + function markRootEntangled(root, entangledLanes) { // In addition to entangling each of the given lanes with each other, we also // have to consider _transitive_ entanglements. For each lane that is already @@ -1852,7 +1885,6 @@ function getBumpedLaneForHydration(root, renderLanes) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: case RetryLane1: case RetryLane2: case RetryLane3: @@ -8817,15 +8849,18 @@ function rerenderDeferredValue(value, initialValue) { } function mountDeferredValueImpl(hook, value, initialValue) { - if (initialValue !== undefined) { + if ( // When `initialValue` is provided, we defer the initial render even if the // current render is not synchronous. - // TODO: However, to avoid waterfalls, we should not defer if this render - // was itself spawned by an earlier useDeferredValue. Plan is to add a - // Deferred lane to track this. - hook.memoizedState = initialValue; // Schedule a deferred render + initialValue !== undefined && // However, to avoid waterfalls, we do not defer if this render + // was itself spawned by an earlier useDeferredValue. Check if DeferredLane + // is part of the render lanes. + !includesSomeLane(renderLanes, DeferredLane) + ) { + // Render with the initial value + hook.memoizedState = initialValue; // Schedule a deferred render to switch to the final value. - var deferredLane = claimNextTransitionLane(); + var deferredLane = requestDeferredLane(); currentlyRenderingFiber$1.lanes = mergeLanes( currentlyRenderingFiber$1.lanes, deferredLane @@ -8853,7 +8888,7 @@ function updateDeferredValueImpl(hook, prevValue, value, initialValue) { // previous value and spawn a deferred render to update it later. if (!objectIs(value, prevValue)) { // Schedule a deferred render - var deferredLane = claimNextTransitionLane(); + var deferredLane = requestDeferredLane(); currentlyRenderingFiber$1.lanes = mergeLanes( currentlyRenderingFiber$1.lanes, deferredLane @@ -21211,7 +21246,9 @@ var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event). -var workInProgressRootPingedLanes = NoLanes; // Errors that are thrown during the render phase. +var workInProgressRootPingedLanes = NoLanes; // If this lane scheduled deferred work, this is the lane of the deferred task. + +var workInProgressDeferredLane = NoLane; // Errors that are thrown during the render phase. var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI. // We will log them once the tree commits. @@ -21343,6 +21380,27 @@ function requestRetryLane(fiber) { return claimNextRetryLane(); } +function requestDeferredLane() { + if (workInProgressDeferredLane === NoLane) { + // If there are multiple useDeferredValue hooks in the same render, the + // tasks that they spawn should all be batched together, so they should all + // receive the same lane. + if (includesSomeLane(workInProgressRootRenderLanes, OffscreenLane)) { + // There's only one OffscreenLane, so if it contains deferred work, we + // should just reschedule using the same lane. + // TODO: We also use OffscreenLane for hydration, on the basis that the + // initial HTML is the same as the hydrated UI, but since the deferred + // task will change the UI, it should be treated like an update. Use + // TransitionHydrationLane to trigger selective hydration. + workInProgressDeferredLane = OffscreenLane; + } else { + // Everything else is spawned as a transition. + workInProgressDeferredLane = requestTransitionLane(); + } + } + + return workInProgressDeferredLane; +} function scheduleUpdateOnFiber(root, fiber, lane) { { if (isRunningInsertionEffect) { @@ -21366,7 +21424,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { // The incoming update might unblock the current render. Interrupt the // current attempt and restart from the top. prepareFreshStack(root, NoLanes); - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } // Mark that the root has a pending update. markRootUpdated(root, lane); @@ -21401,7 +21463,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { // effect of interrupting the current render and switching to the update. // TODO: Make sure this doesn't override pings that happen while we've // already started rendering. - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } } @@ -21489,7 +21555,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); } else { // The render completed. // Check if this render may have yielded to a concurrent event, and if so, @@ -21534,7 +21600,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); throw fatalError; } // We now have a consistent tree. The next step is either to commit it, @@ -21654,7 +21720,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { // This is a transition, so we should exit without committing a // placeholder and without scheduling a timeout. Delay indefinitely // until we receive more data. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, workInProgressDeferredLane); return; } // Commit the placeholder. @@ -21677,7 +21743,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { commitRoot( root, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane ); } else { if (includesOnlyRetries(lanes) && alwaysThrottleRetries) { @@ -21687,7 +21754,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now$1(); // Don't bother with a very short suspense time. if (msUntilTimeout > 10) { - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, workInProgressDeferredLane); var nextLanes = getNextLanes(root, NoLanes); if (nextLanes !== NoLanes) { @@ -21707,7 +21774,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { finishedWork, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ), msUntilTimeout ); @@ -21720,7 +21788,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { finishedWork, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ); } } @@ -21730,7 +21799,8 @@ function commitRootWhenReady( finishedWork, recoverableErrors, transitions, - lanes + lanes, + spawnedLane ) { // TODO: Combine retry throttling with Suspensey commits. Right now they run // one after the other. @@ -21755,12 +21825,12 @@ function commitRootWhenReady( root.cancelPendingCommit = schedulePendingCommit( commitRoot.bind(null, root, recoverableErrors, transitions) ); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, spawnedLane); return; } } // Otherwise, commit immediately. - commitRoot(root, recoverableErrors, transitions); + commitRoot(root, recoverableErrors, transitions, spawnedLane); } function isRenderConsistentWithExternalStores(finishedWork) { @@ -21825,7 +21895,7 @@ function isRenderConsistentWithExternalStores(finishedWork) { return true; } -function markRootSuspended(root, suspendedLanes) { +function markRootSuspended(root, suspendedLanes, spawnedLane) { // When suspending, we should always exclude lanes that were pinged or (more // rarely, since we try to avoid it) updated during the render phase. // TODO: Lol maybe there's a better way to factor this besides this @@ -21835,7 +21905,7 @@ function markRootSuspended(root, suspendedLanes) { suspendedLanes, workInProgressRootInterleavedUpdatedLanes ); - markRootSuspended$1(root, suspendedLanes); + markRootSuspended$1(root, suspendedLanes, spawnedLane); } // This is the entry point for synchronous tasks that don't go // through Scheduler @@ -21887,7 +21957,7 @@ function performSyncWorkOnRoot(root, lanes) { if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); throw fatalError; } @@ -21896,7 +21966,7 @@ function performSyncWorkOnRoot(root, lanes) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); return null; } // We now have a consistent tree. Because this is a sync render, we @@ -21908,7 +21978,8 @@ function performSyncWorkOnRoot(root, lanes) { commitRoot( root, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane ); // Before exiting, make sure there's a callback scheduled for the next // pending level. @@ -22047,6 +22118,7 @@ function prepareFreshStack(root, lanes) { workInProgressRootSkippedLanes = NoLanes; workInProgressRootInterleavedUpdatedLanes = NoLanes; workInProgressRootPingedLanes = NoLanes; + workInProgressDeferredLane = NoLane; workInProgressRootConcurrentErrors = null; workInProgressRootRecoverableErrors = null; // Get the lanes that are entangled with whatever we're about to render. We // track these separately so we can distinguish the priority of the render @@ -22261,9 +22333,9 @@ function renderDidSuspendDelayIfPossible() { // this render. if ( - workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || - includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) + includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) && + workInProgressRoot !== null ) { // Mark the current render as suspended so that we switch to working on // the updates that were skipped. Usually we only suspend at the end of @@ -22274,8 +22346,11 @@ function renderDidSuspendDelayIfPossible() { // pinged or updated while we were rendering. // TODO: Consider unwinding immediately, using the // SuspendedOnHydration mechanism. - // $FlowFixMe[incompatible-call] need null check workInProgressRoot - markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes); + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } } function renderDidError(error) { @@ -22976,7 +23051,7 @@ function unwindUnitOfWork(unitOfWork) { workInProgress = null; } -function commitRoot(root, recoverableErrors, transitions) { +function commitRoot(root, recoverableErrors, transitions, spawnedLane) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. var previousUpdateLanePriority = getCurrentUpdatePriority(); @@ -22989,7 +23064,8 @@ function commitRoot(root, recoverableErrors, transitions) { root, recoverableErrors, transitions, - previousUpdateLanePriority + previousUpdateLanePriority, + spawnedLane ); } finally { ReactCurrentBatchConfig.transition = prevTransition; @@ -23003,7 +23079,8 @@ function commitRootImpl( root, recoverableErrors, transitions, - renderPriorityLevel + renderPriorityLevel, + spawnedLane ) { do { // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which @@ -23058,7 +23135,7 @@ function commitRootImpl( var concurrentlyUpdatedLanes = getConcurrentlyUpdatedLanes(); remainingLanes = mergeLanes(remainingLanes, concurrentlyUpdatedLanes); - markRootFinished(root, remainingLanes); + markRootFinished(root, remainingLanes, spawnedLane); if (root === workInProgressRoot) { // We can reset these now that they are finished. @@ -25183,7 +25260,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-classic-1a677f82"; +var ReactVersion = "18.3.0-www-classic-703d13e3"; // Might add PROFILE later. diff --git a/compiled/facebook-www/ReactTestRenderer-dev.modern.js b/compiled/facebook-www/ReactTestRenderer-dev.modern.js index a0c89b9f89..61ff2550c3 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.modern.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.modern.js @@ -1174,7 +1174,7 @@ var TransitionHydrationLane = 64; var TransitionLanes = /* */ - 8388480; + 4194176; var TransitionLane1 = /* */ 128; @@ -1220,39 +1220,39 @@ var TransitionLane14 = var TransitionLane15 = /* */ 2097152; -var TransitionLane16 = - /* */ - 4194304; var RetryLanes = /* */ - 125829120; + 62914560; var RetryLane1 = /* */ - 8388608; + 4194304; var RetryLane2 = /* */ - 16777216; + 8388608; var RetryLane3 = /* */ - 33554432; + 16777216; var RetryLane4 = /* */ - 67108864; + 33554432; var SomeRetryLane = RetryLane1; var SelectiveHydrationLane = /* */ - 134217728; + 67108864; var NonIdleLanes = /* */ - 268435455; + 134217727; var IdleHydrationLane = /* */ - 268435456; + 134217728; var IdleLane = /* */ - 536870912; + 268435456; var OffscreenLane = /* */ + 536870912; +var DeferredLane = + /* */ 1073741824; // Any lane that might schedule an update. This is used to detect infinite // update loops, so it doesn't include hydration lanes or retries. @@ -1300,7 +1300,6 @@ function getHighestPriorityLanes(lanes) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: return lanes & TransitionLanes; case RetryLane1: @@ -1321,6 +1320,11 @@ function getHighestPriorityLanes(lanes) { case OffscreenLane: return OffscreenLane; + case DeferredLane: + // This shouldn't be reachable because deferred work is always entangled + // with something else. + return NoLanes; + default: { error("Should have found matching lanes. This is a bug in React."); @@ -1487,7 +1491,6 @@ function computeExpirationTime(lane, currentTime) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: return currentTime + 5000; case RetryLane1: @@ -1505,6 +1508,7 @@ function computeExpirationTime(lane, currentTime) { case IdleHydrationLane: case IdleLane: case OffscreenLane: + case DeferredLane: // Anything idle priority or lower should never expire. return NoTimestamp; @@ -1708,7 +1712,7 @@ function markRootUpdated(root, updateLane) { root.pingedLanes = NoLanes; } } -function markRootSuspended$1(root, suspendedLanes) { +function markRootSuspended$1(root, suspendedLanes, spawnedLane) { root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. @@ -1721,11 +1725,15 @@ function markRootSuspended$1(root, suspendedLanes) { expirationTimes[index] = NoTimestamp; lanes &= ~lane; } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); + } } function markRootPinged(root, pingedLanes) { root.pingedLanes |= root.suspendedLanes & pingedLanes; } -function markRootFinished(root, remainingLanes) { +function markRootFinished(root, remainingLanes, spawnedLane) { var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; root.pendingLanes = remainingLanes; // Let's try everything again @@ -1765,7 +1773,32 @@ function markRootFinished(root, remainingLanes) { lanes &= ~lane; } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane( + root, + spawnedLane, // This render finished successfully without suspending, so we don't need + // to entangle the spawned task with the parent task. + NoLanes + ); + } +} + +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + // This render spawned a deferred task. Mark it as pending. + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; // Entangle the spawned lane with the DeferredLane bit so that we know it + // was the result of another render. This lets us avoid a useDeferredValue + // waterfall — only the first level will defer. + + var spawnedLaneIndex = laneToIndex(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] |= + DeferredLane | // If the parent render task suspended, we must also entangle those lanes + // with the spawned task. + entangledLanes; } + function markRootEntangled(root, entangledLanes) { // In addition to entangling each of the given lanes with each other, we also // have to consider _transitive_ entanglements. For each lane that is already @@ -1852,7 +1885,6 @@ function getBumpedLaneForHydration(root, renderLanes) { case TransitionLane13: case TransitionLane14: case TransitionLane15: - case TransitionLane16: case RetryLane1: case RetryLane2: case RetryLane3: @@ -8817,15 +8849,18 @@ function rerenderDeferredValue(value, initialValue) { } function mountDeferredValueImpl(hook, value, initialValue) { - if (initialValue !== undefined) { + if ( // When `initialValue` is provided, we defer the initial render even if the // current render is not synchronous. - // TODO: However, to avoid waterfalls, we should not defer if this render - // was itself spawned by an earlier useDeferredValue. Plan is to add a - // Deferred lane to track this. - hook.memoizedState = initialValue; // Schedule a deferred render + initialValue !== undefined && // However, to avoid waterfalls, we do not defer if this render + // was itself spawned by an earlier useDeferredValue. Check if DeferredLane + // is part of the render lanes. + !includesSomeLane(renderLanes, DeferredLane) + ) { + // Render with the initial value + hook.memoizedState = initialValue; // Schedule a deferred render to switch to the final value. - var deferredLane = claimNextTransitionLane(); + var deferredLane = requestDeferredLane(); currentlyRenderingFiber$1.lanes = mergeLanes( currentlyRenderingFiber$1.lanes, deferredLane @@ -8853,7 +8888,7 @@ function updateDeferredValueImpl(hook, prevValue, value, initialValue) { // previous value and spawn a deferred render to update it later. if (!objectIs(value, prevValue)) { // Schedule a deferred render - var deferredLane = claimNextTransitionLane(); + var deferredLane = requestDeferredLane(); currentlyRenderingFiber$1.lanes = mergeLanes( currentlyRenderingFiber$1.lanes, deferredLane @@ -21211,7 +21246,9 @@ var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event). -var workInProgressRootPingedLanes = NoLanes; // Errors that are thrown during the render phase. +var workInProgressRootPingedLanes = NoLanes; // If this lane scheduled deferred work, this is the lane of the deferred task. + +var workInProgressDeferredLane = NoLane; // Errors that are thrown during the render phase. var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI. // We will log them once the tree commits. @@ -21343,6 +21380,27 @@ function requestRetryLane(fiber) { return claimNextRetryLane(); } +function requestDeferredLane() { + if (workInProgressDeferredLane === NoLane) { + // If there are multiple useDeferredValue hooks in the same render, the + // tasks that they spawn should all be batched together, so they should all + // receive the same lane. + if (includesSomeLane(workInProgressRootRenderLanes, OffscreenLane)) { + // There's only one OffscreenLane, so if it contains deferred work, we + // should just reschedule using the same lane. + // TODO: We also use OffscreenLane for hydration, on the basis that the + // initial HTML is the same as the hydrated UI, but since the deferred + // task will change the UI, it should be treated like an update. Use + // TransitionHydrationLane to trigger selective hydration. + workInProgressDeferredLane = OffscreenLane; + } else { + // Everything else is spawned as a transition. + workInProgressDeferredLane = requestTransitionLane(); + } + } + + return workInProgressDeferredLane; +} function scheduleUpdateOnFiber(root, fiber, lane) { { if (isRunningInsertionEffect) { @@ -21366,7 +21424,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { // The incoming update might unblock the current render. Interrupt the // current attempt and restart from the top. prepareFreshStack(root, NoLanes); - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } // Mark that the root has a pending update. markRootUpdated(root, lane); @@ -21401,7 +21463,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { // effect of interrupting the current render and switching to the update. // TODO: Make sure this doesn't override pings that happen while we've // already started rendering. - markRootSuspended(root, workInProgressRootRenderLanes); + markRootSuspended( + root, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } } @@ -21489,7 +21555,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); } else { // The render completed. // Check if this render may have yielded to a concurrent event, and if so, @@ -21534,7 +21600,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); throw fatalError; } // We now have a consistent tree. The next step is either to commit it, @@ -21654,7 +21720,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { // This is a transition, so we should exit without committing a // placeholder and without scheduling a timeout. Delay indefinitely // until we receive more data. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, workInProgressDeferredLane); return; } // Commit the placeholder. @@ -21677,7 +21743,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { commitRoot( root, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane ); } else { if (includesOnlyRetries(lanes) && alwaysThrottleRetries) { @@ -21687,7 +21754,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now$1(); // Don't bother with a very short suspense time. if (msUntilTimeout > 10) { - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, workInProgressDeferredLane); var nextLanes = getNextLanes(root, NoLanes); if (nextLanes !== NoLanes) { @@ -21707,7 +21774,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { finishedWork, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ), msUntilTimeout ); @@ -21720,7 +21788,8 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) { finishedWork, workInProgressRootRecoverableErrors, workInProgressTransitions, - lanes + lanes, + workInProgressDeferredLane ); } } @@ -21730,7 +21799,8 @@ function commitRootWhenReady( finishedWork, recoverableErrors, transitions, - lanes + lanes, + spawnedLane ) { // TODO: Combine retry throttling with Suspensey commits. Right now they run // one after the other. @@ -21755,12 +21825,12 @@ function commitRootWhenReady( root.cancelPendingCommit = schedulePendingCommit( commitRoot.bind(null, root, recoverableErrors, transitions) ); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, spawnedLane); return; } } // Otherwise, commit immediately. - commitRoot(root, recoverableErrors, transitions); + commitRoot(root, recoverableErrors, transitions, spawnedLane); } function isRenderConsistentWithExternalStores(finishedWork) { @@ -21825,7 +21895,7 @@ function isRenderConsistentWithExternalStores(finishedWork) { return true; } -function markRootSuspended(root, suspendedLanes) { +function markRootSuspended(root, suspendedLanes, spawnedLane) { // When suspending, we should always exclude lanes that were pinged or (more // rarely, since we try to avoid it) updated during the render phase. // TODO: Lol maybe there's a better way to factor this besides this @@ -21835,7 +21905,7 @@ function markRootSuspended(root, suspendedLanes) { suspendedLanes, workInProgressRootInterleavedUpdatedLanes ); - markRootSuspended$1(root, suspendedLanes); + markRootSuspended$1(root, suspendedLanes, spawnedLane); } // This is the entry point for synchronous tasks that don't go // through Scheduler @@ -21887,7 +21957,7 @@ function performSyncWorkOnRoot(root, lanes) { if (exitStatus === RootFatalErrored) { var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); throw fatalError; } @@ -21896,7 +21966,7 @@ function performSyncWorkOnRoot(root, lanes) { // The render unwound without completing the tree. This happens in special // cases where need to exit the current render without producing a // consistent tree or committing. - markRootSuspended(root, lanes); + markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); return null; } // We now have a consistent tree. Because this is a sync render, we @@ -21908,7 +21978,8 @@ function performSyncWorkOnRoot(root, lanes) { commitRoot( root, workInProgressRootRecoverableErrors, - workInProgressTransitions + workInProgressTransitions, + workInProgressDeferredLane ); // Before exiting, make sure there's a callback scheduled for the next // pending level. @@ -22047,6 +22118,7 @@ function prepareFreshStack(root, lanes) { workInProgressRootSkippedLanes = NoLanes; workInProgressRootInterleavedUpdatedLanes = NoLanes; workInProgressRootPingedLanes = NoLanes; + workInProgressDeferredLane = NoLane; workInProgressRootConcurrentErrors = null; workInProgressRootRecoverableErrors = null; // Get the lanes that are entangled with whatever we're about to render. We // track these separately so we can distinguish the priority of the render @@ -22261,9 +22333,9 @@ function renderDidSuspendDelayIfPossible() { // this render. if ( - workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || - includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) + includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) && + workInProgressRoot !== null ) { // Mark the current render as suspended so that we switch to working on // the updates that were skipped. Usually we only suspend at the end of @@ -22274,8 +22346,11 @@ function renderDidSuspendDelayIfPossible() { // pinged or updated while we were rendering. // TODO: Consider unwinding immediately, using the // SuspendedOnHydration mechanism. - // $FlowFixMe[incompatible-call] need null check workInProgressRoot - markRootSuspended(workInProgressRoot, workInProgressRootRenderLanes); + markRootSuspended( + workInProgressRoot, + workInProgressRootRenderLanes, + workInProgressDeferredLane + ); } } function renderDidError(error) { @@ -22976,7 +23051,7 @@ function unwindUnitOfWork(unitOfWork) { workInProgress = null; } -function commitRoot(root, recoverableErrors, transitions) { +function commitRoot(root, recoverableErrors, transitions, spawnedLane) { // TODO: This no longer makes any sense. We already wrap the mutation and // layout phases. Should be able to remove. var previousUpdateLanePriority = getCurrentUpdatePriority(); @@ -22989,7 +23064,8 @@ function commitRoot(root, recoverableErrors, transitions) { root, recoverableErrors, transitions, - previousUpdateLanePriority + previousUpdateLanePriority, + spawnedLane ); } finally { ReactCurrentBatchConfig.transition = prevTransition; @@ -23003,7 +23079,8 @@ function commitRootImpl( root, recoverableErrors, transitions, - renderPriorityLevel + renderPriorityLevel, + spawnedLane ) { do { // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which @@ -23058,7 +23135,7 @@ function commitRootImpl( var concurrentlyUpdatedLanes = getConcurrentlyUpdatedLanes(); remainingLanes = mergeLanes(remainingLanes, concurrentlyUpdatedLanes); - markRootFinished(root, remainingLanes); + markRootFinished(root, remainingLanes, spawnedLane); if (root === workInProgressRoot) { // We can reset these now that they are finished. @@ -25183,7 +25260,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-www-modern-a3e56735"; +var ReactVersion = "18.3.0-www-modern-e2703e39"; // Might add PROFILE later.