diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index 028ca32c8f439..37da68371533a 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -c5b9375767e2c4102d7e5559d383523736f1c902 +f1039be4a48384e7e4b0a87d4d92c48e900053b9 diff --git a/compiled/facebook-www/React-dev.classic.js b/compiled/facebook-www/React-dev.classic.js index 24a085dfeb475..b0cb067e97314 100644 --- a/compiled/facebook-www/React-dev.classic.js +++ b/compiled/facebook-www/React-dev.classic.js @@ -24,7 +24,7 @@ if (__DEV__) { ) { __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); } - var ReactVersion = "18.3.0-www-classic-fc109ac4"; + var ReactVersion = "18.3.0-www-classic-b43bd001"; // 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 7c1b8ab251425..37f46cd596bb5 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-dd7a0299"; +exports.version = "18.3.0-www-classic-9e2eb6c9"; diff --git a/compiled/facebook-www/ReactART-dev.classic.js b/compiled/facebook-www/ReactART-dev.classic.js index 76d4c3784e3af..d0517076960c6 100644 --- a/compiled/facebook-www/ReactART-dev.classic.js +++ b/compiled/facebook-www/ReactART-dev.classic.js @@ -66,7 +66,7 @@ if (__DEV__) { return self; } - var ReactVersion = "18.3.0-www-classic-cb4986de"; + var ReactVersion = "18.3.0-www-classic-1401d50e"; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -544,6 +544,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; + var DidDefer = ContentReset; var LifecycleEffectMask = Passive$1 | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) @@ -15591,9 +15592,26 @@ if (__DEV__) { return hasSuspenseListContext(suspenseContext, ForceSuspenseFallback); } - function getRemainingWorkInPrimaryTree(current, renderLanes) { - // TODO: Should not remove render lanes that were pinged during this render - return removeLanes(current.childLanes, renderLanes); + function getRemainingWorkInPrimaryTree( + current, + primaryTreeDidDefer, + renderLanes + ) { + var remainingLanes = + current !== null + ? removeLanes(current.childLanes, renderLanes) + : NoLanes; + + if (primaryTreeDidDefer) { + // A useDeferredValue hook spawned a deferred task inside the primary tree. + // Ensure that we retry this component at the deferred priority. + // TODO: We could make this a per-subtree value instead of a global one. + // Would need to track it on the context stack somehow, similar to what + // we'd have to do for resumable contexts. + remainingLanes = mergeLanes(remainingLanes, peekDeferredLane()); + } + + return remainingLanes; } function updateSuspenseComponent(current, workInProgress, renderLanes) { @@ -15613,7 +15631,12 @@ if (__DEV__) { // rendering the fallback children. showFallback = true; workInProgress.flags &= ~DidCapture; - } // OK, the next part is confusing. We're about to reconcile the Suspense + } // Check if the primary children spawned a deferred task (useDeferredValue) + // during the first pass. + + var didPrimaryChildrenDefer = + (workInProgress.flags & DidDefer) !== NoFlags$1; + workInProgress.flags &= ~DidDefer; // OK, the next part is confusing. We're about to reconcile the Suspense // boundary's children. This involves some custom reconciliation logic. Two // main reasons this is so complicated. // @@ -15651,6 +15674,11 @@ if (__DEV__) { var primaryChildFragment = workInProgress.child; primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); + primaryChildFragment.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; if (enableTransitionTracing) { @@ -15691,6 +15719,11 @@ if (__DEV__) { var _primaryChildFragment = workInProgress.child; _primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); + _primaryChildFragment.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; // TODO: Transition Tracing is not yet implemented for CPU Suspense. // Since nothing actually suspended, there will nothing to ping this to // get it started back up to attempt the next item. While in terms of @@ -15723,6 +15756,7 @@ if (__DEV__) { current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, _dehydrated, prevState, @@ -15786,6 +15820,7 @@ if (__DEV__) { _primaryChildFragment2.childLanes = getRemainingWorkInPrimaryTree( current, + didPrimaryChildrenDefer, renderLanes ); workInProgress.memoizedState = SUSPENDED_MARKER; @@ -16104,6 +16139,7 @@ if (__DEV__) { current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, @@ -16320,6 +16356,11 @@ if (__DEV__) { var _primaryChildFragment4 = workInProgress.child; _primaryChildFragment4.memoizedState = mountSuspenseOffscreenState(renderLanes); + _primaryChildFragment4.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return fallbackChildFragment; } @@ -24766,10 +24807,22 @@ if (__DEV__) { // Everything else is spawned as a transition. workInProgressDeferredLane = requestTransitionLane(); } + } // Mark the parent Suspense boundary so it knows to spawn the deferred lane. + + var suspenseHandler = getSuspenseHandler(); + + if (suspenseHandler !== null) { + // TODO: As an optimization, we shouldn't entangle the lanes at the root; we + // can entangle them using the baseLanes of the Suspense boundary instead. + // We only need to do something special if there's no Suspense boundary. + suspenseHandler.flags |= DidDefer; } return workInProgressDeferredLane; } + function peekDeferredLane() { + return workInProgressDeferredLane; + } function scheduleUpdateOnFiber(root, fiber, lane) { { if (isRunningInsertionEffect) { @@ -25387,7 +25440,7 @@ if (__DEV__) { // 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, NoLane); + markRootSuspended(root, lanes, workInProgressDeferredLane); ensureRootIsScheduled(root); return null; } // We now have a consistent tree. Because this is a sync render, we diff --git a/compiled/facebook-www/ReactART-dev.modern.js b/compiled/facebook-www/ReactART-dev.modern.js index 741530bd02248..1629ae3ca1b19 100644 --- a/compiled/facebook-www/ReactART-dev.modern.js +++ b/compiled/facebook-www/ReactART-dev.modern.js @@ -66,7 +66,7 @@ if (__DEV__) { return self; } - var ReactVersion = "18.3.0-www-modern-0a58ac99"; + var ReactVersion = "18.3.0-www-modern-a32ad479"; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -544,6 +544,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; + var DidDefer = ContentReset; var LifecycleEffectMask = Passive$1 | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) @@ -15270,9 +15271,26 @@ if (__DEV__) { return hasSuspenseListContext(suspenseContext, ForceSuspenseFallback); } - function getRemainingWorkInPrimaryTree(current, renderLanes) { - // TODO: Should not remove render lanes that were pinged during this render - return removeLanes(current.childLanes, renderLanes); + function getRemainingWorkInPrimaryTree( + current, + primaryTreeDidDefer, + renderLanes + ) { + var remainingLanes = + current !== null + ? removeLanes(current.childLanes, renderLanes) + : NoLanes; + + if (primaryTreeDidDefer) { + // A useDeferredValue hook spawned a deferred task inside the primary tree. + // Ensure that we retry this component at the deferred priority. + // TODO: We could make this a per-subtree value instead of a global one. + // Would need to track it on the context stack somehow, similar to what + // we'd have to do for resumable contexts. + remainingLanes = mergeLanes(remainingLanes, peekDeferredLane()); + } + + return remainingLanes; } function updateSuspenseComponent(current, workInProgress, renderLanes) { @@ -15292,7 +15310,12 @@ if (__DEV__) { // rendering the fallback children. showFallback = true; workInProgress.flags &= ~DidCapture; - } // OK, the next part is confusing. We're about to reconcile the Suspense + } // Check if the primary children spawned a deferred task (useDeferredValue) + // during the first pass. + + var didPrimaryChildrenDefer = + (workInProgress.flags & DidDefer) !== NoFlags$1; + workInProgress.flags &= ~DidDefer; // OK, the next part is confusing. We're about to reconcile the Suspense // boundary's children. This involves some custom reconciliation logic. Two // main reasons this is so complicated. // @@ -15330,6 +15353,11 @@ if (__DEV__) { var primaryChildFragment = workInProgress.child; primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); + primaryChildFragment.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; if (enableTransitionTracing) { @@ -15370,6 +15398,11 @@ if (__DEV__) { var _primaryChildFragment = workInProgress.child; _primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); + _primaryChildFragment.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; // TODO: Transition Tracing is not yet implemented for CPU Suspense. // Since nothing actually suspended, there will nothing to ping this to // get it started back up to attempt the next item. While in terms of @@ -15402,6 +15435,7 @@ if (__DEV__) { current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, _dehydrated, prevState, @@ -15465,6 +15499,7 @@ if (__DEV__) { _primaryChildFragment2.childLanes = getRemainingWorkInPrimaryTree( current, + didPrimaryChildrenDefer, renderLanes ); workInProgress.memoizedState = SUSPENDED_MARKER; @@ -15783,6 +15818,7 @@ if (__DEV__) { current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, @@ -15999,6 +16035,11 @@ if (__DEV__) { var _primaryChildFragment4 = workInProgress.child; _primaryChildFragment4.memoizedState = mountSuspenseOffscreenState(renderLanes); + _primaryChildFragment4.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return fallbackChildFragment; } @@ -24410,10 +24451,22 @@ if (__DEV__) { // Everything else is spawned as a transition. workInProgressDeferredLane = requestTransitionLane(); } + } // Mark the parent Suspense boundary so it knows to spawn the deferred lane. + + var suspenseHandler = getSuspenseHandler(); + + if (suspenseHandler !== null) { + // TODO: As an optimization, we shouldn't entangle the lanes at the root; we + // can entangle them using the baseLanes of the Suspense boundary instead. + // We only need to do something special if there's no Suspense boundary. + suspenseHandler.flags |= DidDefer; } return workInProgressDeferredLane; } + function peekDeferredLane() { + return workInProgressDeferredLane; + } function scheduleUpdateOnFiber(root, fiber, lane) { { if (isRunningInsertionEffect) { @@ -25031,7 +25084,7 @@ if (__DEV__) { // 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, NoLane); + markRootSuspended(root, lanes, workInProgressDeferredLane); ensureRootIsScheduled(root); return null; } // We now have a consistent tree. Because this is a sync render, we diff --git a/compiled/facebook-www/ReactART-prod.classic.js b/compiled/facebook-www/ReactART-prod.classic.js index b170b7a13e84d..cccd15f84a0e4 100644 --- a/compiled/facebook-www/ReactART-prod.classic.js +++ b/compiled/facebook-www/ReactART-prod.classic.js @@ -2403,7 +2403,7 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { ? markRootSuspended( workInProgressRootRenderLanes$29, nextLanes, - 0 + workInProgressDeferredLane ) : ((workInProgressRootRenderLanes$29.finishedWork = workInProgressRootRenderLanes$29.current.alternate), @@ -4586,6 +4586,15 @@ var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: 0 }; function mountSuspenseOffscreenState(renderLanes) { return { baseLanes: renderLanes, cachePool: getSuspendedCache() }; } +function getRemainingWorkInPrimaryTree( + current, + primaryTreeDidDefer, + renderLanes +) { + current = null !== current ? current.childLanes & ~renderLanes : 0; + primaryTreeDidDefer && (current |= workInProgressDeferredLane); + return current; +} function updateSuspenseComponent(current, workInProgress, renderLanes) { var nextProps = workInProgress.pendingProps, showFallback = !1, @@ -4597,20 +4606,27 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? !1 : 0 !== (suspenseStackCursor.current & 2)); JSCompiler_temp && ((showFallback = !0), (workInProgress.flags &= -129)); + JSCompiler_temp = 0 !== (workInProgress.flags & 32); + workInProgress.flags &= -33; if (null === current) { - current = nextProps.children; - didSuspend = nextProps.fallback; + didSuspend = nextProps.children; + var nextFallbackChildren = nextProps.fallback; if (showFallback) return ( reuseSuspenseHandlerOnStack(workInProgress), - (current = mountSuspenseFallbackChildren( + (nextProps = mountSuspenseFallbackChildren( workInProgress, - current, didSuspend, + nextFallbackChildren, + renderLanes + )), + (showFallback = workInProgress.child), + (showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes)), + (showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, renderLanes )), - (nextProps = workInProgress.child), - (nextProps.memoizedState = mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), enableTransitionTracing && ((workInProgress = enableTransitionTracing @@ -4620,46 +4636,52 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ((renderLanes = enableTransitionTracing ? markerInstanceStack.current : null), - (showFallback = nextProps.updateQueue), - null === showFallback - ? (nextProps.updateQueue = { + (current = showFallback.updateQueue), + null === current + ? (showFallback.updateQueue = { transitions: workInProgress, markerInstances: renderLanes, retryQueue: null }) - : ((showFallback.transitions = workInProgress), - (showFallback.markerInstances = renderLanes)))), - current + : ((current.transitions = workInProgress), + (current.markerInstances = renderLanes)))), + nextProps ); if ("number" === typeof nextProps.unstable_expectedLoadTime) return ( reuseSuspenseHandlerOnStack(workInProgress), - (current = mountSuspenseFallbackChildren( + (nextProps = mountSuspenseFallbackChildren( workInProgress, - current, didSuspend, + nextFallbackChildren, + renderLanes + )), + (showFallback = workInProgress.child), + (showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes)), + (showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, renderLanes )), - (workInProgress.child.memoizedState = - mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - current + nextProps ); pushPrimaryTreeSuspenseHandler(workInProgress); - return mountSuspensePrimaryChildren(workInProgress, current); + return mountSuspensePrimaryChildren(workInProgress, didSuspend); } - JSCompiler_temp = current.memoizedState; - if (null !== JSCompiler_temp) { - var dehydrated = JSCompiler_temp.dehydrated; + nextFallbackChildren = current.memoizedState; + if (null !== nextFallbackChildren) { + var dehydrated = nextFallbackChildren.dehydrated; if (null !== dehydrated) return updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, + JSCompiler_temp, nextProps, dehydrated, - JSCompiler_temp, + nextFallbackChildren, renderLanes ); } @@ -4667,16 +4689,20 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { reuseSuspenseHandlerOnStack(workInProgress); showFallback = nextProps.fallback; didSuspend = workInProgress.mode; - JSCompiler_temp = current.child; - dehydrated = JSCompiler_temp.sibling; + nextFallbackChildren = current.child; + dehydrated = nextFallbackChildren.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; - 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp + 0 === (didSuspend & 1) && workInProgress.child !== nextFallbackChildren ? ((nextProps = workInProgress.child), (nextProps.childLanes = 0), (nextProps.pendingProps = primaryChildProps), (workInProgress.deletions = null)) - : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), - (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280)); + : ((nextProps = createWorkInProgress( + nextFallbackChildren, + primaryChildProps + )), + (nextProps.subtreeFlags = + nextFallbackChildren.subtreeFlags & 31457280)); null !== dehydrated ? (showFallback = createWorkInProgress(dehydrated, showFallback)) : ((showFallback = createFiberFromFragment( @@ -4695,23 +4721,23 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { didSuspend = current.child.memoizedState; null === didSuspend ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) - : ((JSCompiler_temp = didSuspend.cachePool), - null !== JSCompiler_temp + : ((nextFallbackChildren = didSuspend.cachePool), + null !== nextFallbackChildren ? ((dehydrated = CacheContext._currentValue2), - (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated + (nextFallbackChildren = + nextFallbackChildren.parent !== dehydrated ? { parent: dehydrated, pool: dehydrated } - : JSCompiler_temp)) - : (JSCompiler_temp = getSuspendedCache()), + : nextFallbackChildren)) + : (nextFallbackChildren = getSuspendedCache()), (didSuspend = { baseLanes: didSuspend.baseLanes | renderLanes, - cachePool: JSCompiler_temp + cachePool: nextFallbackChildren })); showFallback.memoizedState = didSuspend; enableTransitionTracing && ((didSuspend = enableTransitionTracing ? transitionStack.current : null), null !== didSuspend && - ((JSCompiler_temp = enableTransitionTracing + ((nextFallbackChildren = enableTransitionTracing ? markerInstanceStack.current : null), (dehydrated = showFallback.updateQueue), @@ -4719,40 +4745,44 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { null === dehydrated ? (showFallback.updateQueue = { transitions: didSuspend, - markerInstances: JSCompiler_temp, + markerInstances: nextFallbackChildren, retryQueue: null }) : dehydrated === primaryChildProps ? (showFallback.updateQueue = { transitions: didSuspend, - markerInstances: JSCompiler_temp, + markerInstances: nextFallbackChildren, retryQueue: null !== primaryChildProps ? primaryChildProps.retryQueue : null }) : ((dehydrated.transitions = didSuspend), - (dehydrated.markerInstances = JSCompiler_temp)))); - showFallback.childLanes = current.childLanes & ~renderLanes; + (dehydrated.markerInstances = nextFallbackChildren)))); + showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return nextProps; } pushPrimaryTreeSuspenseHandler(workInProgress); - showFallback = current.child; - current = showFallback.sibling; - nextProps = createWorkInProgress(showFallback, { + JSCompiler_temp = current.child; + current = JSCompiler_temp.sibling; + JSCompiler_temp = createWorkInProgress(JSCompiler_temp, { mode: "visible", children: nextProps.children }); - 0 === (workInProgress.mode & 1) && (nextProps.lanes = renderLanes); - nextProps.return = workInProgress; - nextProps.sibling = null; + 0 === (workInProgress.mode & 1) && (JSCompiler_temp.lanes = renderLanes); + JSCompiler_temp.return = workInProgress; + JSCompiler_temp.sibling = null; null !== current && ((renderLanes = workInProgress.deletions), null === renderLanes ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) : renderLanes.push(current)); - workInProgress.child = nextProps; + workInProgress.child = JSCompiler_temp; workInProgress.memoizedState = null; - return nextProps; + return JSCompiler_temp; } function mountSuspensePrimaryChildren(workInProgress, primaryChildren) { primaryChildren = createFiberFromOffscreen( @@ -4817,6 +4847,7 @@ function updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, @@ -4827,14 +4858,14 @@ function updateDehydratedSuspenseComponent( return ( pushPrimaryTreeSuspenseHandler(workInProgress), (workInProgress.flags &= -257), - (suspenseState = createCapturedValue( + (didPrimaryChildrenDefer = createCapturedValue( Error(formatProdErrorMessage(422)) )), retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, - suspenseState + didPrimaryChildrenDefer ) ); if (null !== workInProgress.memoizedState) @@ -4866,8 +4897,13 @@ function updateDehydratedSuspenseComponent( workInProgress.child = nextProps; 0 !== (workInProgress.mode & 1) && reconcileChildFibers(workInProgress, current.child, null, renderLanes); - workInProgress.child.memoizedState = - mountSuspenseOffscreenState(renderLanes); + nextProps = workInProgress.child; + nextProps.memoizedState = mountSuspenseOffscreenState(renderLanes); + nextProps.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return suspenseState; } @@ -4881,37 +4917,41 @@ function updateDehydratedSuspenseComponent( ); if (shim$2()) return ( - (suspenseState = shim$2().digest), - (nextProps = Error(formatProdErrorMessage(419))), - (nextProps.digest = suspenseState), - (suspenseState = createCapturedValue(nextProps, suspenseState, void 0)), + (didPrimaryChildrenDefer = shim$2().digest), + (suspenseState = Error(formatProdErrorMessage(419))), + (suspenseState.digest = didPrimaryChildrenDefer), + (didPrimaryChildrenDefer = createCapturedValue( + suspenseState, + didPrimaryChildrenDefer, + void 0 + )), retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, - suspenseState + didPrimaryChildrenDefer ) ); enableLazyContextPropagation && !didReceiveUpdate && propagateParentContextChanges(current, workInProgress, renderLanes, !1); - didSuspend = 0 !== (renderLanes & current.childLanes); - if (didReceiveUpdate || didSuspend) { - nextProps = workInProgressRoot; - if (null !== nextProps) { - didSuspend = renderLanes & -renderLanes; - if (enableUnifiedSyncLane && 0 !== (didSuspend & SyncUpdateLanes)) - didSuspend = 1; + didPrimaryChildrenDefer = 0 !== (renderLanes & current.childLanes); + if (didReceiveUpdate || didPrimaryChildrenDefer) { + didPrimaryChildrenDefer = workInProgressRoot; + if (null !== didPrimaryChildrenDefer) { + nextProps = renderLanes & -renderLanes; + if (enableUnifiedSyncLane && 0 !== (nextProps & SyncUpdateLanes)) + nextProps = 1; else - switch (didSuspend) { + switch (nextProps) { case 2: - didSuspend = 1; + nextProps = 1; break; case 8: - didSuspend = 4; + nextProps = 4; break; case 32: - didSuspend = 16; + nextProps = 16; break; case 128: case 256: @@ -4932,23 +4972,24 @@ function updateDehydratedSuspenseComponent( case 8388608: case 16777216: case 33554432: - didSuspend = 64; + nextProps = 64; break; case 268435456: - didSuspend = 134217728; + nextProps = 134217728; break; default: - didSuspend = 0; + nextProps = 0; } - didSuspend = - 0 !== (didSuspend & (nextProps.suspendedLanes | renderLanes)) + nextProps = + 0 !== + (nextProps & (didPrimaryChildrenDefer.suspendedLanes | renderLanes)) ? 0 - : didSuspend; - if (0 !== didSuspend && didSuspend !== suspenseState.retryLane) + : nextProps; + if (0 !== nextProps && nextProps !== suspenseState.retryLane) throw ( - ((suspenseState.retryLane = didSuspend), - enqueueConcurrentRenderForLane(current, didSuspend), - scheduleUpdateOnFiber(nextProps, current, didSuspend), + ((suspenseState.retryLane = nextProps), + enqueueConcurrentRenderForLane(current, nextProps), + scheduleUpdateOnFiber(didPrimaryChildrenDefer, current, nextProps), SelectiveHydrationException) ); } @@ -8182,6 +8223,8 @@ function requestDeferredLane() { 0 !== (workInProgressRootRenderLanes & 536870912) ? 536870912 : requestTransitionLane()); + var suspenseHandler = suspenseHandlerStackCursor.current; + null !== suspenseHandler && (suspenseHandler.flags |= 32); return workInProgressDeferredLane; } function scheduleUpdateOnFiber(root, fiber, lane) { @@ -10239,19 +10282,19 @@ var slice = Array.prototype.slice, }; return Text; })(React.Component), - devToolsConfig$jscomp$inline_1147 = { + devToolsConfig$jscomp$inline_1150 = { findFiberByHostInstance: function () { return null; }, bundleType: 0, - version: "18.3.0-www-classic-5245c95b", + version: "18.3.0-www-classic-47d800d0", rendererPackageName: "react-art" }; -var internals$jscomp$inline_1322 = { - bundleType: devToolsConfig$jscomp$inline_1147.bundleType, - version: devToolsConfig$jscomp$inline_1147.version, - rendererPackageName: devToolsConfig$jscomp$inline_1147.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1147.rendererConfig, +var internals$jscomp$inline_1325 = { + bundleType: devToolsConfig$jscomp$inline_1150.bundleType, + version: devToolsConfig$jscomp$inline_1150.version, + rendererPackageName: devToolsConfig$jscomp$inline_1150.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1150.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10268,26 +10311,26 @@ var internals$jscomp$inline_1322 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1147.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1150.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-5245c95b" + reconcilerVersion: "18.3.0-www-classic-47d800d0" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1323 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1326 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1323.isDisabled && - hook$jscomp$inline_1323.supportsFiber + !hook$jscomp$inline_1326.isDisabled && + hook$jscomp$inline_1326.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1323.inject( - internals$jscomp$inline_1322 + (rendererID = hook$jscomp$inline_1326.inject( + internals$jscomp$inline_1325 )), - (injectedHook = hook$jscomp$inline_1323); + (injectedHook = hook$jscomp$inline_1326); } 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 8f4f4cb693486..336d416901d55 100644 --- a/compiled/facebook-www/ReactART-prod.modern.js +++ b/compiled/facebook-www/ReactART-prod.modern.js @@ -2213,7 +2213,7 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { ? markRootSuspended( workInProgressRootRenderLanes$29, nextLanes, - 0 + workInProgressDeferredLane ) : ((workInProgressRootRenderLanes$29.finishedWork = workInProgressRootRenderLanes$29.current.alternate), @@ -4349,6 +4349,15 @@ var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: 0 }; function mountSuspenseOffscreenState(renderLanes) { return { baseLanes: renderLanes, cachePool: getSuspendedCache() }; } +function getRemainingWorkInPrimaryTree( + current, + primaryTreeDidDefer, + renderLanes +) { + current = null !== current ? current.childLanes & ~renderLanes : 0; + primaryTreeDidDefer && (current |= workInProgressDeferredLane); + return current; +} function updateSuspenseComponent(current, workInProgress, renderLanes) { var nextProps = workInProgress.pendingProps, showFallback = !1, @@ -4360,20 +4369,27 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? !1 : 0 !== (suspenseStackCursor.current & 2)); JSCompiler_temp && ((showFallback = !0), (workInProgress.flags &= -129)); + JSCompiler_temp = 0 !== (workInProgress.flags & 32); + workInProgress.flags &= -33; if (null === current) { - current = nextProps.children; - didSuspend = nextProps.fallback; + didSuspend = nextProps.children; + var nextFallbackChildren = nextProps.fallback; if (showFallback) return ( reuseSuspenseHandlerOnStack(workInProgress), - (current = mountSuspenseFallbackChildren( + (nextProps = mountSuspenseFallbackChildren( workInProgress, - current, didSuspend, + nextFallbackChildren, + renderLanes + )), + (showFallback = workInProgress.child), + (showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes)), + (showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, renderLanes )), - (nextProps = workInProgress.child), - (nextProps.memoizedState = mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), enableTransitionTracing && ((workInProgress = enableTransitionTracing @@ -4383,46 +4399,52 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ((renderLanes = enableTransitionTracing ? markerInstanceStack.current : null), - (showFallback = nextProps.updateQueue), - null === showFallback - ? (nextProps.updateQueue = { + (current = showFallback.updateQueue), + null === current + ? (showFallback.updateQueue = { transitions: workInProgress, markerInstances: renderLanes, retryQueue: null }) - : ((showFallback.transitions = workInProgress), - (showFallback.markerInstances = renderLanes)))), - current + : ((current.transitions = workInProgress), + (current.markerInstances = renderLanes)))), + nextProps ); if ("number" === typeof nextProps.unstable_expectedLoadTime) return ( reuseSuspenseHandlerOnStack(workInProgress), - (current = mountSuspenseFallbackChildren( + (nextProps = mountSuspenseFallbackChildren( workInProgress, - current, didSuspend, + nextFallbackChildren, + renderLanes + )), + (showFallback = workInProgress.child), + (showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes)), + (showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, renderLanes )), - (workInProgress.child.memoizedState = - mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - current + nextProps ); pushPrimaryTreeSuspenseHandler(workInProgress); - return mountSuspensePrimaryChildren(workInProgress, current); + return mountSuspensePrimaryChildren(workInProgress, didSuspend); } - JSCompiler_temp = current.memoizedState; - if (null !== JSCompiler_temp) { - var dehydrated = JSCompiler_temp.dehydrated; + nextFallbackChildren = current.memoizedState; + if (null !== nextFallbackChildren) { + var dehydrated = nextFallbackChildren.dehydrated; if (null !== dehydrated) return updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, + JSCompiler_temp, nextProps, dehydrated, - JSCompiler_temp, + nextFallbackChildren, renderLanes ); } @@ -4430,16 +4452,20 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { reuseSuspenseHandlerOnStack(workInProgress); showFallback = nextProps.fallback; didSuspend = workInProgress.mode; - JSCompiler_temp = current.child; - dehydrated = JSCompiler_temp.sibling; + nextFallbackChildren = current.child; + dehydrated = nextFallbackChildren.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; - 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp + 0 === (didSuspend & 1) && workInProgress.child !== nextFallbackChildren ? ((nextProps = workInProgress.child), (nextProps.childLanes = 0), (nextProps.pendingProps = primaryChildProps), (workInProgress.deletions = null)) - : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), - (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280)); + : ((nextProps = createWorkInProgress( + nextFallbackChildren, + primaryChildProps + )), + (nextProps.subtreeFlags = + nextFallbackChildren.subtreeFlags & 31457280)); null !== dehydrated ? (showFallback = createWorkInProgress(dehydrated, showFallback)) : ((showFallback = createFiberFromFragment( @@ -4458,23 +4484,23 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { didSuspend = current.child.memoizedState; null === didSuspend ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) - : ((JSCompiler_temp = didSuspend.cachePool), - null !== JSCompiler_temp + : ((nextFallbackChildren = didSuspend.cachePool), + null !== nextFallbackChildren ? ((dehydrated = CacheContext._currentValue2), - (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated + (nextFallbackChildren = + nextFallbackChildren.parent !== dehydrated ? { parent: dehydrated, pool: dehydrated } - : JSCompiler_temp)) - : (JSCompiler_temp = getSuspendedCache()), + : nextFallbackChildren)) + : (nextFallbackChildren = getSuspendedCache()), (didSuspend = { baseLanes: didSuspend.baseLanes | renderLanes, - cachePool: JSCompiler_temp + cachePool: nextFallbackChildren })); showFallback.memoizedState = didSuspend; enableTransitionTracing && ((didSuspend = enableTransitionTracing ? transitionStack.current : null), null !== didSuspend && - ((JSCompiler_temp = enableTransitionTracing + ((nextFallbackChildren = enableTransitionTracing ? markerInstanceStack.current : null), (dehydrated = showFallback.updateQueue), @@ -4482,40 +4508,44 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { null === dehydrated ? (showFallback.updateQueue = { transitions: didSuspend, - markerInstances: JSCompiler_temp, + markerInstances: nextFallbackChildren, retryQueue: null }) : dehydrated === primaryChildProps ? (showFallback.updateQueue = { transitions: didSuspend, - markerInstances: JSCompiler_temp, + markerInstances: nextFallbackChildren, retryQueue: null !== primaryChildProps ? primaryChildProps.retryQueue : null }) : ((dehydrated.transitions = didSuspend), - (dehydrated.markerInstances = JSCompiler_temp)))); - showFallback.childLanes = current.childLanes & ~renderLanes; + (dehydrated.markerInstances = nextFallbackChildren)))); + showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return nextProps; } pushPrimaryTreeSuspenseHandler(workInProgress); - showFallback = current.child; - current = showFallback.sibling; - nextProps = createWorkInProgress(showFallback, { + JSCompiler_temp = current.child; + current = JSCompiler_temp.sibling; + JSCompiler_temp = createWorkInProgress(JSCompiler_temp, { mode: "visible", children: nextProps.children }); - 0 === (workInProgress.mode & 1) && (nextProps.lanes = renderLanes); - nextProps.return = workInProgress; - nextProps.sibling = null; + 0 === (workInProgress.mode & 1) && (JSCompiler_temp.lanes = renderLanes); + JSCompiler_temp.return = workInProgress; + JSCompiler_temp.sibling = null; null !== current && ((renderLanes = workInProgress.deletions), null === renderLanes ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) : renderLanes.push(current)); - workInProgress.child = nextProps; + workInProgress.child = JSCompiler_temp; workInProgress.memoizedState = null; - return nextProps; + return JSCompiler_temp; } function mountSuspensePrimaryChildren(workInProgress, primaryChildren) { primaryChildren = createFiberFromOffscreen( @@ -4580,6 +4610,7 @@ function updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, @@ -4590,14 +4621,14 @@ function updateDehydratedSuspenseComponent( return ( pushPrimaryTreeSuspenseHandler(workInProgress), (workInProgress.flags &= -257), - (suspenseState = createCapturedValue( + (didPrimaryChildrenDefer = createCapturedValue( Error(formatProdErrorMessage(422)) )), retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, - suspenseState + didPrimaryChildrenDefer ) ); if (null !== workInProgress.memoizedState) @@ -4629,8 +4660,13 @@ function updateDehydratedSuspenseComponent( workInProgress.child = nextProps; 0 !== (workInProgress.mode & 1) && reconcileChildFibers(workInProgress, current.child, null, renderLanes); - workInProgress.child.memoizedState = - mountSuspenseOffscreenState(renderLanes); + nextProps = workInProgress.child; + nextProps.memoizedState = mountSuspenseOffscreenState(renderLanes); + nextProps.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return suspenseState; } @@ -4644,37 +4680,41 @@ function updateDehydratedSuspenseComponent( ); if (shim$2()) return ( - (suspenseState = shim$2().digest), - (nextProps = Error(formatProdErrorMessage(419))), - (nextProps.digest = suspenseState), - (suspenseState = createCapturedValue(nextProps, suspenseState, void 0)), + (didPrimaryChildrenDefer = shim$2().digest), + (suspenseState = Error(formatProdErrorMessage(419))), + (suspenseState.digest = didPrimaryChildrenDefer), + (didPrimaryChildrenDefer = createCapturedValue( + suspenseState, + didPrimaryChildrenDefer, + void 0 + )), retrySuspenseComponentWithoutHydrating( current, workInProgress, renderLanes, - suspenseState + didPrimaryChildrenDefer ) ); enableLazyContextPropagation && !didReceiveUpdate && propagateParentContextChanges(current, workInProgress, renderLanes, !1); - didSuspend = 0 !== (renderLanes & current.childLanes); - if (didReceiveUpdate || didSuspend) { - nextProps = workInProgressRoot; - if (null !== nextProps) { - didSuspend = renderLanes & -renderLanes; - if (enableUnifiedSyncLane && 0 !== (didSuspend & SyncUpdateLanes)) - didSuspend = 1; + didPrimaryChildrenDefer = 0 !== (renderLanes & current.childLanes); + if (didReceiveUpdate || didPrimaryChildrenDefer) { + didPrimaryChildrenDefer = workInProgressRoot; + if (null !== didPrimaryChildrenDefer) { + nextProps = renderLanes & -renderLanes; + if (enableUnifiedSyncLane && 0 !== (nextProps & SyncUpdateLanes)) + nextProps = 1; else - switch (didSuspend) { + switch (nextProps) { case 2: - didSuspend = 1; + nextProps = 1; break; case 8: - didSuspend = 4; + nextProps = 4; break; case 32: - didSuspend = 16; + nextProps = 16; break; case 128: case 256: @@ -4695,23 +4735,24 @@ function updateDehydratedSuspenseComponent( case 8388608: case 16777216: case 33554432: - didSuspend = 64; + nextProps = 64; break; case 268435456: - didSuspend = 134217728; + nextProps = 134217728; break; default: - didSuspend = 0; + nextProps = 0; } - didSuspend = - 0 !== (didSuspend & (nextProps.suspendedLanes | renderLanes)) + nextProps = + 0 !== + (nextProps & (didPrimaryChildrenDefer.suspendedLanes | renderLanes)) ? 0 - : didSuspend; - if (0 !== didSuspend && didSuspend !== suspenseState.retryLane) + : nextProps; + if (0 !== nextProps && nextProps !== suspenseState.retryLane) throw ( - ((suspenseState.retryLane = didSuspend), - enqueueConcurrentRenderForLane(current, didSuspend), - scheduleUpdateOnFiber(nextProps, current, didSuspend), + ((suspenseState.retryLane = nextProps), + enqueueConcurrentRenderForLane(current, nextProps), + scheduleUpdateOnFiber(didPrimaryChildrenDefer, current, nextProps), SelectiveHydrationException) ); } @@ -7922,6 +7963,8 @@ function requestDeferredLane() { 0 !== (workInProgressRootRenderLanes & 536870912) ? 536870912 : requestTransitionLane()); + var suspenseHandler = suspenseHandlerStackCursor.current; + null !== suspenseHandler && (suspenseHandler.flags |= 32); return workInProgressDeferredLane; } function scheduleUpdateOnFiber(root, fiber, lane) { @@ -9908,19 +9951,19 @@ var slice = Array.prototype.slice, }; return Text; })(React.Component), - devToolsConfig$jscomp$inline_1127 = { + devToolsConfig$jscomp$inline_1130 = { findFiberByHostInstance: function () { return null; }, bundleType: 0, - version: "18.3.0-www-modern-6fb46ffb", + version: "18.3.0-www-modern-b4b662e4", rendererPackageName: "react-art" }; -var internals$jscomp$inline_1302 = { - bundleType: devToolsConfig$jscomp$inline_1127.bundleType, - version: devToolsConfig$jscomp$inline_1127.version, - rendererPackageName: devToolsConfig$jscomp$inline_1127.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1127.rendererConfig, +var internals$jscomp$inline_1305 = { + bundleType: devToolsConfig$jscomp$inline_1130.bundleType, + version: devToolsConfig$jscomp$inline_1130.version, + rendererPackageName: devToolsConfig$jscomp$inline_1130.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1130.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -9937,26 +9980,26 @@ var internals$jscomp$inline_1302 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1127.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1130.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-6fb46ffb" + reconcilerVersion: "18.3.0-www-modern-b4b662e4" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1303 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1306 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1303.isDisabled && - hook$jscomp$inline_1303.supportsFiber + !hook$jscomp$inline_1306.isDisabled && + hook$jscomp$inline_1306.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1303.inject( - internals$jscomp$inline_1302 + (rendererID = hook$jscomp$inline_1306.inject( + internals$jscomp$inline_1305 )), - (injectedHook = hook$jscomp$inline_1303); + (injectedHook = hook$jscomp$inline_1306); } 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 30387d9d83610..5d7a3b9f4911d 100644 --- a/compiled/facebook-www/ReactDOM-dev.classic.js +++ b/compiled/facebook-www/ReactDOM-dev.classic.js @@ -514,6 +514,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; + var DidDefer = ContentReset; var LifecycleEffectMask = Passive$1 | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) @@ -20490,9 +20491,26 @@ if (__DEV__) { return hasSuspenseListContext(suspenseContext, ForceSuspenseFallback); } - function getRemainingWorkInPrimaryTree(current, renderLanes) { - // TODO: Should not remove render lanes that were pinged during this render - return removeLanes(current.childLanes, renderLanes); + function getRemainingWorkInPrimaryTree( + current, + primaryTreeDidDefer, + renderLanes + ) { + var remainingLanes = + current !== null + ? removeLanes(current.childLanes, renderLanes) + : NoLanes; + + if (primaryTreeDidDefer) { + // A useDeferredValue hook spawned a deferred task inside the primary tree. + // Ensure that we retry this component at the deferred priority. + // TODO: We could make this a per-subtree value instead of a global one. + // Would need to track it on the context stack somehow, similar to what + // we'd have to do for resumable contexts. + remainingLanes = mergeLanes(remainingLanes, peekDeferredLane()); + } + + return remainingLanes; } function updateSuspenseComponent(current, workInProgress, renderLanes) { @@ -20512,7 +20530,12 @@ if (__DEV__) { // rendering the fallback children. showFallback = true; workInProgress.flags &= ~DidCapture; - } // OK, the next part is confusing. We're about to reconcile the Suspense + } // Check if the primary children spawned a deferred task (useDeferredValue) + // during the first pass. + + var didPrimaryChildrenDefer = + (workInProgress.flags & DidDefer) !== NoFlags$1; + workInProgress.flags &= ~DidDefer; // OK, the next part is confusing. We're about to reconcile the Suspense // boundary's children. This involves some custom reconciliation logic. Two // main reasons this is so complicated. // @@ -20583,6 +20606,11 @@ if (__DEV__) { var primaryChildFragment = workInProgress.child; primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); + primaryChildFragment.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; if (enableTransitionTracing) { @@ -20623,6 +20651,11 @@ if (__DEV__) { var _primaryChildFragment = workInProgress.child; _primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); + _primaryChildFragment.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; // TODO: Transition Tracing is not yet implemented for CPU Suspense. // Since nothing actually suspended, there will nothing to ping this to // get it started back up to attempt the next item. While in terms of @@ -20655,6 +20688,7 @@ if (__DEV__) { current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, _dehydrated, prevState, @@ -20718,6 +20752,7 @@ if (__DEV__) { _primaryChildFragment2.childLanes = getRemainingWorkInPrimaryTree( current, + didPrimaryChildrenDefer, renderLanes ); workInProgress.memoizedState = SUSPENDED_MARKER; @@ -21077,6 +21112,7 @@ if (__DEV__) { current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, @@ -21302,6 +21338,11 @@ if (__DEV__) { var _primaryChildFragment4 = workInProgress.child; _primaryChildFragment4.memoizedState = mountSuspenseOffscreenState(renderLanes); + _primaryChildFragment4.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return fallbackChildFragment; } @@ -30384,10 +30425,22 @@ if (__DEV__) { // Everything else is spawned as a transition. workInProgressDeferredLane = requestTransitionLane(); } + } // Mark the parent Suspense boundary so it knows to spawn the deferred lane. + + var suspenseHandler = getSuspenseHandler(); + + if (suspenseHandler !== null) { + // TODO: As an optimization, we shouldn't entangle the lanes at the root; we + // can entangle them using the baseLanes of the Suspense boundary instead. + // We only need to do something special if there's no Suspense boundary. + suspenseHandler.flags |= DidDefer; } return workInProgressDeferredLane; } + function peekDeferredLane() { + return workInProgressDeferredLane; + } function scheduleUpdateOnFiber(root, fiber, lane) { { if (isRunningInsertionEffect) { @@ -31023,7 +31076,7 @@ if (__DEV__) { // 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, NoLane); + markRootSuspended(root, lanes, workInProgressDeferredLane); ensureRootIsScheduled(root); return null; } // We now have a consistent tree. Because this is a sync render, we @@ -34899,7 +34952,7 @@ if (__DEV__) { return root; } - var ReactVersion = "18.3.0-www-classic-4331ed0d"; + var ReactVersion = "18.3.0-www-classic-54374035"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOM-dev.modern.js b/compiled/facebook-www/ReactDOM-dev.modern.js index 95c623e975870..55872587d4502 100644 --- a/compiled/facebook-www/ReactDOM-dev.modern.js +++ b/compiled/facebook-www/ReactDOM-dev.modern.js @@ -392,6 +392,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; + var DidDefer = ContentReset; var LifecycleEffectMask = Passive$1 | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) @@ -20355,9 +20356,26 @@ if (__DEV__) { return hasSuspenseListContext(suspenseContext, ForceSuspenseFallback); } - function getRemainingWorkInPrimaryTree(current, renderLanes) { - // TODO: Should not remove render lanes that were pinged during this render - return removeLanes(current.childLanes, renderLanes); + function getRemainingWorkInPrimaryTree( + current, + primaryTreeDidDefer, + renderLanes + ) { + var remainingLanes = + current !== null + ? removeLanes(current.childLanes, renderLanes) + : NoLanes; + + if (primaryTreeDidDefer) { + // A useDeferredValue hook spawned a deferred task inside the primary tree. + // Ensure that we retry this component at the deferred priority. + // TODO: We could make this a per-subtree value instead of a global one. + // Would need to track it on the context stack somehow, similar to what + // we'd have to do for resumable contexts. + remainingLanes = mergeLanes(remainingLanes, peekDeferredLane()); + } + + return remainingLanes; } function updateSuspenseComponent(current, workInProgress, renderLanes) { @@ -20377,7 +20395,12 @@ if (__DEV__) { // rendering the fallback children. showFallback = true; workInProgress.flags &= ~DidCapture; - } // OK, the next part is confusing. We're about to reconcile the Suspense + } // Check if the primary children spawned a deferred task (useDeferredValue) + // during the first pass. + + var didPrimaryChildrenDefer = + (workInProgress.flags & DidDefer) !== NoFlags$1; + workInProgress.flags &= ~DidDefer; // OK, the next part is confusing. We're about to reconcile the Suspense // boundary's children. This involves some custom reconciliation logic. Two // main reasons this is so complicated. // @@ -20448,6 +20471,11 @@ if (__DEV__) { var primaryChildFragment = workInProgress.child; primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); + primaryChildFragment.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; if (enableTransitionTracing) { @@ -20488,6 +20516,11 @@ if (__DEV__) { var _primaryChildFragment = workInProgress.child; _primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); + _primaryChildFragment.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; // TODO: Transition Tracing is not yet implemented for CPU Suspense. // Since nothing actually suspended, there will nothing to ping this to // get it started back up to attempt the next item. While in terms of @@ -20520,6 +20553,7 @@ if (__DEV__) { current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, _dehydrated, prevState, @@ -20583,6 +20617,7 @@ if (__DEV__) { _primaryChildFragment2.childLanes = getRemainingWorkInPrimaryTree( current, + didPrimaryChildrenDefer, renderLanes ); workInProgress.memoizedState = SUSPENDED_MARKER; @@ -20942,6 +20977,7 @@ if (__DEV__) { current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, @@ -21167,6 +21203,11 @@ if (__DEV__) { var _primaryChildFragment4 = workInProgress.child; _primaryChildFragment4.memoizedState = mountSuspenseOffscreenState(renderLanes); + _primaryChildFragment4.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return fallbackChildFragment; } @@ -30214,10 +30255,22 @@ if (__DEV__) { // Everything else is spawned as a transition. workInProgressDeferredLane = requestTransitionLane(); } + } // Mark the parent Suspense boundary so it knows to spawn the deferred lane. + + var suspenseHandler = getSuspenseHandler(); + + if (suspenseHandler !== null) { + // TODO: As an optimization, we shouldn't entangle the lanes at the root; we + // can entangle them using the baseLanes of the Suspense boundary instead. + // We only need to do something special if there's no Suspense boundary. + suspenseHandler.flags |= DidDefer; } return workInProgressDeferredLane; } + function peekDeferredLane() { + return workInProgressDeferredLane; + } function scheduleUpdateOnFiber(root, fiber, lane) { { if (isRunningInsertionEffect) { @@ -30853,7 +30906,7 @@ if (__DEV__) { // 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, NoLane); + markRootSuspended(root, lanes, workInProgressDeferredLane); ensureRootIsScheduled(root); return null; } // We now have a consistent tree. Because this is a sync render, we @@ -34720,7 +34773,7 @@ if (__DEV__) { return root; } - var ReactVersion = "18.3.0-www-modern-67189941"; + var ReactVersion = "18.3.0-www-modern-799b2444"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOM-prod.classic.js b/compiled/facebook-www/ReactDOM-prod.classic.js index 6ab2b6a60b9a2..bb213abc57ab6 100644 --- a/compiled/facebook-www/ReactDOM-prod.classic.js +++ b/compiled/facebook-www/ReactDOM-prod.classic.js @@ -3124,7 +3124,7 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { ? markRootSuspended( workInProgressRootRenderLanes$50, nextLanes, - 0 + workInProgressDeferredLane ) : ((workInProgressRootRenderLanes$50.finishedWork = workInProgressRootRenderLanes$50.current.alternate), @@ -5566,6 +5566,15 @@ var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: 0 }; function mountSuspenseOffscreenState(renderLanes) { return { baseLanes: renderLanes, cachePool: getSuspendedCache() }; } +function getRemainingWorkInPrimaryTree( + current, + primaryTreeDidDefer, + renderLanes +) { + current = null !== current ? current.childLanes & ~renderLanes : 0; + primaryTreeDidDefer && (current |= workInProgressDeferredLane); + return current; +} function updateSuspenseComponent(current, workInProgress, renderLanes) { var nextProps = workInProgress.pendingProps, showFallback = !1, @@ -5577,64 +5586,69 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? !1 : 0 !== (suspenseStackCursor.current & 2)); JSCompiler_temp && ((showFallback = !0), (workInProgress.flags &= -129)); + JSCompiler_temp = 0 !== (workInProgress.flags & 32); + workInProgress.flags &= -33; if (null === current) { if (isHydrating) { showFallback ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); - isHydrating && - (((didSuspend = current = nextHydratableInstance), didSuspend) - ? tryHydrateSuspense(workInProgress, didSuspend) || - (shouldClientRenderOnMismatch(workInProgress) && - throwOnHydrationMismatch(), - (nextHydratableInstance = getNextHydratable( - didSuspend.nextSibling - )), - (JSCompiler_temp = hydrationParentFiber), - nextHydratableInstance && - tryHydrateSuspense(workInProgress, nextHydratableInstance) - ? deleteHydratableInstance(JSCompiler_temp, didSuspend) - : (insertNonHydratedInstance( - hydrationParentFiber, - workInProgress - ), - (isHydrating = !1), - (hydrationParentFiber = workInProgress), - (nextHydratableInstance = current))) - : (shouldClientRenderOnMismatch(workInProgress) && - throwOnHydrationMismatch(), + if (isHydrating) { + var nextInstance = (didSuspend = nextHydratableInstance); + if (!nextInstance) + shouldClientRenderOnMismatch(workInProgress) && + throwOnHydrationMismatch(), insertNonHydratedInstance(hydrationParentFiber, workInProgress), (isHydrating = !1), (hydrationParentFiber = workInProgress), - (nextHydratableInstance = current))); - current = workInProgress.memoizedState; + (nextHydratableInstance = didSuspend); + else if (!tryHydrateSuspense(workInProgress, nextInstance)) { + shouldClientRenderOnMismatch(workInProgress) && + throwOnHydrationMismatch(); + nextHydratableInstance = getNextHydratable(nextInstance.nextSibling); + var prevHydrationParentFiber = hydrationParentFiber; + nextHydratableInstance && + tryHydrateSuspense(workInProgress, nextHydratableInstance) + ? deleteHydratableInstance(prevHydrationParentFiber, nextInstance) + : (insertNonHydratedInstance(hydrationParentFiber, workInProgress), + (isHydrating = !1), + (hydrationParentFiber = workInProgress), + (nextHydratableInstance = didSuspend)); + } + } + didSuspend = workInProgress.memoizedState; if ( - null !== current && - ((current = current.dehydrated), null !== current) + null !== didSuspend && + ((didSuspend = didSuspend.dehydrated), null !== didSuspend) ) return ( 0 === (workInProgress.mode & 1) ? (workInProgress.lanes = 2) - : "$!" === current.data + : "$!" === didSuspend.data ? (workInProgress.lanes = 16) : (workInProgress.lanes = 536870912), null ); popSuspenseHandler(workInProgress); } - current = nextProps.children; - didSuspend = nextProps.fallback; + didSuspend = nextProps.children; + nextInstance = nextProps.fallback; if (showFallback) return ( reuseSuspenseHandlerOnStack(workInProgress), - (current = mountSuspenseFallbackChildren( + (nextProps = mountSuspenseFallbackChildren( workInProgress, - current, didSuspend, + nextInstance, + renderLanes + )), + (showFallback = workInProgress.child), + (showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes)), + (showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, renderLanes )), - (nextProps = workInProgress.child), - (nextProps.memoizedState = mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), enableTransitionTracing && ((workInProgress = enableTransitionTracing @@ -5644,65 +5658,75 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ((renderLanes = enableTransitionTracing ? markerInstanceStack.current : null), - (showFallback = nextProps.updateQueue), - null === showFallback - ? (nextProps.updateQueue = { + (current = showFallback.updateQueue), + null === current + ? (showFallback.updateQueue = { transitions: workInProgress, markerInstances: renderLanes, retryQueue: null }) - : ((showFallback.transitions = workInProgress), - (showFallback.markerInstances = renderLanes)))), - current + : ((current.transitions = workInProgress), + (current.markerInstances = renderLanes)))), + nextProps ); if ("number" === typeof nextProps.unstable_expectedLoadTime) return ( reuseSuspenseHandlerOnStack(workInProgress), - (current = mountSuspenseFallbackChildren( + (nextProps = mountSuspenseFallbackChildren( workInProgress, - current, didSuspend, + nextInstance, + renderLanes + )), + (showFallback = workInProgress.child), + (showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes)), + (showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, renderLanes )), - (workInProgress.child.memoizedState = - mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - current + nextProps ); pushPrimaryTreeSuspenseHandler(workInProgress); - return mountSuspensePrimaryChildren(workInProgress, current); - } - JSCompiler_temp = current.memoizedState; - if (null !== JSCompiler_temp) { - var dehydrated$76 = JSCompiler_temp.dehydrated; - if (null !== dehydrated$76) - return updateDehydratedSuspenseComponent( - current, - workInProgress, - didSuspend, - nextProps, - dehydrated$76, - JSCompiler_temp, - renderLanes - ); + return mountSuspensePrimaryChildren(workInProgress, didSuspend); } + nextInstance = current.memoizedState; + if ( + null !== nextInstance && + ((prevHydrationParentFiber = nextInstance.dehydrated), + null !== prevHydrationParentFiber) + ) + return updateDehydratedSuspenseComponent( + current, + workInProgress, + didSuspend, + JSCompiler_temp, + nextProps, + prevHydrationParentFiber, + nextInstance, + renderLanes + ); if (showFallback) { reuseSuspenseHandlerOnStack(workInProgress); showFallback = nextProps.fallback; didSuspend = workInProgress.mode; - JSCompiler_temp = current.child; - dehydrated$76 = JSCompiler_temp.sibling; + nextInstance = current.child; + prevHydrationParentFiber = nextInstance.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; - 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp + 0 === (didSuspend & 1) && workInProgress.child !== nextInstance ? ((nextProps = workInProgress.child), (nextProps.childLanes = 0), (nextProps.pendingProps = primaryChildProps), (workInProgress.deletions = null)) - : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), - (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280)); - null !== dehydrated$76 - ? (showFallback = createWorkInProgress(dehydrated$76, showFallback)) + : ((nextProps = createWorkInProgress(nextInstance, primaryChildProps)), + (nextProps.subtreeFlags = nextInstance.subtreeFlags & 31457280)); + null !== prevHydrationParentFiber + ? (showFallback = createWorkInProgress( + prevHydrationParentFiber, + showFallback + )) : ((showFallback = createFiberFromFragment( showFallback, didSuspend, @@ -5719,64 +5743,71 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { didSuspend = current.child.memoizedState; null === didSuspend ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) - : ((JSCompiler_temp = didSuspend.cachePool), - null !== JSCompiler_temp - ? ((dehydrated$76 = CacheContext._currentValue), - (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated$76 - ? { parent: dehydrated$76, pool: dehydrated$76 } - : JSCompiler_temp)) - : (JSCompiler_temp = getSuspendedCache()), + : ((nextInstance = didSuspend.cachePool), + null !== nextInstance + ? ((prevHydrationParentFiber = CacheContext._currentValue), + (nextInstance = + nextInstance.parent !== prevHydrationParentFiber + ? { + parent: prevHydrationParentFiber, + pool: prevHydrationParentFiber + } + : nextInstance)) + : (nextInstance = getSuspendedCache()), (didSuspend = { baseLanes: didSuspend.baseLanes | renderLanes, - cachePool: JSCompiler_temp + cachePool: nextInstance })); showFallback.memoizedState = didSuspend; enableTransitionTracing && ((didSuspend = enableTransitionTracing ? transitionStack.current : null), null !== didSuspend && - ((JSCompiler_temp = enableTransitionTracing + ((nextInstance = enableTransitionTracing ? markerInstanceStack.current : null), - (dehydrated$76 = showFallback.updateQueue), + (prevHydrationParentFiber = showFallback.updateQueue), (primaryChildProps = current.updateQueue), - null === dehydrated$76 + null === prevHydrationParentFiber ? (showFallback.updateQueue = { transitions: didSuspend, - markerInstances: JSCompiler_temp, + markerInstances: nextInstance, retryQueue: null }) - : dehydrated$76 === primaryChildProps + : prevHydrationParentFiber === primaryChildProps ? (showFallback.updateQueue = { transitions: didSuspend, - markerInstances: JSCompiler_temp, + markerInstances: nextInstance, retryQueue: null !== primaryChildProps ? primaryChildProps.retryQueue : null }) - : ((dehydrated$76.transitions = didSuspend), - (dehydrated$76.markerInstances = JSCompiler_temp)))); - showFallback.childLanes = current.childLanes & ~renderLanes; + : ((prevHydrationParentFiber.transitions = didSuspend), + (prevHydrationParentFiber.markerInstances = nextInstance)))); + showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return nextProps; } pushPrimaryTreeSuspenseHandler(workInProgress); - showFallback = current.child; - current = showFallback.sibling; - nextProps = createWorkInProgress(showFallback, { + JSCompiler_temp = current.child; + current = JSCompiler_temp.sibling; + JSCompiler_temp = createWorkInProgress(JSCompiler_temp, { mode: "visible", children: nextProps.children }); - 0 === (workInProgress.mode & 1) && (nextProps.lanes = renderLanes); - nextProps.return = workInProgress; - nextProps.sibling = null; + 0 === (workInProgress.mode & 1) && (JSCompiler_temp.lanes = renderLanes); + JSCompiler_temp.return = workInProgress; + JSCompiler_temp.sibling = null; null !== current && ((renderLanes = workInProgress.deletions), null === renderLanes ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) : renderLanes.push(current)); - workInProgress.child = nextProps; + workInProgress.child = JSCompiler_temp; workInProgress.memoizedState = null; - return nextProps; + return JSCompiler_temp; } function mountSuspensePrimaryChildren(workInProgress, primaryChildren) { primaryChildren = createFiberFromOffscreen( @@ -5838,6 +5869,7 @@ function updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, @@ -5887,8 +5919,13 @@ function updateDehydratedSuspenseComponent( workInProgress.child = nextProps; 0 !== (workInProgress.mode & 1) && reconcileChildFibers(workInProgress, current.child, null, renderLanes); - workInProgress.child.memoizedState = - mountSuspenseOffscreenState(renderLanes); + suspenseState = workInProgress.child; + suspenseState.memoizedState = mountSuspenseOffscreenState(renderLanes); + suspenseState.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return suspenseInstance; } @@ -5905,10 +5942,10 @@ function updateDehydratedSuspenseComponent( suspenseInstance.nextSibling && suspenseInstance.nextSibling.dataset; if (suspenseInstance) var digest = suspenseInstance.dgst; suspenseInstance = digest; - suspenseState = Error(formatProdErrorMessage(419)); - suspenseState.digest = suspenseInstance; + didPrimaryChildrenDefer = Error(formatProdErrorMessage(419)); + didPrimaryChildrenDefer.digest = suspenseInstance; suspenseInstance = createCapturedValue( - suspenseState, + didPrimaryChildrenDefer, suspenseInstance, void 0 ); @@ -5922,22 +5959,23 @@ function updateDehydratedSuspenseComponent( enableLazyContextPropagation && !didReceiveUpdate && propagateParentContextChanges(current, workInProgress, renderLanes, !1); - digest = 0 !== (renderLanes & current.childLanes); - if (didReceiveUpdate || digest) { - nextProps = workInProgressRoot; - if (null !== nextProps) { - digest = renderLanes & -renderLanes; - if (enableUnifiedSyncLane && 0 !== (digest & SyncUpdateLanes)) digest = 1; + didPrimaryChildrenDefer = 0 !== (renderLanes & current.childLanes); + if (didReceiveUpdate || didPrimaryChildrenDefer) { + didPrimaryChildrenDefer = workInProgressRoot; + if (null !== didPrimaryChildrenDefer) { + nextProps = renderLanes & -renderLanes; + if (enableUnifiedSyncLane && 0 !== (nextProps & SyncUpdateLanes)) + nextProps = 1; else - switch (digest) { + switch (nextProps) { case 2: - digest = 1; + nextProps = 1; break; case 8: - digest = 4; + nextProps = 4; break; case 32: - digest = 16; + nextProps = 16; break; case 128: case 256: @@ -5958,21 +5996,24 @@ function updateDehydratedSuspenseComponent( case 8388608: case 16777216: case 33554432: - digest = 64; + nextProps = 64; break; case 268435456: - digest = 134217728; + nextProps = 134217728; break; default: - digest = 0; + nextProps = 0; } - digest = - 0 !== (digest & (nextProps.suspendedLanes | renderLanes)) ? 0 : digest; - if (0 !== digest && digest !== suspenseState.retryLane) + nextProps = + 0 !== + (nextProps & (didPrimaryChildrenDefer.suspendedLanes | renderLanes)) + ? 0 + : nextProps; + if (0 !== nextProps && nextProps !== suspenseState.retryLane) throw ( - ((suspenseState.retryLane = digest), - enqueueConcurrentRenderForLane(current, digest), - scheduleUpdateOnFiber(nextProps, current, digest), + ((suspenseState.retryLane = nextProps), + enqueueConcurrentRenderForLane(current, nextProps), + scheduleUpdateOnFiber(didPrimaryChildrenDefer, current, nextProps), SelectiveHydrationException) ); } @@ -9932,6 +9973,8 @@ function requestDeferredLane() { 0 === (workInProgressRootRenderLanes & 536870912) || isHydrating ? requestTransitionLane() : 536870912); + var suspenseHandler = suspenseHandlerStackCursor.current; + null !== suspenseHandler && (suspenseHandler.flags |= 32); return workInProgressDeferredLane; } function scheduleUpdateOnFiber(root, fiber, lane) { @@ -12659,14 +12702,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$345; if (canUseDOM) { - var isSupported$jscomp$inline_1529 = "oninput" in document; - if (!isSupported$jscomp$inline_1529) { - var element$jscomp$inline_1530 = document.createElement("div"); - element$jscomp$inline_1530.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1529 = - "function" === typeof element$jscomp$inline_1530.oninput; + var isSupported$jscomp$inline_1532 = "oninput" in document; + if (!isSupported$jscomp$inline_1532) { + var element$jscomp$inline_1533 = document.createElement("div"); + element$jscomp$inline_1533.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1532 = + "function" === typeof element$jscomp$inline_1533.oninput; } - JSCompiler_inline_result$jscomp$345 = isSupported$jscomp$inline_1529; + JSCompiler_inline_result$jscomp$345 = isSupported$jscomp$inline_1532; } else JSCompiler_inline_result$jscomp$345 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$345 && @@ -12978,20 +13021,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1570 = 0; - i$jscomp$inline_1570 < simpleEventPluginEvents.length; - i$jscomp$inline_1570++ + var i$jscomp$inline_1573 = 0; + i$jscomp$inline_1573 < simpleEventPluginEvents.length; + i$jscomp$inline_1573++ ) { - var eventName$jscomp$inline_1571 = - simpleEventPluginEvents[i$jscomp$inline_1570], - domEventName$jscomp$inline_1572 = - eventName$jscomp$inline_1571.toLowerCase(), - capitalizedEvent$jscomp$inline_1573 = - eventName$jscomp$inline_1571[0].toUpperCase() + - eventName$jscomp$inline_1571.slice(1); + var eventName$jscomp$inline_1574 = + simpleEventPluginEvents[i$jscomp$inline_1573], + domEventName$jscomp$inline_1575 = + eventName$jscomp$inline_1574.toLowerCase(), + capitalizedEvent$jscomp$inline_1576 = + eventName$jscomp$inline_1574[0].toUpperCase() + + eventName$jscomp$inline_1574.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1572, - "on" + capitalizedEvent$jscomp$inline_1573 + domEventName$jscomp$inline_1575, + "on" + capitalizedEvent$jscomp$inline_1576 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16545,17 +16588,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1796 = { +var devToolsConfig$jscomp$inline_1799 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-d29344b1", + version: "18.3.0-www-classic-d69635bb", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2142 = { - bundleType: devToolsConfig$jscomp$inline_1796.bundleType, - version: devToolsConfig$jscomp$inline_1796.version, - rendererPackageName: devToolsConfig$jscomp$inline_1796.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1796.rendererConfig, +var internals$jscomp$inline_2145 = { + bundleType: devToolsConfig$jscomp$inline_1799.bundleType, + version: devToolsConfig$jscomp$inline_1799.version, + rendererPackageName: devToolsConfig$jscomp$inline_1799.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1799.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16571,26 +16614,26 @@ var internals$jscomp$inline_2142 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1796.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1799.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-d29344b1" + reconcilerVersion: "18.3.0-www-classic-d69635bb" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2143 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2146 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2143.isDisabled && - hook$jscomp$inline_2143.supportsFiber + !hook$jscomp$inline_2146.isDisabled && + hook$jscomp$inline_2146.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2143.inject( - internals$jscomp$inline_2142 + (rendererID = hook$jscomp$inline_2146.inject( + internals$jscomp$inline_2145 )), - (injectedHook = hook$jscomp$inline_2143); + (injectedHook = hook$jscomp$inline_2146); } catch (err) {} } assign(Internals, { @@ -16915,4 +16958,4 @@ exports.useFormState = function () { exports.useFormStatus = function () { throw Error(formatProdErrorMessage(248)); }; -exports.version = "18.3.0-www-classic-d29344b1"; +exports.version = "18.3.0-www-classic-d69635bb"; diff --git a/compiled/facebook-www/ReactDOM-prod.modern.js b/compiled/facebook-www/ReactDOM-prod.modern.js index d477970ae0e42..dd96fdbcfb317 100644 --- a/compiled/facebook-www/ReactDOM-prod.modern.js +++ b/compiled/facebook-www/ReactDOM-prod.modern.js @@ -3021,7 +3021,7 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { ? markRootSuspended( workInProgressRootRenderLanes$50, nextLanes, - 0 + workInProgressDeferredLane ) : ((workInProgressRootRenderLanes$50.finishedWork = workInProgressRootRenderLanes$50.current.alternate), @@ -5416,6 +5416,15 @@ var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: 0 }; function mountSuspenseOffscreenState(renderLanes) { return { baseLanes: renderLanes, cachePool: getSuspendedCache() }; } +function getRemainingWorkInPrimaryTree( + current, + primaryTreeDidDefer, + renderLanes +) { + current = null !== current ? current.childLanes & ~renderLanes : 0; + primaryTreeDidDefer && (current |= workInProgressDeferredLane); + return current; +} function updateSuspenseComponent(current, workInProgress, renderLanes) { var nextProps = workInProgress.pendingProps, showFallback = !1, @@ -5427,64 +5436,69 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? !1 : 0 !== (suspenseStackCursor.current & 2)); JSCompiler_temp && ((showFallback = !0), (workInProgress.flags &= -129)); + JSCompiler_temp = 0 !== (workInProgress.flags & 32); + workInProgress.flags &= -33; if (null === current) { if (isHydrating) { showFallback ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); - isHydrating && - (((didSuspend = current = nextHydratableInstance), didSuspend) - ? tryHydrateSuspense(workInProgress, didSuspend) || - (shouldClientRenderOnMismatch(workInProgress) && - throwOnHydrationMismatch(), - (nextHydratableInstance = getNextHydratable( - didSuspend.nextSibling - )), - (JSCompiler_temp = hydrationParentFiber), - nextHydratableInstance && - tryHydrateSuspense(workInProgress, nextHydratableInstance) - ? deleteHydratableInstance(JSCompiler_temp, didSuspend) - : (insertNonHydratedInstance( - hydrationParentFiber, - workInProgress - ), - (isHydrating = !1), - (hydrationParentFiber = workInProgress), - (nextHydratableInstance = current))) - : (shouldClientRenderOnMismatch(workInProgress) && - throwOnHydrationMismatch(), + if (isHydrating) { + var nextInstance = (didSuspend = nextHydratableInstance); + if (!nextInstance) + shouldClientRenderOnMismatch(workInProgress) && + throwOnHydrationMismatch(), insertNonHydratedInstance(hydrationParentFiber, workInProgress), (isHydrating = !1), (hydrationParentFiber = workInProgress), - (nextHydratableInstance = current))); - current = workInProgress.memoizedState; + (nextHydratableInstance = didSuspend); + else if (!tryHydrateSuspense(workInProgress, nextInstance)) { + shouldClientRenderOnMismatch(workInProgress) && + throwOnHydrationMismatch(); + nextHydratableInstance = getNextHydratable(nextInstance.nextSibling); + var prevHydrationParentFiber = hydrationParentFiber; + nextHydratableInstance && + tryHydrateSuspense(workInProgress, nextHydratableInstance) + ? deleteHydratableInstance(prevHydrationParentFiber, nextInstance) + : (insertNonHydratedInstance(hydrationParentFiber, workInProgress), + (isHydrating = !1), + (hydrationParentFiber = workInProgress), + (nextHydratableInstance = didSuspend)); + } + } + didSuspend = workInProgress.memoizedState; if ( - null !== current && - ((current = current.dehydrated), null !== current) + null !== didSuspend && + ((didSuspend = didSuspend.dehydrated), null !== didSuspend) ) return ( 0 === (workInProgress.mode & 1) ? (workInProgress.lanes = 2) - : "$!" === current.data + : "$!" === didSuspend.data ? (workInProgress.lanes = 16) : (workInProgress.lanes = 536870912), null ); popSuspenseHandler(workInProgress); } - current = nextProps.children; - didSuspend = nextProps.fallback; + didSuspend = nextProps.children; + nextInstance = nextProps.fallback; if (showFallback) return ( reuseSuspenseHandlerOnStack(workInProgress), - (current = mountSuspenseFallbackChildren( + (nextProps = mountSuspenseFallbackChildren( workInProgress, - current, didSuspend, + nextInstance, + renderLanes + )), + (showFallback = workInProgress.child), + (showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes)), + (showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, renderLanes )), - (nextProps = workInProgress.child), - (nextProps.memoizedState = mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), enableTransitionTracing && ((workInProgress = enableTransitionTracing @@ -5494,65 +5508,75 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ((renderLanes = enableTransitionTracing ? markerInstanceStack.current : null), - (showFallback = nextProps.updateQueue), - null === showFallback - ? (nextProps.updateQueue = { + (current = showFallback.updateQueue), + null === current + ? (showFallback.updateQueue = { transitions: workInProgress, markerInstances: renderLanes, retryQueue: null }) - : ((showFallback.transitions = workInProgress), - (showFallback.markerInstances = renderLanes)))), - current + : ((current.transitions = workInProgress), + (current.markerInstances = renderLanes)))), + nextProps ); if ("number" === typeof nextProps.unstable_expectedLoadTime) return ( reuseSuspenseHandlerOnStack(workInProgress), - (current = mountSuspenseFallbackChildren( + (nextProps = mountSuspenseFallbackChildren( workInProgress, - current, didSuspend, + nextInstance, + renderLanes + )), + (showFallback = workInProgress.child), + (showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes)), + (showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, renderLanes )), - (workInProgress.child.memoizedState = - mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - current + nextProps ); pushPrimaryTreeSuspenseHandler(workInProgress); - return mountSuspensePrimaryChildren(workInProgress, current); - } - JSCompiler_temp = current.memoizedState; - if (null !== JSCompiler_temp) { - var dehydrated$76 = JSCompiler_temp.dehydrated; - if (null !== dehydrated$76) - return updateDehydratedSuspenseComponent( - current, - workInProgress, - didSuspend, - nextProps, - dehydrated$76, - JSCompiler_temp, - renderLanes - ); + return mountSuspensePrimaryChildren(workInProgress, didSuspend); } + nextInstance = current.memoizedState; + if ( + null !== nextInstance && + ((prevHydrationParentFiber = nextInstance.dehydrated), + null !== prevHydrationParentFiber) + ) + return updateDehydratedSuspenseComponent( + current, + workInProgress, + didSuspend, + JSCompiler_temp, + nextProps, + prevHydrationParentFiber, + nextInstance, + renderLanes + ); if (showFallback) { reuseSuspenseHandlerOnStack(workInProgress); showFallback = nextProps.fallback; didSuspend = workInProgress.mode; - JSCompiler_temp = current.child; - dehydrated$76 = JSCompiler_temp.sibling; + nextInstance = current.child; + prevHydrationParentFiber = nextInstance.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; - 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp + 0 === (didSuspend & 1) && workInProgress.child !== nextInstance ? ((nextProps = workInProgress.child), (nextProps.childLanes = 0), (nextProps.pendingProps = primaryChildProps), (workInProgress.deletions = null)) - : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), - (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280)); - null !== dehydrated$76 - ? (showFallback = createWorkInProgress(dehydrated$76, showFallback)) + : ((nextProps = createWorkInProgress(nextInstance, primaryChildProps)), + (nextProps.subtreeFlags = nextInstance.subtreeFlags & 31457280)); + null !== prevHydrationParentFiber + ? (showFallback = createWorkInProgress( + prevHydrationParentFiber, + showFallback + )) : ((showFallback = createFiberFromFragment( showFallback, didSuspend, @@ -5569,64 +5593,71 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { didSuspend = current.child.memoizedState; null === didSuspend ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) - : ((JSCompiler_temp = didSuspend.cachePool), - null !== JSCompiler_temp - ? ((dehydrated$76 = CacheContext._currentValue), - (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated$76 - ? { parent: dehydrated$76, pool: dehydrated$76 } - : JSCompiler_temp)) - : (JSCompiler_temp = getSuspendedCache()), + : ((nextInstance = didSuspend.cachePool), + null !== nextInstance + ? ((prevHydrationParentFiber = CacheContext._currentValue), + (nextInstance = + nextInstance.parent !== prevHydrationParentFiber + ? { + parent: prevHydrationParentFiber, + pool: prevHydrationParentFiber + } + : nextInstance)) + : (nextInstance = getSuspendedCache()), (didSuspend = { baseLanes: didSuspend.baseLanes | renderLanes, - cachePool: JSCompiler_temp + cachePool: nextInstance })); showFallback.memoizedState = didSuspend; enableTransitionTracing && ((didSuspend = enableTransitionTracing ? transitionStack.current : null), null !== didSuspend && - ((JSCompiler_temp = enableTransitionTracing + ((nextInstance = enableTransitionTracing ? markerInstanceStack.current : null), - (dehydrated$76 = showFallback.updateQueue), + (prevHydrationParentFiber = showFallback.updateQueue), (primaryChildProps = current.updateQueue), - null === dehydrated$76 + null === prevHydrationParentFiber ? (showFallback.updateQueue = { transitions: didSuspend, - markerInstances: JSCompiler_temp, + markerInstances: nextInstance, retryQueue: null }) - : dehydrated$76 === primaryChildProps + : prevHydrationParentFiber === primaryChildProps ? (showFallback.updateQueue = { transitions: didSuspend, - markerInstances: JSCompiler_temp, + markerInstances: nextInstance, retryQueue: null !== primaryChildProps ? primaryChildProps.retryQueue : null }) - : ((dehydrated$76.transitions = didSuspend), - (dehydrated$76.markerInstances = JSCompiler_temp)))); - showFallback.childLanes = current.childLanes & ~renderLanes; + : ((prevHydrationParentFiber.transitions = didSuspend), + (prevHydrationParentFiber.markerInstances = nextInstance)))); + showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return nextProps; } pushPrimaryTreeSuspenseHandler(workInProgress); - showFallback = current.child; - current = showFallback.sibling; - nextProps = createWorkInProgress(showFallback, { + JSCompiler_temp = current.child; + current = JSCompiler_temp.sibling; + JSCompiler_temp = createWorkInProgress(JSCompiler_temp, { mode: "visible", children: nextProps.children }); - 0 === (workInProgress.mode & 1) && (nextProps.lanes = renderLanes); - nextProps.return = workInProgress; - nextProps.sibling = null; + 0 === (workInProgress.mode & 1) && (JSCompiler_temp.lanes = renderLanes); + JSCompiler_temp.return = workInProgress; + JSCompiler_temp.sibling = null; null !== current && ((renderLanes = workInProgress.deletions), null === renderLanes ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) : renderLanes.push(current)); - workInProgress.child = nextProps; + workInProgress.child = JSCompiler_temp; workInProgress.memoizedState = null; - return nextProps; + return JSCompiler_temp; } function mountSuspensePrimaryChildren(workInProgress, primaryChildren) { primaryChildren = createFiberFromOffscreen( @@ -5688,6 +5719,7 @@ function updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, @@ -5737,8 +5769,13 @@ function updateDehydratedSuspenseComponent( workInProgress.child = nextProps; 0 !== (workInProgress.mode & 1) && reconcileChildFibers(workInProgress, current.child, null, renderLanes); - workInProgress.child.memoizedState = - mountSuspenseOffscreenState(renderLanes); + suspenseState = workInProgress.child; + suspenseState.memoizedState = mountSuspenseOffscreenState(renderLanes); + suspenseState.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return suspenseInstance; } @@ -5755,10 +5792,10 @@ function updateDehydratedSuspenseComponent( suspenseInstance.nextSibling && suspenseInstance.nextSibling.dataset; if (suspenseInstance) var digest = suspenseInstance.dgst; suspenseInstance = digest; - suspenseState = Error(formatProdErrorMessage(419)); - suspenseState.digest = suspenseInstance; + didPrimaryChildrenDefer = Error(formatProdErrorMessage(419)); + didPrimaryChildrenDefer.digest = suspenseInstance; suspenseInstance = createCapturedValue( - suspenseState, + didPrimaryChildrenDefer, suspenseInstance, void 0 ); @@ -5772,22 +5809,23 @@ function updateDehydratedSuspenseComponent( enableLazyContextPropagation && !didReceiveUpdate && propagateParentContextChanges(current, workInProgress, renderLanes, !1); - digest = 0 !== (renderLanes & current.childLanes); - if (didReceiveUpdate || digest) { - nextProps = workInProgressRoot; - if (null !== nextProps) { - digest = renderLanes & -renderLanes; - if (enableUnifiedSyncLane && 0 !== (digest & SyncUpdateLanes)) digest = 1; + didPrimaryChildrenDefer = 0 !== (renderLanes & current.childLanes); + if (didReceiveUpdate || didPrimaryChildrenDefer) { + didPrimaryChildrenDefer = workInProgressRoot; + if (null !== didPrimaryChildrenDefer) { + nextProps = renderLanes & -renderLanes; + if (enableUnifiedSyncLane && 0 !== (nextProps & SyncUpdateLanes)) + nextProps = 1; else - switch (digest) { + switch (nextProps) { case 2: - digest = 1; + nextProps = 1; break; case 8: - digest = 4; + nextProps = 4; break; case 32: - digest = 16; + nextProps = 16; break; case 128: case 256: @@ -5808,21 +5846,24 @@ function updateDehydratedSuspenseComponent( case 8388608: case 16777216: case 33554432: - digest = 64; + nextProps = 64; break; case 268435456: - digest = 134217728; + nextProps = 134217728; break; default: - digest = 0; + nextProps = 0; } - digest = - 0 !== (digest & (nextProps.suspendedLanes | renderLanes)) ? 0 : digest; - if (0 !== digest && digest !== suspenseState.retryLane) + nextProps = + 0 !== + (nextProps & (didPrimaryChildrenDefer.suspendedLanes | renderLanes)) + ? 0 + : nextProps; + if (0 !== nextProps && nextProps !== suspenseState.retryLane) throw ( - ((suspenseState.retryLane = digest), - enqueueConcurrentRenderForLane(current, digest), - scheduleUpdateOnFiber(nextProps, current, digest), + ((suspenseState.retryLane = nextProps), + enqueueConcurrentRenderForLane(current, nextProps), + scheduleUpdateOnFiber(didPrimaryChildrenDefer, current, nextProps), SelectiveHydrationException) ); } @@ -9772,6 +9813,8 @@ function requestDeferredLane() { 0 === (workInProgressRootRenderLanes & 536870912) || isHydrating ? requestTransitionLane() : 536870912); + var suspenseHandler = suspenseHandlerStackCursor.current; + null !== suspenseHandler && (suspenseHandler.flags |= 32); return workInProgressDeferredLane; } function scheduleUpdateOnFiber(root, fiber, lane) { @@ -12903,14 +12946,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$343; if (canUseDOM) { - 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; + var isSupported$jscomp$inline_1531 = "oninput" in document; + if (!isSupported$jscomp$inline_1531) { + var element$jscomp$inline_1532 = document.createElement("div"); + element$jscomp$inline_1532.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1531 = + "function" === typeof element$jscomp$inline_1532.oninput; } - JSCompiler_inline_result$jscomp$343 = isSupported$jscomp$inline_1528; + JSCompiler_inline_result$jscomp$343 = isSupported$jscomp$inline_1531; } else JSCompiler_inline_result$jscomp$343 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$343 && @@ -13222,20 +13265,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1569 = 0; - i$jscomp$inline_1569 < simpleEventPluginEvents.length; - i$jscomp$inline_1569++ + var i$jscomp$inline_1572 = 0; + i$jscomp$inline_1572 < simpleEventPluginEvents.length; + i$jscomp$inline_1572++ ) { - 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); + var eventName$jscomp$inline_1573 = + simpleEventPluginEvents[i$jscomp$inline_1572], + domEventName$jscomp$inline_1574 = + eventName$jscomp$inline_1573.toLowerCase(), + capitalizedEvent$jscomp$inline_1575 = + eventName$jscomp$inline_1573[0].toUpperCase() + + eventName$jscomp$inline_1573.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1571, - "on" + capitalizedEvent$jscomp$inline_1572 + domEventName$jscomp$inline_1574, + "on" + capitalizedEvent$jscomp$inline_1575 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16071,17 +16114,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1755 = { +var devToolsConfig$jscomp$inline_1758 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-d79661e7", + version: "18.3.0-www-modern-6172d9bb", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2106 = { - bundleType: devToolsConfig$jscomp$inline_1755.bundleType, - version: devToolsConfig$jscomp$inline_1755.version, - rendererPackageName: devToolsConfig$jscomp$inline_1755.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1755.rendererConfig, +var internals$jscomp$inline_2109 = { + bundleType: devToolsConfig$jscomp$inline_1758.bundleType, + version: devToolsConfig$jscomp$inline_1758.version, + rendererPackageName: devToolsConfig$jscomp$inline_1758.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1758.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16098,26 +16141,26 @@ var internals$jscomp$inline_2106 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1755.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1758.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-d79661e7" + reconcilerVersion: "18.3.0-www-modern-6172d9bb" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2107 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2110 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2107.isDisabled && - hook$jscomp$inline_2107.supportsFiber + !hook$jscomp$inline_2110.isDisabled && + hook$jscomp$inline_2110.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2107.inject( - internals$jscomp$inline_2106 + (rendererID = hook$jscomp$inline_2110.inject( + internals$jscomp$inline_2109 )), - (injectedHook = hook$jscomp$inline_2107); + (injectedHook = hook$jscomp$inline_2110); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; @@ -16370,4 +16413,4 @@ exports.useFormState = function () { exports.useFormStatus = function () { throw Error(formatProdErrorMessage(248)); }; -exports.version = "18.3.0-www-modern-d79661e7"; +exports.version = "18.3.0-www-modern-6172d9bb"; diff --git a/compiled/facebook-www/ReactDOM-profiling.classic.js b/compiled/facebook-www/ReactDOM-profiling.classic.js index d976952fc6bbc..c39c336857676 100644 --- a/compiled/facebook-www/ReactDOM-profiling.classic.js +++ b/compiled/facebook-www/ReactDOM-profiling.classic.js @@ -3264,7 +3264,7 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { ? markRootSuspended( workInProgressRootRenderLanes$53, nextLanes, - 0 + workInProgressDeferredLane ) : ((workInProgressRootRenderLanes$53.finishedWork = workInProgressRootRenderLanes$53.current.alternate), @@ -5792,6 +5792,15 @@ var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: 0 }; function mountSuspenseOffscreenState(renderLanes) { return { baseLanes: renderLanes, cachePool: getSuspendedCache() }; } +function getRemainingWorkInPrimaryTree( + current, + primaryTreeDidDefer, + renderLanes +) { + current = null !== current ? current.childLanes & ~renderLanes : 0; + primaryTreeDidDefer && (current |= workInProgressDeferredLane); + return current; +} function updateSuspenseComponent(current, workInProgress, renderLanes) { var nextProps = workInProgress.pendingProps, showFallback = !1, @@ -5803,64 +5812,69 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? !1 : 0 !== (suspenseStackCursor.current & 2)); JSCompiler_temp && ((showFallback = !0), (workInProgress.flags &= -129)); + JSCompiler_temp = 0 !== (workInProgress.flags & 32); + workInProgress.flags &= -33; if (null === current) { if (isHydrating) { showFallback ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); - isHydrating && - (((didSuspend = current = nextHydratableInstance), didSuspend) - ? tryHydrateSuspense(workInProgress, didSuspend) || - (shouldClientRenderOnMismatch(workInProgress) && - throwOnHydrationMismatch(), - (nextHydratableInstance = getNextHydratable( - didSuspend.nextSibling - )), - (JSCompiler_temp = hydrationParentFiber), - nextHydratableInstance && - tryHydrateSuspense(workInProgress, nextHydratableInstance) - ? deleteHydratableInstance(JSCompiler_temp, didSuspend) - : (insertNonHydratedInstance( - hydrationParentFiber, - workInProgress - ), - (isHydrating = !1), - (hydrationParentFiber = workInProgress), - (nextHydratableInstance = current))) - : (shouldClientRenderOnMismatch(workInProgress) && - throwOnHydrationMismatch(), + if (isHydrating) { + var nextInstance = (didSuspend = nextHydratableInstance); + if (!nextInstance) + shouldClientRenderOnMismatch(workInProgress) && + throwOnHydrationMismatch(), insertNonHydratedInstance(hydrationParentFiber, workInProgress), (isHydrating = !1), (hydrationParentFiber = workInProgress), - (nextHydratableInstance = current))); - current = workInProgress.memoizedState; + (nextHydratableInstance = didSuspend); + else if (!tryHydrateSuspense(workInProgress, nextInstance)) { + shouldClientRenderOnMismatch(workInProgress) && + throwOnHydrationMismatch(); + nextHydratableInstance = getNextHydratable(nextInstance.nextSibling); + var prevHydrationParentFiber = hydrationParentFiber; + nextHydratableInstance && + tryHydrateSuspense(workInProgress, nextHydratableInstance) + ? deleteHydratableInstance(prevHydrationParentFiber, nextInstance) + : (insertNonHydratedInstance(hydrationParentFiber, workInProgress), + (isHydrating = !1), + (hydrationParentFiber = workInProgress), + (nextHydratableInstance = didSuspend)); + } + } + didSuspend = workInProgress.memoizedState; if ( - null !== current && - ((current = current.dehydrated), null !== current) + null !== didSuspend && + ((didSuspend = didSuspend.dehydrated), null !== didSuspend) ) return ( 0 === (workInProgress.mode & 1) ? (workInProgress.lanes = 2) - : "$!" === current.data + : "$!" === didSuspend.data ? (workInProgress.lanes = 16) : (workInProgress.lanes = 536870912), null ); popSuspenseHandler(workInProgress); } - current = nextProps.children; - didSuspend = nextProps.fallback; + didSuspend = nextProps.children; + nextInstance = nextProps.fallback; if (showFallback) return ( reuseSuspenseHandlerOnStack(workInProgress), - (current = mountSuspenseFallbackChildren( + (nextProps = mountSuspenseFallbackChildren( workInProgress, - current, didSuspend, + nextInstance, + renderLanes + )), + (showFallback = workInProgress.child), + (showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes)), + (showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, renderLanes )), - (nextProps = workInProgress.child), - (nextProps.memoizedState = mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), enableTransitionTracing && ((workInProgress = enableTransitionTracing @@ -5870,70 +5884,80 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ((renderLanes = enableTransitionTracing ? markerInstanceStack.current : null), - (showFallback = nextProps.updateQueue), - null === showFallback - ? (nextProps.updateQueue = { + (current = showFallback.updateQueue), + null === current + ? (showFallback.updateQueue = { transitions: workInProgress, markerInstances: renderLanes, retryQueue: null }) - : ((showFallback.transitions = workInProgress), - (showFallback.markerInstances = renderLanes)))), - current + : ((current.transitions = workInProgress), + (current.markerInstances = renderLanes)))), + nextProps ); if ("number" === typeof nextProps.unstable_expectedLoadTime) return ( reuseSuspenseHandlerOnStack(workInProgress), - (current = mountSuspenseFallbackChildren( + (nextProps = mountSuspenseFallbackChildren( workInProgress, - current, didSuspend, + nextInstance, + renderLanes + )), + (showFallback = workInProgress.child), + (showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes)), + (showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, renderLanes )), - (workInProgress.child.memoizedState = - mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - current + nextProps ); pushPrimaryTreeSuspenseHandler(workInProgress); - return mountSuspensePrimaryChildren(workInProgress, current); - } - JSCompiler_temp = current.memoizedState; - if (null !== JSCompiler_temp) { - var dehydrated$81 = JSCompiler_temp.dehydrated; - if (null !== dehydrated$81) - return updateDehydratedSuspenseComponent( - current, - workInProgress, - didSuspend, - nextProps, - dehydrated$81, - JSCompiler_temp, - renderLanes - ); + return mountSuspensePrimaryChildren(workInProgress, didSuspend); } + nextInstance = current.memoizedState; + if ( + null !== nextInstance && + ((prevHydrationParentFiber = nextInstance.dehydrated), + null !== prevHydrationParentFiber) + ) + return updateDehydratedSuspenseComponent( + current, + workInProgress, + didSuspend, + JSCompiler_temp, + nextProps, + prevHydrationParentFiber, + nextInstance, + renderLanes + ); if (showFallback) { reuseSuspenseHandlerOnStack(workInProgress); showFallback = nextProps.fallback; didSuspend = workInProgress.mode; - JSCompiler_temp = current.child; - dehydrated$81 = JSCompiler_temp.sibling; + nextInstance = current.child; + prevHydrationParentFiber = nextInstance.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; - 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp + 0 === (didSuspend & 1) && workInProgress.child !== nextInstance ? ((nextProps = workInProgress.child), (nextProps.childLanes = 0), (nextProps.pendingProps = primaryChildProps), workInProgress.mode & 2 && ((nextProps.actualDuration = 0), (nextProps.actualStartTime = -1), - (nextProps.selfBaseDuration = JSCompiler_temp.selfBaseDuration), - (nextProps.treeBaseDuration = JSCompiler_temp.treeBaseDuration)), + (nextProps.selfBaseDuration = nextInstance.selfBaseDuration), + (nextProps.treeBaseDuration = nextInstance.treeBaseDuration)), (workInProgress.deletions = null)) - : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), - (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280)); - null !== dehydrated$81 - ? (showFallback = createWorkInProgress(dehydrated$81, showFallback)) + : ((nextProps = createWorkInProgress(nextInstance, primaryChildProps)), + (nextProps.subtreeFlags = nextInstance.subtreeFlags & 31457280)); + null !== prevHydrationParentFiber + ? (showFallback = createWorkInProgress( + prevHydrationParentFiber, + showFallback + )) : ((showFallback = createFiberFromFragment( showFallback, didSuspend, @@ -5950,64 +5974,71 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { didSuspend = current.child.memoizedState; null === didSuspend ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) - : ((JSCompiler_temp = didSuspend.cachePool), - null !== JSCompiler_temp - ? ((dehydrated$81 = CacheContext._currentValue), - (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated$81 - ? { parent: dehydrated$81, pool: dehydrated$81 } - : JSCompiler_temp)) - : (JSCompiler_temp = getSuspendedCache()), + : ((nextInstance = didSuspend.cachePool), + null !== nextInstance + ? ((prevHydrationParentFiber = CacheContext._currentValue), + (nextInstance = + nextInstance.parent !== prevHydrationParentFiber + ? { + parent: prevHydrationParentFiber, + pool: prevHydrationParentFiber + } + : nextInstance)) + : (nextInstance = getSuspendedCache()), (didSuspend = { baseLanes: didSuspend.baseLanes | renderLanes, - cachePool: JSCompiler_temp + cachePool: nextInstance })); showFallback.memoizedState = didSuspend; enableTransitionTracing && ((didSuspend = enableTransitionTracing ? transitionStack.current : null), null !== didSuspend && - ((JSCompiler_temp = enableTransitionTracing + ((nextInstance = enableTransitionTracing ? markerInstanceStack.current : null), - (dehydrated$81 = showFallback.updateQueue), + (prevHydrationParentFiber = showFallback.updateQueue), (primaryChildProps = current.updateQueue), - null === dehydrated$81 + null === prevHydrationParentFiber ? (showFallback.updateQueue = { transitions: didSuspend, - markerInstances: JSCompiler_temp, + markerInstances: nextInstance, retryQueue: null }) - : dehydrated$81 === primaryChildProps + : prevHydrationParentFiber === primaryChildProps ? (showFallback.updateQueue = { transitions: didSuspend, - markerInstances: JSCompiler_temp, + markerInstances: nextInstance, retryQueue: null !== primaryChildProps ? primaryChildProps.retryQueue : null }) - : ((dehydrated$81.transitions = didSuspend), - (dehydrated$81.markerInstances = JSCompiler_temp)))); - showFallback.childLanes = current.childLanes & ~renderLanes; + : ((prevHydrationParentFiber.transitions = didSuspend), + (prevHydrationParentFiber.markerInstances = nextInstance)))); + showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return nextProps; } pushPrimaryTreeSuspenseHandler(workInProgress); - showFallback = current.child; - current = showFallback.sibling; - nextProps = createWorkInProgress(showFallback, { + JSCompiler_temp = current.child; + current = JSCompiler_temp.sibling; + JSCompiler_temp = createWorkInProgress(JSCompiler_temp, { mode: "visible", children: nextProps.children }); - 0 === (workInProgress.mode & 1) && (nextProps.lanes = renderLanes); - nextProps.return = workInProgress; - nextProps.sibling = null; + 0 === (workInProgress.mode & 1) && (JSCompiler_temp.lanes = renderLanes); + JSCompiler_temp.return = workInProgress; + JSCompiler_temp.sibling = null; null !== current && ((renderLanes = workInProgress.deletions), null === renderLanes ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) : renderLanes.push(current)); - workInProgress.child = nextProps; + workInProgress.child = JSCompiler_temp; workInProgress.memoizedState = null; - return nextProps; + return JSCompiler_temp; } function mountSuspensePrimaryChildren(workInProgress, primaryChildren) { primaryChildren = createFiberFromOffscreen( @@ -6074,6 +6105,7 @@ function updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, @@ -6123,8 +6155,13 @@ function updateDehydratedSuspenseComponent( workInProgress.child = nextProps; 0 !== (workInProgress.mode & 1) && reconcileChildFibers(workInProgress, current.child, null, renderLanes); - workInProgress.child.memoizedState = - mountSuspenseOffscreenState(renderLanes); + suspenseState = workInProgress.child; + suspenseState.memoizedState = mountSuspenseOffscreenState(renderLanes); + suspenseState.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return suspenseInstance; } @@ -6141,10 +6178,10 @@ function updateDehydratedSuspenseComponent( suspenseInstance.nextSibling && suspenseInstance.nextSibling.dataset; if (suspenseInstance) var digest = suspenseInstance.dgst; suspenseInstance = digest; - suspenseState = Error(formatProdErrorMessage(419)); - suspenseState.digest = suspenseInstance; + didPrimaryChildrenDefer = Error(formatProdErrorMessage(419)); + didPrimaryChildrenDefer.digest = suspenseInstance; suspenseInstance = createCapturedValue( - suspenseState, + didPrimaryChildrenDefer, suspenseInstance, void 0 ); @@ -6158,22 +6195,23 @@ function updateDehydratedSuspenseComponent( enableLazyContextPropagation && !didReceiveUpdate && propagateParentContextChanges(current, workInProgress, renderLanes, !1); - digest = 0 !== (renderLanes & current.childLanes); - if (didReceiveUpdate || digest) { - nextProps = workInProgressRoot; - if (null !== nextProps) { - digest = renderLanes & -renderLanes; - if (enableUnifiedSyncLane && 0 !== (digest & SyncUpdateLanes)) digest = 1; + didPrimaryChildrenDefer = 0 !== (renderLanes & current.childLanes); + if (didReceiveUpdate || didPrimaryChildrenDefer) { + didPrimaryChildrenDefer = workInProgressRoot; + if (null !== didPrimaryChildrenDefer) { + nextProps = renderLanes & -renderLanes; + if (enableUnifiedSyncLane && 0 !== (nextProps & SyncUpdateLanes)) + nextProps = 1; else - switch (digest) { + switch (nextProps) { case 2: - digest = 1; + nextProps = 1; break; case 8: - digest = 4; + nextProps = 4; break; case 32: - digest = 16; + nextProps = 16; break; case 128: case 256: @@ -6194,21 +6232,24 @@ function updateDehydratedSuspenseComponent( case 8388608: case 16777216: case 33554432: - digest = 64; + nextProps = 64; break; case 268435456: - digest = 134217728; + nextProps = 134217728; break; default: - digest = 0; + nextProps = 0; } - digest = - 0 !== (digest & (nextProps.suspendedLanes | renderLanes)) ? 0 : digest; - if (0 !== digest && digest !== suspenseState.retryLane) + nextProps = + 0 !== + (nextProps & (didPrimaryChildrenDefer.suspendedLanes | renderLanes)) + ? 0 + : nextProps; + if (0 !== nextProps && nextProps !== suspenseState.retryLane) throw ( - ((suspenseState.retryLane = digest), - enqueueConcurrentRenderForLane(current, digest), - scheduleUpdateOnFiber(nextProps, current, digest), + ((suspenseState.retryLane = nextProps), + enqueueConcurrentRenderForLane(current, nextProps), + scheduleUpdateOnFiber(didPrimaryChildrenDefer, current, nextProps), SelectiveHydrationException) ); } @@ -10520,6 +10561,8 @@ function requestDeferredLane() { 0 === (workInProgressRootRenderLanes & 536870912) || isHydrating ? requestTransitionLane() : 536870912); + var suspenseHandler = suspenseHandlerStackCursor.current; + null !== suspenseHandler && (suspenseHandler.flags |= 32); return workInProgressDeferredLane; } function scheduleUpdateOnFiber(root, fiber, lane) { @@ -13428,14 +13471,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$366; if (canUseDOM) { - var isSupported$jscomp$inline_1614 = "oninput" in document; - if (!isSupported$jscomp$inline_1614) { - var element$jscomp$inline_1615 = document.createElement("div"); - element$jscomp$inline_1615.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1614 = - "function" === typeof element$jscomp$inline_1615.oninput; + var isSupported$jscomp$inline_1617 = "oninput" in document; + if (!isSupported$jscomp$inline_1617) { + var element$jscomp$inline_1618 = document.createElement("div"); + element$jscomp$inline_1618.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1617 = + "function" === typeof element$jscomp$inline_1618.oninput; } - JSCompiler_inline_result$jscomp$366 = isSupported$jscomp$inline_1614; + JSCompiler_inline_result$jscomp$366 = isSupported$jscomp$inline_1617; } else JSCompiler_inline_result$jscomp$366 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$366 && @@ -13747,20 +13790,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1655 = 0; - i$jscomp$inline_1655 < simpleEventPluginEvents.length; - i$jscomp$inline_1655++ + var i$jscomp$inline_1658 = 0; + i$jscomp$inline_1658 < simpleEventPluginEvents.length; + i$jscomp$inline_1658++ ) { - var eventName$jscomp$inline_1656 = - simpleEventPluginEvents[i$jscomp$inline_1655], - domEventName$jscomp$inline_1657 = - eventName$jscomp$inline_1656.toLowerCase(), - capitalizedEvent$jscomp$inline_1658 = - eventName$jscomp$inline_1656[0].toUpperCase() + - eventName$jscomp$inline_1656.slice(1); + var eventName$jscomp$inline_1659 = + simpleEventPluginEvents[i$jscomp$inline_1658], + domEventName$jscomp$inline_1660 = + eventName$jscomp$inline_1659.toLowerCase(), + capitalizedEvent$jscomp$inline_1661 = + eventName$jscomp$inline_1659[0].toUpperCase() + + eventName$jscomp$inline_1659.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1657, - "on" + capitalizedEvent$jscomp$inline_1658 + domEventName$jscomp$inline_1660, + "on" + capitalizedEvent$jscomp$inline_1661 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -17314,10 +17357,10 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1881 = { +var devToolsConfig$jscomp$inline_1884 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-56c1ad34", + version: "18.3.0-www-classic-14352275", rendererPackageName: "react-dom" }; (function (internals) { @@ -17335,10 +17378,10 @@ var devToolsConfig$jscomp$inline_1881 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1881.bundleType, - version: devToolsConfig$jscomp$inline_1881.version, - rendererPackageName: devToolsConfig$jscomp$inline_1881.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1881.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1884.bundleType, + version: devToolsConfig$jscomp$inline_1884.version, + rendererPackageName: devToolsConfig$jscomp$inline_1884.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1884.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17354,14 +17397,14 @@ var devToolsConfig$jscomp$inline_1881 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1881.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1884.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-56c1ad34" + reconcilerVersion: "18.3.0-www-classic-14352275" }); assign(Internals, { ReactBrowserEventEmitter: { @@ -17685,7 +17728,7 @@ exports.useFormState = function () { exports.useFormStatus = function () { throw Error(formatProdErrorMessage(248)); }; -exports.version = "18.3.0-www-classic-56c1ad34"; +exports.version = "18.3.0-www-classic-14352275"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/ReactDOM-profiling.modern.js b/compiled/facebook-www/ReactDOM-profiling.modern.js index 50d17f1a10b51..9454e91de0a3d 100644 --- a/compiled/facebook-www/ReactDOM-profiling.modern.js +++ b/compiled/facebook-www/ReactDOM-profiling.modern.js @@ -3161,7 +3161,7 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { ? markRootSuspended( workInProgressRootRenderLanes$53, nextLanes, - 0 + workInProgressDeferredLane ) : ((workInProgressRootRenderLanes$53.finishedWork = workInProgressRootRenderLanes$53.current.alternate), @@ -5636,6 +5636,15 @@ var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: 0 }; function mountSuspenseOffscreenState(renderLanes) { return { baseLanes: renderLanes, cachePool: getSuspendedCache() }; } +function getRemainingWorkInPrimaryTree( + current, + primaryTreeDidDefer, + renderLanes +) { + current = null !== current ? current.childLanes & ~renderLanes : 0; + primaryTreeDidDefer && (current |= workInProgressDeferredLane); + return current; +} function updateSuspenseComponent(current, workInProgress, renderLanes) { var nextProps = workInProgress.pendingProps, showFallback = !1, @@ -5647,64 +5656,69 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? !1 : 0 !== (suspenseStackCursor.current & 2)); JSCompiler_temp && ((showFallback = !0), (workInProgress.flags &= -129)); + JSCompiler_temp = 0 !== (workInProgress.flags & 32); + workInProgress.flags &= -33; if (null === current) { if (isHydrating) { showFallback ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); - isHydrating && - (((didSuspend = current = nextHydratableInstance), didSuspend) - ? tryHydrateSuspense(workInProgress, didSuspend) || - (shouldClientRenderOnMismatch(workInProgress) && - throwOnHydrationMismatch(), - (nextHydratableInstance = getNextHydratable( - didSuspend.nextSibling - )), - (JSCompiler_temp = hydrationParentFiber), - nextHydratableInstance && - tryHydrateSuspense(workInProgress, nextHydratableInstance) - ? deleteHydratableInstance(JSCompiler_temp, didSuspend) - : (insertNonHydratedInstance( - hydrationParentFiber, - workInProgress - ), - (isHydrating = !1), - (hydrationParentFiber = workInProgress), - (nextHydratableInstance = current))) - : (shouldClientRenderOnMismatch(workInProgress) && - throwOnHydrationMismatch(), + if (isHydrating) { + var nextInstance = (didSuspend = nextHydratableInstance); + if (!nextInstance) + shouldClientRenderOnMismatch(workInProgress) && + throwOnHydrationMismatch(), insertNonHydratedInstance(hydrationParentFiber, workInProgress), (isHydrating = !1), (hydrationParentFiber = workInProgress), - (nextHydratableInstance = current))); - current = workInProgress.memoizedState; + (nextHydratableInstance = didSuspend); + else if (!tryHydrateSuspense(workInProgress, nextInstance)) { + shouldClientRenderOnMismatch(workInProgress) && + throwOnHydrationMismatch(); + nextHydratableInstance = getNextHydratable(nextInstance.nextSibling); + var prevHydrationParentFiber = hydrationParentFiber; + nextHydratableInstance && + tryHydrateSuspense(workInProgress, nextHydratableInstance) + ? deleteHydratableInstance(prevHydrationParentFiber, nextInstance) + : (insertNonHydratedInstance(hydrationParentFiber, workInProgress), + (isHydrating = !1), + (hydrationParentFiber = workInProgress), + (nextHydratableInstance = didSuspend)); + } + } + didSuspend = workInProgress.memoizedState; if ( - null !== current && - ((current = current.dehydrated), null !== current) + null !== didSuspend && + ((didSuspend = didSuspend.dehydrated), null !== didSuspend) ) return ( 0 === (workInProgress.mode & 1) ? (workInProgress.lanes = 2) - : "$!" === current.data + : "$!" === didSuspend.data ? (workInProgress.lanes = 16) : (workInProgress.lanes = 536870912), null ); popSuspenseHandler(workInProgress); } - current = nextProps.children; - didSuspend = nextProps.fallback; + didSuspend = nextProps.children; + nextInstance = nextProps.fallback; if (showFallback) return ( reuseSuspenseHandlerOnStack(workInProgress), - (current = mountSuspenseFallbackChildren( + (nextProps = mountSuspenseFallbackChildren( workInProgress, - current, didSuspend, + nextInstance, + renderLanes + )), + (showFallback = workInProgress.child), + (showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes)), + (showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, renderLanes )), - (nextProps = workInProgress.child), - (nextProps.memoizedState = mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), enableTransitionTracing && ((workInProgress = enableTransitionTracing @@ -5714,70 +5728,80 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ((renderLanes = enableTransitionTracing ? markerInstanceStack.current : null), - (showFallback = nextProps.updateQueue), - null === showFallback - ? (nextProps.updateQueue = { + (current = showFallback.updateQueue), + null === current + ? (showFallback.updateQueue = { transitions: workInProgress, markerInstances: renderLanes, retryQueue: null }) - : ((showFallback.transitions = workInProgress), - (showFallback.markerInstances = renderLanes)))), - current + : ((current.transitions = workInProgress), + (current.markerInstances = renderLanes)))), + nextProps ); if ("number" === typeof nextProps.unstable_expectedLoadTime) return ( reuseSuspenseHandlerOnStack(workInProgress), - (current = mountSuspenseFallbackChildren( + (nextProps = mountSuspenseFallbackChildren( workInProgress, - current, didSuspend, + nextInstance, + renderLanes + )), + (showFallback = workInProgress.child), + (showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes)), + (showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, renderLanes )), - (workInProgress.child.memoizedState = - mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - current + nextProps ); pushPrimaryTreeSuspenseHandler(workInProgress); - return mountSuspensePrimaryChildren(workInProgress, current); - } - JSCompiler_temp = current.memoizedState; - if (null !== JSCompiler_temp) { - var dehydrated$81 = JSCompiler_temp.dehydrated; - if (null !== dehydrated$81) - return updateDehydratedSuspenseComponent( - current, - workInProgress, - didSuspend, - nextProps, - dehydrated$81, - JSCompiler_temp, - renderLanes - ); + return mountSuspensePrimaryChildren(workInProgress, didSuspend); } + nextInstance = current.memoizedState; + if ( + null !== nextInstance && + ((prevHydrationParentFiber = nextInstance.dehydrated), + null !== prevHydrationParentFiber) + ) + return updateDehydratedSuspenseComponent( + current, + workInProgress, + didSuspend, + JSCompiler_temp, + nextProps, + prevHydrationParentFiber, + nextInstance, + renderLanes + ); if (showFallback) { reuseSuspenseHandlerOnStack(workInProgress); showFallback = nextProps.fallback; didSuspend = workInProgress.mode; - JSCompiler_temp = current.child; - dehydrated$81 = JSCompiler_temp.sibling; + nextInstance = current.child; + prevHydrationParentFiber = nextInstance.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; - 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp + 0 === (didSuspend & 1) && workInProgress.child !== nextInstance ? ((nextProps = workInProgress.child), (nextProps.childLanes = 0), (nextProps.pendingProps = primaryChildProps), workInProgress.mode & 2 && ((nextProps.actualDuration = 0), (nextProps.actualStartTime = -1), - (nextProps.selfBaseDuration = JSCompiler_temp.selfBaseDuration), - (nextProps.treeBaseDuration = JSCompiler_temp.treeBaseDuration)), + (nextProps.selfBaseDuration = nextInstance.selfBaseDuration), + (nextProps.treeBaseDuration = nextInstance.treeBaseDuration)), (workInProgress.deletions = null)) - : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), - (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280)); - null !== dehydrated$81 - ? (showFallback = createWorkInProgress(dehydrated$81, showFallback)) + : ((nextProps = createWorkInProgress(nextInstance, primaryChildProps)), + (nextProps.subtreeFlags = nextInstance.subtreeFlags & 31457280)); + null !== prevHydrationParentFiber + ? (showFallback = createWorkInProgress( + prevHydrationParentFiber, + showFallback + )) : ((showFallback = createFiberFromFragment( showFallback, didSuspend, @@ -5794,64 +5818,71 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { didSuspend = current.child.memoizedState; null === didSuspend ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) - : ((JSCompiler_temp = didSuspend.cachePool), - null !== JSCompiler_temp - ? ((dehydrated$81 = CacheContext._currentValue), - (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated$81 - ? { parent: dehydrated$81, pool: dehydrated$81 } - : JSCompiler_temp)) - : (JSCompiler_temp = getSuspendedCache()), + : ((nextInstance = didSuspend.cachePool), + null !== nextInstance + ? ((prevHydrationParentFiber = CacheContext._currentValue), + (nextInstance = + nextInstance.parent !== prevHydrationParentFiber + ? { + parent: prevHydrationParentFiber, + pool: prevHydrationParentFiber + } + : nextInstance)) + : (nextInstance = getSuspendedCache()), (didSuspend = { baseLanes: didSuspend.baseLanes | renderLanes, - cachePool: JSCompiler_temp + cachePool: nextInstance })); showFallback.memoizedState = didSuspend; enableTransitionTracing && ((didSuspend = enableTransitionTracing ? transitionStack.current : null), null !== didSuspend && - ((JSCompiler_temp = enableTransitionTracing + ((nextInstance = enableTransitionTracing ? markerInstanceStack.current : null), - (dehydrated$81 = showFallback.updateQueue), + (prevHydrationParentFiber = showFallback.updateQueue), (primaryChildProps = current.updateQueue), - null === dehydrated$81 + null === prevHydrationParentFiber ? (showFallback.updateQueue = { transitions: didSuspend, - markerInstances: JSCompiler_temp, + markerInstances: nextInstance, retryQueue: null }) - : dehydrated$81 === primaryChildProps + : prevHydrationParentFiber === primaryChildProps ? (showFallback.updateQueue = { transitions: didSuspend, - markerInstances: JSCompiler_temp, + markerInstances: nextInstance, retryQueue: null !== primaryChildProps ? primaryChildProps.retryQueue : null }) - : ((dehydrated$81.transitions = didSuspend), - (dehydrated$81.markerInstances = JSCompiler_temp)))); - showFallback.childLanes = current.childLanes & ~renderLanes; + : ((prevHydrationParentFiber.transitions = didSuspend), + (prevHydrationParentFiber.markerInstances = nextInstance)))); + showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return nextProps; } pushPrimaryTreeSuspenseHandler(workInProgress); - showFallback = current.child; - current = showFallback.sibling; - nextProps = createWorkInProgress(showFallback, { + JSCompiler_temp = current.child; + current = JSCompiler_temp.sibling; + JSCompiler_temp = createWorkInProgress(JSCompiler_temp, { mode: "visible", children: nextProps.children }); - 0 === (workInProgress.mode & 1) && (nextProps.lanes = renderLanes); - nextProps.return = workInProgress; - nextProps.sibling = null; + 0 === (workInProgress.mode & 1) && (JSCompiler_temp.lanes = renderLanes); + JSCompiler_temp.return = workInProgress; + JSCompiler_temp.sibling = null; null !== current && ((renderLanes = workInProgress.deletions), null === renderLanes ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) : renderLanes.push(current)); - workInProgress.child = nextProps; + workInProgress.child = JSCompiler_temp; workInProgress.memoizedState = null; - return nextProps; + return JSCompiler_temp; } function mountSuspensePrimaryChildren(workInProgress, primaryChildren) { primaryChildren = createFiberFromOffscreen( @@ -5918,6 +5949,7 @@ function updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, @@ -5967,8 +5999,13 @@ function updateDehydratedSuspenseComponent( workInProgress.child = nextProps; 0 !== (workInProgress.mode & 1) && reconcileChildFibers(workInProgress, current.child, null, renderLanes); - workInProgress.child.memoizedState = - mountSuspenseOffscreenState(renderLanes); + suspenseState = workInProgress.child; + suspenseState.memoizedState = mountSuspenseOffscreenState(renderLanes); + suspenseState.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return suspenseInstance; } @@ -5985,10 +6022,10 @@ function updateDehydratedSuspenseComponent( suspenseInstance.nextSibling && suspenseInstance.nextSibling.dataset; if (suspenseInstance) var digest = suspenseInstance.dgst; suspenseInstance = digest; - suspenseState = Error(formatProdErrorMessage(419)); - suspenseState.digest = suspenseInstance; + didPrimaryChildrenDefer = Error(formatProdErrorMessage(419)); + didPrimaryChildrenDefer.digest = suspenseInstance; suspenseInstance = createCapturedValue( - suspenseState, + didPrimaryChildrenDefer, suspenseInstance, void 0 ); @@ -6002,22 +6039,23 @@ function updateDehydratedSuspenseComponent( enableLazyContextPropagation && !didReceiveUpdate && propagateParentContextChanges(current, workInProgress, renderLanes, !1); - digest = 0 !== (renderLanes & current.childLanes); - if (didReceiveUpdate || digest) { - nextProps = workInProgressRoot; - if (null !== nextProps) { - digest = renderLanes & -renderLanes; - if (enableUnifiedSyncLane && 0 !== (digest & SyncUpdateLanes)) digest = 1; + didPrimaryChildrenDefer = 0 !== (renderLanes & current.childLanes); + if (didReceiveUpdate || didPrimaryChildrenDefer) { + didPrimaryChildrenDefer = workInProgressRoot; + if (null !== didPrimaryChildrenDefer) { + nextProps = renderLanes & -renderLanes; + if (enableUnifiedSyncLane && 0 !== (nextProps & SyncUpdateLanes)) + nextProps = 1; else - switch (digest) { + switch (nextProps) { case 2: - digest = 1; + nextProps = 1; break; case 8: - digest = 4; + nextProps = 4; break; case 32: - digest = 16; + nextProps = 16; break; case 128: case 256: @@ -6038,21 +6076,24 @@ function updateDehydratedSuspenseComponent( case 8388608: case 16777216: case 33554432: - digest = 64; + nextProps = 64; break; case 268435456: - digest = 134217728; + nextProps = 134217728; break; default: - digest = 0; + nextProps = 0; } - digest = - 0 !== (digest & (nextProps.suspendedLanes | renderLanes)) ? 0 : digest; - if (0 !== digest && digest !== suspenseState.retryLane) + nextProps = + 0 !== + (nextProps & (didPrimaryChildrenDefer.suspendedLanes | renderLanes)) + ? 0 + : nextProps; + if (0 !== nextProps && nextProps !== suspenseState.retryLane) throw ( - ((suspenseState.retryLane = digest), - enqueueConcurrentRenderForLane(current, digest), - scheduleUpdateOnFiber(nextProps, current, digest), + ((suspenseState.retryLane = nextProps), + enqueueConcurrentRenderForLane(current, nextProps), + scheduleUpdateOnFiber(didPrimaryChildrenDefer, current, nextProps), SelectiveHydrationException) ); } @@ -10354,6 +10395,8 @@ function requestDeferredLane() { 0 === (workInProgressRootRenderLanes & 536870912) || isHydrating ? requestTransitionLane() : 536870912); + var suspenseHandler = suspenseHandlerStackCursor.current; + null !== suspenseHandler && (suspenseHandler.flags |= 32); return workInProgressDeferredLane; } function scheduleUpdateOnFiber(root, fiber, lane) { @@ -13666,14 +13709,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$364; if (canUseDOM) { - 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; + var isSupported$jscomp$inline_1616 = "oninput" in document; + if (!isSupported$jscomp$inline_1616) { + var element$jscomp$inline_1617 = document.createElement("div"); + element$jscomp$inline_1617.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1616 = + "function" === typeof element$jscomp$inline_1617.oninput; } - JSCompiler_inline_result$jscomp$364 = isSupported$jscomp$inline_1613; + JSCompiler_inline_result$jscomp$364 = isSupported$jscomp$inline_1616; } else JSCompiler_inline_result$jscomp$364 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$364 && @@ -13985,20 +14028,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1654 = 0; - i$jscomp$inline_1654 < simpleEventPluginEvents.length; - i$jscomp$inline_1654++ + var i$jscomp$inline_1657 = 0; + i$jscomp$inline_1657 < simpleEventPluginEvents.length; + i$jscomp$inline_1657++ ) { - 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); + var eventName$jscomp$inline_1658 = + simpleEventPluginEvents[i$jscomp$inline_1657], + domEventName$jscomp$inline_1659 = + eventName$jscomp$inline_1658.toLowerCase(), + capitalizedEvent$jscomp$inline_1660 = + eventName$jscomp$inline_1658[0].toUpperCase() + + eventName$jscomp$inline_1658.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1656, - "on" + capitalizedEvent$jscomp$inline_1657 + domEventName$jscomp$inline_1659, + "on" + capitalizedEvent$jscomp$inline_1660 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16834,10 +16877,10 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1840 = { +var devToolsConfig$jscomp$inline_1843 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-0a58ac99", + version: "18.3.0-www-modern-a32ad479", rendererPackageName: "react-dom" }; (function (internals) { @@ -16855,10 +16898,10 @@ var devToolsConfig$jscomp$inline_1840 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1840.bundleType, - version: devToolsConfig$jscomp$inline_1840.version, - rendererPackageName: devToolsConfig$jscomp$inline_1840.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1840.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1843.bundleType, + version: devToolsConfig$jscomp$inline_1843.version, + rendererPackageName: devToolsConfig$jscomp$inline_1843.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1843.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16875,14 +16918,14 @@ var devToolsConfig$jscomp$inline_1840 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1840.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1843.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-0a58ac99" + reconcilerVersion: "18.3.0-www-modern-a32ad479" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; exports.createPortal = function (children, container) { @@ -17134,7 +17177,7 @@ exports.useFormState = function () { exports.useFormStatus = function () { throw Error(formatProdErrorMessage(248)); }; -exports.version = "18.3.0-www-modern-0a58ac99"; +exports.version = "18.3.0-www-modern-a32ad479"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/ReactDOMTesting-dev.classic.js b/compiled/facebook-www/ReactDOMTesting-dev.classic.js index 4a15b150a3166..a9644a16b09ed 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.classic.js @@ -506,6 +506,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; + var DidDefer = ContentReset; var LifecycleEffectMask = Passive$1 | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) @@ -20627,9 +20628,26 @@ if (__DEV__) { return hasSuspenseListContext(suspenseContext, ForceSuspenseFallback); } - function getRemainingWorkInPrimaryTree(current, renderLanes) { - // TODO: Should not remove render lanes that were pinged during this render - return removeLanes(current.childLanes, renderLanes); + function getRemainingWorkInPrimaryTree( + current, + primaryTreeDidDefer, + renderLanes + ) { + var remainingLanes = + current !== null + ? removeLanes(current.childLanes, renderLanes) + : NoLanes; + + if (primaryTreeDidDefer) { + // A useDeferredValue hook spawned a deferred task inside the primary tree. + // Ensure that we retry this component at the deferred priority. + // TODO: We could make this a per-subtree value instead of a global one. + // Would need to track it on the context stack somehow, similar to what + // we'd have to do for resumable contexts. + remainingLanes = mergeLanes(remainingLanes, peekDeferredLane()); + } + + return remainingLanes; } function updateSuspenseComponent(current, workInProgress, renderLanes) { @@ -20649,7 +20667,12 @@ if (__DEV__) { // rendering the fallback children. showFallback = true; workInProgress.flags &= ~DidCapture; - } // OK, the next part is confusing. We're about to reconcile the Suspense + } // Check if the primary children spawned a deferred task (useDeferredValue) + // during the first pass. + + var didPrimaryChildrenDefer = + (workInProgress.flags & DidDefer) !== NoFlags$1; + workInProgress.flags &= ~DidDefer; // OK, the next part is confusing. We're about to reconcile the Suspense // boundary's children. This involves some custom reconciliation logic. Two // main reasons this is so complicated. // @@ -20720,6 +20743,11 @@ if (__DEV__) { var primaryChildFragment = workInProgress.child; primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); + primaryChildFragment.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; if (enableTransitionTracing) { @@ -20760,6 +20788,11 @@ if (__DEV__) { var _primaryChildFragment = workInProgress.child; _primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); + _primaryChildFragment.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; // TODO: Transition Tracing is not yet implemented for CPU Suspense. // Since nothing actually suspended, there will nothing to ping this to // get it started back up to attempt the next item. While in terms of @@ -20792,6 +20825,7 @@ if (__DEV__) { current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, _dehydrated, prevState, @@ -20855,6 +20889,7 @@ if (__DEV__) { _primaryChildFragment2.childLanes = getRemainingWorkInPrimaryTree( current, + didPrimaryChildrenDefer, renderLanes ); workInProgress.memoizedState = SUSPENDED_MARKER; @@ -21214,6 +21249,7 @@ if (__DEV__) { current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, @@ -21439,6 +21475,11 @@ if (__DEV__) { var _primaryChildFragment4 = workInProgress.child; _primaryChildFragment4.memoizedState = mountSuspenseOffscreenState(renderLanes); + _primaryChildFragment4.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return fallbackChildFragment; } @@ -31008,10 +31049,22 @@ if (__DEV__) { // Everything else is spawned as a transition. workInProgressDeferredLane = requestTransitionLane(); } + } // Mark the parent Suspense boundary so it knows to spawn the deferred lane. + + var suspenseHandler = getSuspenseHandler(); + + if (suspenseHandler !== null) { + // TODO: As an optimization, we shouldn't entangle the lanes at the root; we + // can entangle them using the baseLanes of the Suspense boundary instead. + // We only need to do something special if there's no Suspense boundary. + suspenseHandler.flags |= DidDefer; } return workInProgressDeferredLane; } + function peekDeferredLane() { + return workInProgressDeferredLane; + } function scheduleUpdateOnFiber(root, fiber, lane) { { if (isRunningInsertionEffect) { @@ -31647,7 +31700,7 @@ if (__DEV__) { // 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, NoLane); + markRootSuspended(root, lanes, workInProgressDeferredLane); ensureRootIsScheduled(root); return null; } // We now have a consistent tree. Because this is a sync render, we @@ -35523,7 +35576,7 @@ if (__DEV__) { return root; } - var ReactVersion = "18.3.0-www-classic-3dc434f9"; + var ReactVersion = "18.3.0-www-classic-ef03e2c6"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOMTesting-dev.modern.js b/compiled/facebook-www/ReactDOMTesting-dev.modern.js index a8751038e8780..c916196191714 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.modern.js @@ -384,6 +384,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; + var DidDefer = ContentReset; var LifecycleEffectMask = Passive$1 | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) @@ -20492,9 +20493,26 @@ if (__DEV__) { return hasSuspenseListContext(suspenseContext, ForceSuspenseFallback); } - function getRemainingWorkInPrimaryTree(current, renderLanes) { - // TODO: Should not remove render lanes that were pinged during this render - return removeLanes(current.childLanes, renderLanes); + function getRemainingWorkInPrimaryTree( + current, + primaryTreeDidDefer, + renderLanes + ) { + var remainingLanes = + current !== null + ? removeLanes(current.childLanes, renderLanes) + : NoLanes; + + if (primaryTreeDidDefer) { + // A useDeferredValue hook spawned a deferred task inside the primary tree. + // Ensure that we retry this component at the deferred priority. + // TODO: We could make this a per-subtree value instead of a global one. + // Would need to track it on the context stack somehow, similar to what + // we'd have to do for resumable contexts. + remainingLanes = mergeLanes(remainingLanes, peekDeferredLane()); + } + + return remainingLanes; } function updateSuspenseComponent(current, workInProgress, renderLanes) { @@ -20514,7 +20532,12 @@ if (__DEV__) { // rendering the fallback children. showFallback = true; workInProgress.flags &= ~DidCapture; - } // OK, the next part is confusing. We're about to reconcile the Suspense + } // Check if the primary children spawned a deferred task (useDeferredValue) + // during the first pass. + + var didPrimaryChildrenDefer = + (workInProgress.flags & DidDefer) !== NoFlags$1; + workInProgress.flags &= ~DidDefer; // OK, the next part is confusing. We're about to reconcile the Suspense // boundary's children. This involves some custom reconciliation logic. Two // main reasons this is so complicated. // @@ -20585,6 +20608,11 @@ if (__DEV__) { var primaryChildFragment = workInProgress.child; primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); + primaryChildFragment.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; if (enableTransitionTracing) { @@ -20625,6 +20653,11 @@ if (__DEV__) { var _primaryChildFragment = workInProgress.child; _primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); + _primaryChildFragment.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; // TODO: Transition Tracing is not yet implemented for CPU Suspense. // Since nothing actually suspended, there will nothing to ping this to // get it started back up to attempt the next item. While in terms of @@ -20657,6 +20690,7 @@ if (__DEV__) { current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, _dehydrated, prevState, @@ -20720,6 +20754,7 @@ if (__DEV__) { _primaryChildFragment2.childLanes = getRemainingWorkInPrimaryTree( current, + didPrimaryChildrenDefer, renderLanes ); workInProgress.memoizedState = SUSPENDED_MARKER; @@ -21079,6 +21114,7 @@ if (__DEV__) { current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, @@ -21304,6 +21340,11 @@ if (__DEV__) { var _primaryChildFragment4 = workInProgress.child; _primaryChildFragment4.memoizedState = mountSuspenseOffscreenState(renderLanes); + _primaryChildFragment4.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return fallbackChildFragment; } @@ -30838,10 +30879,22 @@ if (__DEV__) { // Everything else is spawned as a transition. workInProgressDeferredLane = requestTransitionLane(); } + } // Mark the parent Suspense boundary so it knows to spawn the deferred lane. + + var suspenseHandler = getSuspenseHandler(); + + if (suspenseHandler !== null) { + // TODO: As an optimization, we shouldn't entangle the lanes at the root; we + // can entangle them using the baseLanes of the Suspense boundary instead. + // We only need to do something special if there's no Suspense boundary. + suspenseHandler.flags |= DidDefer; } return workInProgressDeferredLane; } + function peekDeferredLane() { + return workInProgressDeferredLane; + } function scheduleUpdateOnFiber(root, fiber, lane) { { if (isRunningInsertionEffect) { @@ -31477,7 +31530,7 @@ if (__DEV__) { // 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, NoLane); + markRootSuspended(root, lanes, workInProgressDeferredLane); ensureRootIsScheduled(root); return null; } // We now have a consistent tree. Because this is a sync render, we @@ -35344,7 +35397,7 @@ if (__DEV__) { return root; } - var ReactVersion = "18.3.0-www-modern-4a767f88"; + var ReactVersion = "18.3.0-www-modern-3ae51a18"; function createPortal$1( children, diff --git a/compiled/facebook-www/ReactDOMTesting-prod.classic.js b/compiled/facebook-www/ReactDOMTesting-prod.classic.js index d5e03580b4f6d..8e83c8ec95fa4 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.classic.js @@ -3210,7 +3210,7 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { ? markRootSuspended( workInProgressRootRenderLanes$50, nextLanes, - 0 + workInProgressDeferredLane ) : ((workInProgressRootRenderLanes$50.finishedWork = workInProgressRootRenderLanes$50.current.alternate), @@ -5652,6 +5652,15 @@ var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: 0 }; function mountSuspenseOffscreenState(renderLanes) { return { baseLanes: renderLanes, cachePool: getSuspendedCache() }; } +function getRemainingWorkInPrimaryTree( + current, + primaryTreeDidDefer, + renderLanes +) { + current = null !== current ? current.childLanes & ~renderLanes : 0; + primaryTreeDidDefer && (current |= workInProgressDeferredLane); + return current; +} function updateSuspenseComponent(current, workInProgress, renderLanes) { var nextProps = workInProgress.pendingProps, showFallback = !1, @@ -5663,64 +5672,69 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? !1 : 0 !== (suspenseStackCursor.current & 2)); JSCompiler_temp && ((showFallback = !0), (workInProgress.flags &= -129)); + JSCompiler_temp = 0 !== (workInProgress.flags & 32); + workInProgress.flags &= -33; if (null === current) { if (isHydrating) { showFallback ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); - isHydrating && - (((didSuspend = current = nextHydratableInstance), didSuspend) - ? tryHydrateSuspense(workInProgress, didSuspend) || - (shouldClientRenderOnMismatch(workInProgress) && - throwOnHydrationMismatch(), - (nextHydratableInstance = getNextHydratable( - didSuspend.nextSibling - )), - (JSCompiler_temp = hydrationParentFiber), - nextHydratableInstance && - tryHydrateSuspense(workInProgress, nextHydratableInstance) - ? deleteHydratableInstance(JSCompiler_temp, didSuspend) - : (insertNonHydratedInstance( - hydrationParentFiber, - workInProgress - ), - (isHydrating = !1), - (hydrationParentFiber = workInProgress), - (nextHydratableInstance = current))) - : (shouldClientRenderOnMismatch(workInProgress) && - throwOnHydrationMismatch(), + if (isHydrating) { + var nextInstance = (didSuspend = nextHydratableInstance); + if (!nextInstance) + shouldClientRenderOnMismatch(workInProgress) && + throwOnHydrationMismatch(), insertNonHydratedInstance(hydrationParentFiber, workInProgress), (isHydrating = !1), (hydrationParentFiber = workInProgress), - (nextHydratableInstance = current))); - current = workInProgress.memoizedState; + (nextHydratableInstance = didSuspend); + else if (!tryHydrateSuspense(workInProgress, nextInstance)) { + shouldClientRenderOnMismatch(workInProgress) && + throwOnHydrationMismatch(); + nextHydratableInstance = getNextHydratable(nextInstance.nextSibling); + var prevHydrationParentFiber = hydrationParentFiber; + nextHydratableInstance && + tryHydrateSuspense(workInProgress, nextHydratableInstance) + ? deleteHydratableInstance(prevHydrationParentFiber, nextInstance) + : (insertNonHydratedInstance(hydrationParentFiber, workInProgress), + (isHydrating = !1), + (hydrationParentFiber = workInProgress), + (nextHydratableInstance = didSuspend)); + } + } + didSuspend = workInProgress.memoizedState; if ( - null !== current && - ((current = current.dehydrated), null !== current) + null !== didSuspend && + ((didSuspend = didSuspend.dehydrated), null !== didSuspend) ) return ( 0 === (workInProgress.mode & 1) ? (workInProgress.lanes = 2) - : "$!" === current.data + : "$!" === didSuspend.data ? (workInProgress.lanes = 16) : (workInProgress.lanes = 536870912), null ); popSuspenseHandler(workInProgress); } - current = nextProps.children; - didSuspend = nextProps.fallback; + didSuspend = nextProps.children; + nextInstance = nextProps.fallback; if (showFallback) return ( reuseSuspenseHandlerOnStack(workInProgress), - (current = mountSuspenseFallbackChildren( + (nextProps = mountSuspenseFallbackChildren( workInProgress, - current, didSuspend, + nextInstance, + renderLanes + )), + (showFallback = workInProgress.child), + (showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes)), + (showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, renderLanes )), - (nextProps = workInProgress.child), - (nextProps.memoizedState = mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), enableTransitionTracing && ((workInProgress = enableTransitionTracing @@ -5730,65 +5744,75 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ((renderLanes = enableTransitionTracing ? markerInstanceStack.current : null), - (showFallback = nextProps.updateQueue), - null === showFallback - ? (nextProps.updateQueue = { + (current = showFallback.updateQueue), + null === current + ? (showFallback.updateQueue = { transitions: workInProgress, markerInstances: renderLanes, retryQueue: null }) - : ((showFallback.transitions = workInProgress), - (showFallback.markerInstances = renderLanes)))), - current + : ((current.transitions = workInProgress), + (current.markerInstances = renderLanes)))), + nextProps ); if ("number" === typeof nextProps.unstable_expectedLoadTime) return ( reuseSuspenseHandlerOnStack(workInProgress), - (current = mountSuspenseFallbackChildren( + (nextProps = mountSuspenseFallbackChildren( workInProgress, - current, didSuspend, + nextInstance, + renderLanes + )), + (showFallback = workInProgress.child), + (showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes)), + (showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, renderLanes )), - (workInProgress.child.memoizedState = - mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - current + nextProps ); pushPrimaryTreeSuspenseHandler(workInProgress); - return mountSuspensePrimaryChildren(workInProgress, current); - } - JSCompiler_temp = current.memoizedState; - if (null !== JSCompiler_temp) { - var dehydrated$76 = JSCompiler_temp.dehydrated; - if (null !== dehydrated$76) - return updateDehydratedSuspenseComponent( - current, - workInProgress, - didSuspend, - nextProps, - dehydrated$76, - JSCompiler_temp, - renderLanes - ); + return mountSuspensePrimaryChildren(workInProgress, didSuspend); } + nextInstance = current.memoizedState; + if ( + null !== nextInstance && + ((prevHydrationParentFiber = nextInstance.dehydrated), + null !== prevHydrationParentFiber) + ) + return updateDehydratedSuspenseComponent( + current, + workInProgress, + didSuspend, + JSCompiler_temp, + nextProps, + prevHydrationParentFiber, + nextInstance, + renderLanes + ); if (showFallback) { reuseSuspenseHandlerOnStack(workInProgress); showFallback = nextProps.fallback; didSuspend = workInProgress.mode; - JSCompiler_temp = current.child; - dehydrated$76 = JSCompiler_temp.sibling; + nextInstance = current.child; + prevHydrationParentFiber = nextInstance.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; - 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp + 0 === (didSuspend & 1) && workInProgress.child !== nextInstance ? ((nextProps = workInProgress.child), (nextProps.childLanes = 0), (nextProps.pendingProps = primaryChildProps), (workInProgress.deletions = null)) - : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), - (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280)); - null !== dehydrated$76 - ? (showFallback = createWorkInProgress(dehydrated$76, showFallback)) + : ((nextProps = createWorkInProgress(nextInstance, primaryChildProps)), + (nextProps.subtreeFlags = nextInstance.subtreeFlags & 31457280)); + null !== prevHydrationParentFiber + ? (showFallback = createWorkInProgress( + prevHydrationParentFiber, + showFallback + )) : ((showFallback = createFiberFromFragment( showFallback, didSuspend, @@ -5805,64 +5829,71 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { didSuspend = current.child.memoizedState; null === didSuspend ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) - : ((JSCompiler_temp = didSuspend.cachePool), - null !== JSCompiler_temp - ? ((dehydrated$76 = CacheContext._currentValue), - (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated$76 - ? { parent: dehydrated$76, pool: dehydrated$76 } - : JSCompiler_temp)) - : (JSCompiler_temp = getSuspendedCache()), + : ((nextInstance = didSuspend.cachePool), + null !== nextInstance + ? ((prevHydrationParentFiber = CacheContext._currentValue), + (nextInstance = + nextInstance.parent !== prevHydrationParentFiber + ? { + parent: prevHydrationParentFiber, + pool: prevHydrationParentFiber + } + : nextInstance)) + : (nextInstance = getSuspendedCache()), (didSuspend = { baseLanes: didSuspend.baseLanes | renderLanes, - cachePool: JSCompiler_temp + cachePool: nextInstance })); showFallback.memoizedState = didSuspend; enableTransitionTracing && ((didSuspend = enableTransitionTracing ? transitionStack.current : null), null !== didSuspend && - ((JSCompiler_temp = enableTransitionTracing + ((nextInstance = enableTransitionTracing ? markerInstanceStack.current : null), - (dehydrated$76 = showFallback.updateQueue), + (prevHydrationParentFiber = showFallback.updateQueue), (primaryChildProps = current.updateQueue), - null === dehydrated$76 + null === prevHydrationParentFiber ? (showFallback.updateQueue = { transitions: didSuspend, - markerInstances: JSCompiler_temp, + markerInstances: nextInstance, retryQueue: null }) - : dehydrated$76 === primaryChildProps + : prevHydrationParentFiber === primaryChildProps ? (showFallback.updateQueue = { transitions: didSuspend, - markerInstances: JSCompiler_temp, + markerInstances: nextInstance, retryQueue: null !== primaryChildProps ? primaryChildProps.retryQueue : null }) - : ((dehydrated$76.transitions = didSuspend), - (dehydrated$76.markerInstances = JSCompiler_temp)))); - showFallback.childLanes = current.childLanes & ~renderLanes; + : ((prevHydrationParentFiber.transitions = didSuspend), + (prevHydrationParentFiber.markerInstances = nextInstance)))); + showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return nextProps; } pushPrimaryTreeSuspenseHandler(workInProgress); - showFallback = current.child; - current = showFallback.sibling; - nextProps = createWorkInProgress(showFallback, { + JSCompiler_temp = current.child; + current = JSCompiler_temp.sibling; + JSCompiler_temp = createWorkInProgress(JSCompiler_temp, { mode: "visible", children: nextProps.children }); - 0 === (workInProgress.mode & 1) && (nextProps.lanes = renderLanes); - nextProps.return = workInProgress; - nextProps.sibling = null; + 0 === (workInProgress.mode & 1) && (JSCompiler_temp.lanes = renderLanes); + JSCompiler_temp.return = workInProgress; + JSCompiler_temp.sibling = null; null !== current && ((renderLanes = workInProgress.deletions), null === renderLanes ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) : renderLanes.push(current)); - workInProgress.child = nextProps; + workInProgress.child = JSCompiler_temp; workInProgress.memoizedState = null; - return nextProps; + return JSCompiler_temp; } function mountSuspensePrimaryChildren(workInProgress, primaryChildren) { primaryChildren = createFiberFromOffscreen( @@ -5924,6 +5955,7 @@ function updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, @@ -5973,8 +6005,13 @@ function updateDehydratedSuspenseComponent( workInProgress.child = nextProps; 0 !== (workInProgress.mode & 1) && reconcileChildFibers(workInProgress, current.child, null, renderLanes); - workInProgress.child.memoizedState = - mountSuspenseOffscreenState(renderLanes); + suspenseState = workInProgress.child; + suspenseState.memoizedState = mountSuspenseOffscreenState(renderLanes); + suspenseState.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return suspenseInstance; } @@ -5991,10 +6028,10 @@ function updateDehydratedSuspenseComponent( suspenseInstance.nextSibling && suspenseInstance.nextSibling.dataset; if (suspenseInstance) var digest = suspenseInstance.dgst; suspenseInstance = digest; - suspenseState = Error(formatProdErrorMessage(419)); - suspenseState.digest = suspenseInstance; + didPrimaryChildrenDefer = Error(formatProdErrorMessage(419)); + didPrimaryChildrenDefer.digest = suspenseInstance; suspenseInstance = createCapturedValue( - suspenseState, + didPrimaryChildrenDefer, suspenseInstance, void 0 ); @@ -6008,22 +6045,23 @@ function updateDehydratedSuspenseComponent( enableLazyContextPropagation && !didReceiveUpdate && propagateParentContextChanges(current, workInProgress, renderLanes, !1); - digest = 0 !== (renderLanes & current.childLanes); - if (didReceiveUpdate || digest) { - nextProps = workInProgressRoot; - if (null !== nextProps) { - digest = renderLanes & -renderLanes; - if (enableUnifiedSyncLane && 0 !== (digest & SyncUpdateLanes)) digest = 1; + didPrimaryChildrenDefer = 0 !== (renderLanes & current.childLanes); + if (didReceiveUpdate || didPrimaryChildrenDefer) { + didPrimaryChildrenDefer = workInProgressRoot; + if (null !== didPrimaryChildrenDefer) { + nextProps = renderLanes & -renderLanes; + if (enableUnifiedSyncLane && 0 !== (nextProps & SyncUpdateLanes)) + nextProps = 1; else - switch (digest) { + switch (nextProps) { case 2: - digest = 1; + nextProps = 1; break; case 8: - digest = 4; + nextProps = 4; break; case 32: - digest = 16; + nextProps = 16; break; case 128: case 256: @@ -6044,21 +6082,24 @@ function updateDehydratedSuspenseComponent( case 8388608: case 16777216: case 33554432: - digest = 64; + nextProps = 64; break; case 268435456: - digest = 134217728; + nextProps = 134217728; break; default: - digest = 0; + nextProps = 0; } - digest = - 0 !== (digest & (nextProps.suspendedLanes | renderLanes)) ? 0 : digest; - if (0 !== digest && digest !== suspenseState.retryLane) + nextProps = + 0 !== + (nextProps & (didPrimaryChildrenDefer.suspendedLanes | renderLanes)) + ? 0 + : nextProps; + if (0 !== nextProps && nextProps !== suspenseState.retryLane) throw ( - ((suspenseState.retryLane = digest), - enqueueConcurrentRenderForLane(current, digest), - scheduleUpdateOnFiber(nextProps, current, digest), + ((suspenseState.retryLane = nextProps), + enqueueConcurrentRenderForLane(current, nextProps), + scheduleUpdateOnFiber(didPrimaryChildrenDefer, current, nextProps), SelectiveHydrationException) ); } @@ -10204,6 +10245,8 @@ function requestDeferredLane() { 0 === (workInProgressRootRenderLanes & 536870912) || isHydrating ? requestTransitionLane() : 536870912); + var suspenseHandler = suspenseHandlerStackCursor.current; + null !== suspenseHandler && (suspenseHandler.flags |= 32); return workInProgressDeferredLane; } function scheduleUpdateOnFiber(root, fiber, lane) { @@ -12931,14 +12974,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$347; if (canUseDOM) { - var isSupported$jscomp$inline_1558 = "oninput" in document; - if (!isSupported$jscomp$inline_1558) { - var element$jscomp$inline_1559 = document.createElement("div"); - element$jscomp$inline_1559.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1558 = - "function" === typeof element$jscomp$inline_1559.oninput; + var isSupported$jscomp$inline_1561 = "oninput" in document; + if (!isSupported$jscomp$inline_1561) { + var element$jscomp$inline_1562 = document.createElement("div"); + element$jscomp$inline_1562.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1561 = + "function" === typeof element$jscomp$inline_1562.oninput; } - JSCompiler_inline_result$jscomp$347 = isSupported$jscomp$inline_1558; + JSCompiler_inline_result$jscomp$347 = isSupported$jscomp$inline_1561; } else JSCompiler_inline_result$jscomp$347 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$347 && @@ -13250,20 +13293,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1599 = 0; - i$jscomp$inline_1599 < simpleEventPluginEvents.length; - i$jscomp$inline_1599++ + var i$jscomp$inline_1602 = 0; + i$jscomp$inline_1602 < simpleEventPluginEvents.length; + i$jscomp$inline_1602++ ) { - var eventName$jscomp$inline_1600 = - simpleEventPluginEvents[i$jscomp$inline_1599], - domEventName$jscomp$inline_1601 = - eventName$jscomp$inline_1600.toLowerCase(), - capitalizedEvent$jscomp$inline_1602 = - eventName$jscomp$inline_1600[0].toUpperCase() + - eventName$jscomp$inline_1600.slice(1); + var eventName$jscomp$inline_1603 = + simpleEventPluginEvents[i$jscomp$inline_1602], + domEventName$jscomp$inline_1604 = + eventName$jscomp$inline_1603.toLowerCase(), + capitalizedEvent$jscomp$inline_1605 = + eventName$jscomp$inline_1603[0].toUpperCase() + + eventName$jscomp$inline_1603.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1601, - "on" + capitalizedEvent$jscomp$inline_1602 + domEventName$jscomp$inline_1604, + "on" + capitalizedEvent$jscomp$inline_1605 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16874,17 +16917,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1825 = { +var devToolsConfig$jscomp$inline_1828 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-classic-fc109ac4", + version: "18.3.0-www-classic-b43bd001", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2176 = { - bundleType: devToolsConfig$jscomp$inline_1825.bundleType, - version: devToolsConfig$jscomp$inline_1825.version, - rendererPackageName: devToolsConfig$jscomp$inline_1825.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1825.rendererConfig, +var internals$jscomp$inline_2179 = { + bundleType: devToolsConfig$jscomp$inline_1828.bundleType, + version: devToolsConfig$jscomp$inline_1828.version, + rendererPackageName: devToolsConfig$jscomp$inline_1828.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1828.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16900,26 +16943,26 @@ var internals$jscomp$inline_2176 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1825.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1828.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-classic-fc109ac4" + reconcilerVersion: "18.3.0-www-classic-b43bd001" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2177 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2180 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2177.isDisabled && - hook$jscomp$inline_2177.supportsFiber + !hook$jscomp$inline_2180.isDisabled && + hook$jscomp$inline_2180.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2177.inject( - internals$jscomp$inline_2176 + (rendererID = hook$jscomp$inline_2180.inject( + internals$jscomp$inline_2179 )), - (injectedHook = hook$jscomp$inline_2177); + (injectedHook = hook$jscomp$inline_2180); } catch (err) {} } assign(Internals, { @@ -17395,4 +17438,4 @@ exports.useFormState = function () { exports.useFormStatus = function () { throw Error(formatProdErrorMessage(248)); }; -exports.version = "18.3.0-www-classic-fc109ac4"; +exports.version = "18.3.0-www-classic-b43bd001"; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.modern.js b/compiled/facebook-www/ReactDOMTesting-prod.modern.js index 20163660b1e03..6a49cbc0d63d6 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.modern.js @@ -3158,7 +3158,7 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { ? markRootSuspended( workInProgressRootRenderLanes$50, nextLanes, - 0 + workInProgressDeferredLane ) : ((workInProgressRootRenderLanes$50.finishedWork = workInProgressRootRenderLanes$50.current.alternate), @@ -5553,6 +5553,15 @@ var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: 0 }; function mountSuspenseOffscreenState(renderLanes) { return { baseLanes: renderLanes, cachePool: getSuspendedCache() }; } +function getRemainingWorkInPrimaryTree( + current, + primaryTreeDidDefer, + renderLanes +) { + current = null !== current ? current.childLanes & ~renderLanes : 0; + primaryTreeDidDefer && (current |= workInProgressDeferredLane); + return current; +} function updateSuspenseComponent(current, workInProgress, renderLanes) { var nextProps = workInProgress.pendingProps, showFallback = !1, @@ -5564,64 +5573,69 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ? !1 : 0 !== (suspenseStackCursor.current & 2)); JSCompiler_temp && ((showFallback = !0), (workInProgress.flags &= -129)); + JSCompiler_temp = 0 !== (workInProgress.flags & 32); + workInProgress.flags &= -33; if (null === current) { if (isHydrating) { showFallback ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); - isHydrating && - (((didSuspend = current = nextHydratableInstance), didSuspend) - ? tryHydrateSuspense(workInProgress, didSuspend) || - (shouldClientRenderOnMismatch(workInProgress) && - throwOnHydrationMismatch(), - (nextHydratableInstance = getNextHydratable( - didSuspend.nextSibling - )), - (JSCompiler_temp = hydrationParentFiber), - nextHydratableInstance && - tryHydrateSuspense(workInProgress, nextHydratableInstance) - ? deleteHydratableInstance(JSCompiler_temp, didSuspend) - : (insertNonHydratedInstance( - hydrationParentFiber, - workInProgress - ), - (isHydrating = !1), - (hydrationParentFiber = workInProgress), - (nextHydratableInstance = current))) - : (shouldClientRenderOnMismatch(workInProgress) && - throwOnHydrationMismatch(), + if (isHydrating) { + var nextInstance = (didSuspend = nextHydratableInstance); + if (!nextInstance) + shouldClientRenderOnMismatch(workInProgress) && + throwOnHydrationMismatch(), insertNonHydratedInstance(hydrationParentFiber, workInProgress), (isHydrating = !1), (hydrationParentFiber = workInProgress), - (nextHydratableInstance = current))); - current = workInProgress.memoizedState; + (nextHydratableInstance = didSuspend); + else if (!tryHydrateSuspense(workInProgress, nextInstance)) { + shouldClientRenderOnMismatch(workInProgress) && + throwOnHydrationMismatch(); + nextHydratableInstance = getNextHydratable(nextInstance.nextSibling); + var prevHydrationParentFiber = hydrationParentFiber; + nextHydratableInstance && + tryHydrateSuspense(workInProgress, nextHydratableInstance) + ? deleteHydratableInstance(prevHydrationParentFiber, nextInstance) + : (insertNonHydratedInstance(hydrationParentFiber, workInProgress), + (isHydrating = !1), + (hydrationParentFiber = workInProgress), + (nextHydratableInstance = didSuspend)); + } + } + didSuspend = workInProgress.memoizedState; if ( - null !== current && - ((current = current.dehydrated), null !== current) + null !== didSuspend && + ((didSuspend = didSuspend.dehydrated), null !== didSuspend) ) return ( 0 === (workInProgress.mode & 1) ? (workInProgress.lanes = 2) - : "$!" === current.data + : "$!" === didSuspend.data ? (workInProgress.lanes = 16) : (workInProgress.lanes = 536870912), null ); popSuspenseHandler(workInProgress); } - current = nextProps.children; - didSuspend = nextProps.fallback; + didSuspend = nextProps.children; + nextInstance = nextProps.fallback; if (showFallback) return ( reuseSuspenseHandlerOnStack(workInProgress), - (current = mountSuspenseFallbackChildren( + (nextProps = mountSuspenseFallbackChildren( workInProgress, - current, didSuspend, + nextInstance, + renderLanes + )), + (showFallback = workInProgress.child), + (showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes)), + (showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, renderLanes )), - (nextProps = workInProgress.child), - (nextProps.memoizedState = mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), enableTransitionTracing && ((workInProgress = enableTransitionTracing @@ -5631,65 +5645,75 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { ((renderLanes = enableTransitionTracing ? markerInstanceStack.current : null), - (showFallback = nextProps.updateQueue), - null === showFallback - ? (nextProps.updateQueue = { + (current = showFallback.updateQueue), + null === current + ? (showFallback.updateQueue = { transitions: workInProgress, markerInstances: renderLanes, retryQueue: null }) - : ((showFallback.transitions = workInProgress), - (showFallback.markerInstances = renderLanes)))), - current + : ((current.transitions = workInProgress), + (current.markerInstances = renderLanes)))), + nextProps ); if ("number" === typeof nextProps.unstable_expectedLoadTime) return ( reuseSuspenseHandlerOnStack(workInProgress), - (current = mountSuspenseFallbackChildren( + (nextProps = mountSuspenseFallbackChildren( workInProgress, - current, didSuspend, + nextInstance, + renderLanes + )), + (showFallback = workInProgress.child), + (showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes)), + (showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, renderLanes )), - (workInProgress.child.memoizedState = - mountSuspenseOffscreenState(renderLanes)), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - current + nextProps ); pushPrimaryTreeSuspenseHandler(workInProgress); - return mountSuspensePrimaryChildren(workInProgress, current); - } - JSCompiler_temp = current.memoizedState; - if (null !== JSCompiler_temp) { - var dehydrated$76 = JSCompiler_temp.dehydrated; - if (null !== dehydrated$76) - return updateDehydratedSuspenseComponent( - current, - workInProgress, - didSuspend, - nextProps, - dehydrated$76, - JSCompiler_temp, - renderLanes - ); + return mountSuspensePrimaryChildren(workInProgress, didSuspend); } + nextInstance = current.memoizedState; + if ( + null !== nextInstance && + ((prevHydrationParentFiber = nextInstance.dehydrated), + null !== prevHydrationParentFiber) + ) + return updateDehydratedSuspenseComponent( + current, + workInProgress, + didSuspend, + JSCompiler_temp, + nextProps, + prevHydrationParentFiber, + nextInstance, + renderLanes + ); if (showFallback) { reuseSuspenseHandlerOnStack(workInProgress); showFallback = nextProps.fallback; didSuspend = workInProgress.mode; - JSCompiler_temp = current.child; - dehydrated$76 = JSCompiler_temp.sibling; + nextInstance = current.child; + prevHydrationParentFiber = nextInstance.sibling; var primaryChildProps = { mode: "hidden", children: nextProps.children }; - 0 === (didSuspend & 1) && workInProgress.child !== JSCompiler_temp + 0 === (didSuspend & 1) && workInProgress.child !== nextInstance ? ((nextProps = workInProgress.child), (nextProps.childLanes = 0), (nextProps.pendingProps = primaryChildProps), (workInProgress.deletions = null)) - : ((nextProps = createWorkInProgress(JSCompiler_temp, primaryChildProps)), - (nextProps.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280)); - null !== dehydrated$76 - ? (showFallback = createWorkInProgress(dehydrated$76, showFallback)) + : ((nextProps = createWorkInProgress(nextInstance, primaryChildProps)), + (nextProps.subtreeFlags = nextInstance.subtreeFlags & 31457280)); + null !== prevHydrationParentFiber + ? (showFallback = createWorkInProgress( + prevHydrationParentFiber, + showFallback + )) : ((showFallback = createFiberFromFragment( showFallback, didSuspend, @@ -5706,64 +5730,71 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { didSuspend = current.child.memoizedState; null === didSuspend ? (didSuspend = mountSuspenseOffscreenState(renderLanes)) - : ((JSCompiler_temp = didSuspend.cachePool), - null !== JSCompiler_temp - ? ((dehydrated$76 = CacheContext._currentValue), - (JSCompiler_temp = - JSCompiler_temp.parent !== dehydrated$76 - ? { parent: dehydrated$76, pool: dehydrated$76 } - : JSCompiler_temp)) - : (JSCompiler_temp = getSuspendedCache()), + : ((nextInstance = didSuspend.cachePool), + null !== nextInstance + ? ((prevHydrationParentFiber = CacheContext._currentValue), + (nextInstance = + nextInstance.parent !== prevHydrationParentFiber + ? { + parent: prevHydrationParentFiber, + pool: prevHydrationParentFiber + } + : nextInstance)) + : (nextInstance = getSuspendedCache()), (didSuspend = { baseLanes: didSuspend.baseLanes | renderLanes, - cachePool: JSCompiler_temp + cachePool: nextInstance })); showFallback.memoizedState = didSuspend; enableTransitionTracing && ((didSuspend = enableTransitionTracing ? transitionStack.current : null), null !== didSuspend && - ((JSCompiler_temp = enableTransitionTracing + ((nextInstance = enableTransitionTracing ? markerInstanceStack.current : null), - (dehydrated$76 = showFallback.updateQueue), + (prevHydrationParentFiber = showFallback.updateQueue), (primaryChildProps = current.updateQueue), - null === dehydrated$76 + null === prevHydrationParentFiber ? (showFallback.updateQueue = { transitions: didSuspend, - markerInstances: JSCompiler_temp, + markerInstances: nextInstance, retryQueue: null }) - : dehydrated$76 === primaryChildProps + : prevHydrationParentFiber === primaryChildProps ? (showFallback.updateQueue = { transitions: didSuspend, - markerInstances: JSCompiler_temp, + markerInstances: nextInstance, retryQueue: null !== primaryChildProps ? primaryChildProps.retryQueue : null }) - : ((dehydrated$76.transitions = didSuspend), - (dehydrated$76.markerInstances = JSCompiler_temp)))); - showFallback.childLanes = current.childLanes & ~renderLanes; + : ((prevHydrationParentFiber.transitions = didSuspend), + (prevHydrationParentFiber.markerInstances = nextInstance)))); + showFallback.childLanes = getRemainingWorkInPrimaryTree( + current, + JSCompiler_temp, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return nextProps; } pushPrimaryTreeSuspenseHandler(workInProgress); - showFallback = current.child; - current = showFallback.sibling; - nextProps = createWorkInProgress(showFallback, { + JSCompiler_temp = current.child; + current = JSCompiler_temp.sibling; + JSCompiler_temp = createWorkInProgress(JSCompiler_temp, { mode: "visible", children: nextProps.children }); - 0 === (workInProgress.mode & 1) && (nextProps.lanes = renderLanes); - nextProps.return = workInProgress; - nextProps.sibling = null; + 0 === (workInProgress.mode & 1) && (JSCompiler_temp.lanes = renderLanes); + JSCompiler_temp.return = workInProgress; + JSCompiler_temp.sibling = null; null !== current && ((renderLanes = workInProgress.deletions), null === renderLanes ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) : renderLanes.push(current)); - workInProgress.child = nextProps; + workInProgress.child = JSCompiler_temp; workInProgress.memoizedState = null; - return nextProps; + return JSCompiler_temp; } function mountSuspensePrimaryChildren(workInProgress, primaryChildren) { primaryChildren = createFiberFromOffscreen( @@ -5825,6 +5856,7 @@ function updateDehydratedSuspenseComponent( current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, @@ -5874,8 +5906,13 @@ function updateDehydratedSuspenseComponent( workInProgress.child = nextProps; 0 !== (workInProgress.mode & 1) && reconcileChildFibers(workInProgress, current.child, null, renderLanes); - workInProgress.child.memoizedState = - mountSuspenseOffscreenState(renderLanes); + suspenseState = workInProgress.child; + suspenseState.memoizedState = mountSuspenseOffscreenState(renderLanes); + suspenseState.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return suspenseInstance; } @@ -5892,10 +5929,10 @@ function updateDehydratedSuspenseComponent( suspenseInstance.nextSibling && suspenseInstance.nextSibling.dataset; if (suspenseInstance) var digest = suspenseInstance.dgst; suspenseInstance = digest; - suspenseState = Error(formatProdErrorMessage(419)); - suspenseState.digest = suspenseInstance; + didPrimaryChildrenDefer = Error(formatProdErrorMessage(419)); + didPrimaryChildrenDefer.digest = suspenseInstance; suspenseInstance = createCapturedValue( - suspenseState, + didPrimaryChildrenDefer, suspenseInstance, void 0 ); @@ -5909,22 +5946,23 @@ function updateDehydratedSuspenseComponent( enableLazyContextPropagation && !didReceiveUpdate && propagateParentContextChanges(current, workInProgress, renderLanes, !1); - digest = 0 !== (renderLanes & current.childLanes); - if (didReceiveUpdate || digest) { - nextProps = workInProgressRoot; - if (null !== nextProps) { - digest = renderLanes & -renderLanes; - if (enableUnifiedSyncLane && 0 !== (digest & SyncUpdateLanes)) digest = 1; + didPrimaryChildrenDefer = 0 !== (renderLanes & current.childLanes); + if (didReceiveUpdate || didPrimaryChildrenDefer) { + didPrimaryChildrenDefer = workInProgressRoot; + if (null !== didPrimaryChildrenDefer) { + nextProps = renderLanes & -renderLanes; + if (enableUnifiedSyncLane && 0 !== (nextProps & SyncUpdateLanes)) + nextProps = 1; else - switch (digest) { + switch (nextProps) { case 2: - digest = 1; + nextProps = 1; break; case 8: - digest = 4; + nextProps = 4; break; case 32: - digest = 16; + nextProps = 16; break; case 128: case 256: @@ -5945,21 +5983,24 @@ function updateDehydratedSuspenseComponent( case 8388608: case 16777216: case 33554432: - digest = 64; + nextProps = 64; break; case 268435456: - digest = 134217728; + nextProps = 134217728; break; default: - digest = 0; + nextProps = 0; } - digest = - 0 !== (digest & (nextProps.suspendedLanes | renderLanes)) ? 0 : digest; - if (0 !== digest && digest !== suspenseState.retryLane) + nextProps = + 0 !== + (nextProps & (didPrimaryChildrenDefer.suspendedLanes | renderLanes)) + ? 0 + : nextProps; + if (0 !== nextProps && nextProps !== suspenseState.retryLane) throw ( - ((suspenseState.retryLane = digest), - enqueueConcurrentRenderForLane(current, digest), - scheduleUpdateOnFiber(nextProps, current, digest), + ((suspenseState.retryLane = nextProps), + enqueueConcurrentRenderForLane(current, nextProps), + scheduleUpdateOnFiber(didPrimaryChildrenDefer, current, nextProps), SelectiveHydrationException) ); } @@ -10095,6 +10136,8 @@ function requestDeferredLane() { 0 === (workInProgressRootRenderLanes & 536870912) || isHydrating ? requestTransitionLane() : 536870912); + var suspenseHandler = suspenseHandlerStackCursor.current; + null !== suspenseHandler && (suspenseHandler.flags |= 32); return workInProgressDeferredLane; } function scheduleUpdateOnFiber(root, fiber, lane) { @@ -13226,14 +13269,14 @@ var isInputEventSupported = !1; if (canUseDOM) { var JSCompiler_inline_result$jscomp$345; if (canUseDOM) { - 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; + var isSupported$jscomp$inline_1560 = "oninput" in document; + if (!isSupported$jscomp$inline_1560) { + var element$jscomp$inline_1561 = document.createElement("div"); + element$jscomp$inline_1561.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1560 = + "function" === typeof element$jscomp$inline_1561.oninput; } - JSCompiler_inline_result$jscomp$345 = isSupported$jscomp$inline_1557; + JSCompiler_inline_result$jscomp$345 = isSupported$jscomp$inline_1560; } else JSCompiler_inline_result$jscomp$345 = !1; isInputEventSupported = JSCompiler_inline_result$jscomp$345 && @@ -13545,20 +13588,20 @@ function registerSimpleEvent(domEventName, reactName) { registerTwoPhaseEvent(reactName, [domEventName]); } for ( - var i$jscomp$inline_1598 = 0; - i$jscomp$inline_1598 < simpleEventPluginEvents.length; - i$jscomp$inline_1598++ + var i$jscomp$inline_1601 = 0; + i$jscomp$inline_1601 < simpleEventPluginEvents.length; + i$jscomp$inline_1601++ ) { - 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); + var eventName$jscomp$inline_1602 = + simpleEventPluginEvents[i$jscomp$inline_1601], + domEventName$jscomp$inline_1603 = + eventName$jscomp$inline_1602.toLowerCase(), + capitalizedEvent$jscomp$inline_1604 = + eventName$jscomp$inline_1602[0].toUpperCase() + + eventName$jscomp$inline_1602.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1600, - "on" + capitalizedEvent$jscomp$inline_1601 + domEventName$jscomp$inline_1603, + "on" + capitalizedEvent$jscomp$inline_1604 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16451,17 +16494,17 @@ Internals.Events = [ restoreStateIfNeeded, batchedUpdates$1 ]; -var devToolsConfig$jscomp$inline_1784 = { +var devToolsConfig$jscomp$inline_1787 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "18.3.0-www-modern-760a7212", + version: "18.3.0-www-modern-2c95a0f1", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2140 = { - bundleType: devToolsConfig$jscomp$inline_1784.bundleType, - version: devToolsConfig$jscomp$inline_1784.version, - rendererPackageName: devToolsConfig$jscomp$inline_1784.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1784.rendererConfig, +var internals$jscomp$inline_2143 = { + bundleType: devToolsConfig$jscomp$inline_1787.bundleType, + version: devToolsConfig$jscomp$inline_1787.version, + rendererPackageName: devToolsConfig$jscomp$inline_1787.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1787.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16478,26 +16521,26 @@ var internals$jscomp$inline_2140 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1784.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1787.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-www-modern-760a7212" + reconcilerVersion: "18.3.0-www-modern-2c95a0f1" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2141 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2144 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2141.isDisabled && - hook$jscomp$inline_2141.supportsFiber + !hook$jscomp$inline_2144.isDisabled && + hook$jscomp$inline_2144.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2141.inject( - internals$jscomp$inline_2140 + (rendererID = hook$jscomp$inline_2144.inject( + internals$jscomp$inline_2143 )), - (injectedHook = hook$jscomp$inline_2141); + (injectedHook = hook$jscomp$inline_2144); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; @@ -16901,4 +16944,4 @@ exports.useFormState = function () { exports.useFormStatus = function () { throw Error(formatProdErrorMessage(248)); }; -exports.version = "18.3.0-www-modern-760a7212"; +exports.version = "18.3.0-www-modern-2c95a0f1"; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.classic.js b/compiled/facebook-www/ReactTestRenderer-dev.classic.js index d6803900e7b13..220610b355007 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.classic.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.classic.js @@ -484,6 +484,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; + var DidDefer = ContentReset; var LifecycleEffectMask = Passive$1 | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) @@ -14269,9 +14270,26 @@ if (__DEV__) { return hasSuspenseListContext(suspenseContext, ForceSuspenseFallback); } - function getRemainingWorkInPrimaryTree(current, renderLanes) { - // TODO: Should not remove render lanes that were pinged during this render - return removeLanes(current.childLanes, renderLanes); + function getRemainingWorkInPrimaryTree( + current, + primaryTreeDidDefer, + renderLanes + ) { + var remainingLanes = + current !== null + ? removeLanes(current.childLanes, renderLanes) + : NoLanes; + + if (primaryTreeDidDefer) { + // A useDeferredValue hook spawned a deferred task inside the primary tree. + // Ensure that we retry this component at the deferred priority. + // TODO: We could make this a per-subtree value instead of a global one. + // Would need to track it on the context stack somehow, similar to what + // we'd have to do for resumable contexts. + remainingLanes = mergeLanes(remainingLanes, peekDeferredLane()); + } + + return remainingLanes; } function updateSuspenseComponent(current, workInProgress, renderLanes) { @@ -14291,7 +14309,12 @@ if (__DEV__) { // rendering the fallback children. showFallback = true; workInProgress.flags &= ~DidCapture; - } // OK, the next part is confusing. We're about to reconcile the Suspense + } // Check if the primary children spawned a deferred task (useDeferredValue) + // during the first pass. + + var didPrimaryChildrenDefer = + (workInProgress.flags & DidDefer) !== NoFlags$1; + workInProgress.flags &= ~DidDefer; // OK, the next part is confusing. We're about to reconcile the Suspense // boundary's children. This involves some custom reconciliation logic. Two // main reasons this is so complicated. // @@ -14329,6 +14352,11 @@ if (__DEV__) { var primaryChildFragment = workInProgress.child; primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); + primaryChildFragment.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return fallbackFragment; @@ -14352,6 +14380,7 @@ if (__DEV__) { current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, _dehydrated, prevState, @@ -14380,6 +14409,7 @@ if (__DEV__) { _primaryChildFragment2.childLanes = getRemainingWorkInPrimaryTree( current, + didPrimaryChildrenDefer, renderLanes ); workInProgress.memoizedState = SUSPENDED_MARKER; @@ -14698,6 +14728,7 @@ if (__DEV__) { current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, @@ -14899,6 +14930,11 @@ if (__DEV__) { var _primaryChildFragment4 = workInProgress.child; _primaryChildFragment4.memoizedState = mountSuspenseOffscreenState(renderLanes); + _primaryChildFragment4.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return fallbackChildFragment; } @@ -22007,10 +22043,22 @@ if (__DEV__) { // Everything else is spawned as a transition. workInProgressDeferredLane = requestTransitionLane(); } + } // Mark the parent Suspense boundary so it knows to spawn the deferred lane. + + var suspenseHandler = getSuspenseHandler(); + + if (suspenseHandler !== null) { + // TODO: As an optimization, we shouldn't entangle the lanes at the root; we + // can entangle them using the baseLanes of the Suspense boundary instead. + // We only need to do something special if there's no Suspense boundary. + suspenseHandler.flags |= DidDefer; } return workInProgressDeferredLane; } + function peekDeferredLane() { + return workInProgressDeferredLane; + } function scheduleUpdateOnFiber(root, fiber, lane) { { if (isRunningInsertionEffect) { @@ -22579,7 +22627,7 @@ if (__DEV__) { // 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, NoLane); + markRootSuspended(root, lanes, workInProgressDeferredLane); ensureRootIsScheduled(root); return null; } // We now have a consistent tree. Because this is a sync render, we @@ -25931,7 +25979,7 @@ if (__DEV__) { return root; } - var ReactVersion = "18.3.0-www-classic-dd7a0299"; + var ReactVersion = "18.3.0-www-classic-9e2eb6c9"; // Might add PROFILE later. diff --git a/compiled/facebook-www/ReactTestRenderer-dev.modern.js b/compiled/facebook-www/ReactTestRenderer-dev.modern.js index 086f795d00118..ec7b246ca466f 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.modern.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.modern.js @@ -484,6 +484,7 @@ if (__DEV__) { var ScheduleRetry = StoreConsistency; var ShouldSuspendCommit = Visibility; + var DidDefer = ContentReset; var LifecycleEffectMask = Passive$1 | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) @@ -14269,9 +14270,26 @@ if (__DEV__) { return hasSuspenseListContext(suspenseContext, ForceSuspenseFallback); } - function getRemainingWorkInPrimaryTree(current, renderLanes) { - // TODO: Should not remove render lanes that were pinged during this render - return removeLanes(current.childLanes, renderLanes); + function getRemainingWorkInPrimaryTree( + current, + primaryTreeDidDefer, + renderLanes + ) { + var remainingLanes = + current !== null + ? removeLanes(current.childLanes, renderLanes) + : NoLanes; + + if (primaryTreeDidDefer) { + // A useDeferredValue hook spawned a deferred task inside the primary tree. + // Ensure that we retry this component at the deferred priority. + // TODO: We could make this a per-subtree value instead of a global one. + // Would need to track it on the context stack somehow, similar to what + // we'd have to do for resumable contexts. + remainingLanes = mergeLanes(remainingLanes, peekDeferredLane()); + } + + return remainingLanes; } function updateSuspenseComponent(current, workInProgress, renderLanes) { @@ -14291,7 +14309,12 @@ if (__DEV__) { // rendering the fallback children. showFallback = true; workInProgress.flags &= ~DidCapture; - } // OK, the next part is confusing. We're about to reconcile the Suspense + } // Check if the primary children spawned a deferred task (useDeferredValue) + // during the first pass. + + var didPrimaryChildrenDefer = + (workInProgress.flags & DidDefer) !== NoFlags$1; + workInProgress.flags &= ~DidDefer; // OK, the next part is confusing. We're about to reconcile the Suspense // boundary's children. This involves some custom reconciliation logic. Two // main reasons this is so complicated. // @@ -14329,6 +14352,11 @@ if (__DEV__) { var primaryChildFragment = workInProgress.child; primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); + primaryChildFragment.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return fallbackFragment; @@ -14352,6 +14380,7 @@ if (__DEV__) { current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, _dehydrated, prevState, @@ -14380,6 +14409,7 @@ if (__DEV__) { _primaryChildFragment2.childLanes = getRemainingWorkInPrimaryTree( current, + didPrimaryChildrenDefer, renderLanes ); workInProgress.memoizedState = SUSPENDED_MARKER; @@ -14698,6 +14728,7 @@ if (__DEV__) { current, workInProgress, didSuspend, + didPrimaryChildrenDefer, nextProps, suspenseInstance, suspenseState, @@ -14899,6 +14930,11 @@ if (__DEV__) { var _primaryChildFragment4 = workInProgress.child; _primaryChildFragment4.memoizedState = mountSuspenseOffscreenState(renderLanes); + _primaryChildFragment4.childLanes = getRemainingWorkInPrimaryTree( + current, + didPrimaryChildrenDefer, + renderLanes + ); workInProgress.memoizedState = SUSPENDED_MARKER; return fallbackChildFragment; } @@ -22007,10 +22043,22 @@ if (__DEV__) { // Everything else is spawned as a transition. workInProgressDeferredLane = requestTransitionLane(); } + } // Mark the parent Suspense boundary so it knows to spawn the deferred lane. + + var suspenseHandler = getSuspenseHandler(); + + if (suspenseHandler !== null) { + // TODO: As an optimization, we shouldn't entangle the lanes at the root; we + // can entangle them using the baseLanes of the Suspense boundary instead. + // We only need to do something special if there's no Suspense boundary. + suspenseHandler.flags |= DidDefer; } return workInProgressDeferredLane; } + function peekDeferredLane() { + return workInProgressDeferredLane; + } function scheduleUpdateOnFiber(root, fiber, lane) { { if (isRunningInsertionEffect) { @@ -22579,7 +22627,7 @@ if (__DEV__) { // 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, NoLane); + markRootSuspended(root, lanes, workInProgressDeferredLane); ensureRootIsScheduled(root); return null; } // We now have a consistent tree. Because this is a sync render, we @@ -25931,7 +25979,7 @@ if (__DEV__) { return root; } - var ReactVersion = "18.3.0-www-modern-8e6c02f7"; + var ReactVersion = "18.3.0-www-modern-41a1d603"; // Might add PROFILE later.