diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.development.js index 5f6ae4052126e..28efe6437871a 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.development.js @@ -1130,6 +1130,13 @@ for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; } + function markRootUpdated$1(root, updateLane) { + root.pendingLanes |= updateLane; + 268435456 !== updateLane && + ((root.suspendedLanes = 0), + (root.pingedLanes = 0), + (root.warmLanes = 0)); + } function markRootFinished( root, finishedLanes, @@ -3876,7 +3883,20 @@ (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { - throwIfInfiniteUpdateLoopDetected(); + if (nestedUpdateCount > NESTED_UPDATE_LIMIT) + throw ( + ((nestedPassiveUpdateCount = nestedUpdateCount = 0), + (rootWithPassiveNestedUpdates = rootWithNestedUpdates = null), + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + )) + ); + nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT && + ((nestedPassiveUpdateCount = 0), + (rootWithPassiveNestedUpdates = null), + console.error( + "Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render." + )); null === sourceFiber.alternate && 0 !== (sourceFiber.flags & 4098) && warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); @@ -8883,33 +8903,33 @@ return current; } function updateSuspenseComponent(current, workInProgress, renderLanes) { - var JSCompiler_object_inline_componentStack_2283; - var JSCompiler_object_inline_stack_2282 = workInProgress.pendingProps; + var JSCompiler_object_inline_componentStack_2296; + var JSCompiler_object_inline_stack_2295 = workInProgress.pendingProps; shouldSuspendImpl(workInProgress) && (workInProgress.flags |= 128); - var JSCompiler_object_inline_message_2280 = !1; + var JSCompiler_object_inline_message_2293 = !1; var didSuspend = 0 !== (workInProgress.flags & 128); - (JSCompiler_object_inline_componentStack_2283 = didSuspend) || - (JSCompiler_object_inline_componentStack_2283 = + (JSCompiler_object_inline_componentStack_2296 = didSuspend) || + (JSCompiler_object_inline_componentStack_2296 = null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseStackCursor.current & ForceSuspenseFallback)); - JSCompiler_object_inline_componentStack_2283 && - ((JSCompiler_object_inline_message_2280 = !0), + JSCompiler_object_inline_componentStack_2296 && + ((JSCompiler_object_inline_message_2293 = !0), (workInProgress.flags &= -129)); - JSCompiler_object_inline_componentStack_2283 = + JSCompiler_object_inline_componentStack_2296 = 0 !== (workInProgress.flags & 32); workInProgress.flags &= -33; if (null === current) { if (isHydrating) { - JSCompiler_object_inline_message_2280 + JSCompiler_object_inline_message_2293 ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); if (isHydrating) { - var JSCompiler_object_inline_digest_2281 = nextHydratableInstance; + var JSCompiler_object_inline_digest_2294 = nextHydratableInstance; var JSCompiler_temp; - if (!(JSCompiler_temp = !JSCompiler_object_inline_digest_2281)) { + if (!(JSCompiler_temp = !JSCompiler_object_inline_digest_2294)) { c: { - var instance = JSCompiler_object_inline_digest_2281; + var instance = JSCompiler_object_inline_digest_2294; for ( JSCompiler_temp = rootOrSingletonContext; 8 !== instance.nodeType; @@ -8950,19 +8970,19 @@ JSCompiler_temp && (warnNonHydratedInstance( workInProgress, - JSCompiler_object_inline_digest_2281 + JSCompiler_object_inline_digest_2294 ), throwOnHydrationMismatch(workInProgress)); } - JSCompiler_object_inline_digest_2281 = workInProgress.memoizedState; + JSCompiler_object_inline_digest_2294 = workInProgress.memoizedState; if ( - null !== JSCompiler_object_inline_digest_2281 && - ((JSCompiler_object_inline_digest_2281 = - JSCompiler_object_inline_digest_2281.dehydrated), - null !== JSCompiler_object_inline_digest_2281) + null !== JSCompiler_object_inline_digest_2294 && + ((JSCompiler_object_inline_digest_2294 = + JSCompiler_object_inline_digest_2294.dehydrated), + null !== JSCompiler_object_inline_digest_2294) ) return ( - JSCompiler_object_inline_digest_2281.data === + JSCompiler_object_inline_digest_2294.data === SUSPENSE_FALLBACK_START_DATA ? (workInProgress.lanes = 16) : (workInProgress.lanes = 536870912), @@ -8970,68 +8990,68 @@ ); popSuspenseHandler(workInProgress); } - JSCompiler_object_inline_digest_2281 = - JSCompiler_object_inline_stack_2282.children; - JSCompiler_temp = JSCompiler_object_inline_stack_2282.fallback; - if (JSCompiler_object_inline_message_2280) + JSCompiler_object_inline_digest_2294 = + JSCompiler_object_inline_stack_2295.children; + JSCompiler_temp = JSCompiler_object_inline_stack_2295.fallback; + if (JSCompiler_object_inline_message_2293) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2282 = + (JSCompiler_object_inline_stack_2295 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_digest_2281, + JSCompiler_object_inline_digest_2294, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_message_2280 = workInProgress.child), - (JSCompiler_object_inline_message_2280.memoizedState = + (JSCompiler_object_inline_message_2293 = workInProgress.child), + (JSCompiler_object_inline_message_2293.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_message_2280.childLanes = + (JSCompiler_object_inline_message_2293.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2283, + JSCompiler_object_inline_componentStack_2296, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2282 + JSCompiler_object_inline_stack_2295 ); if ( "number" === - typeof JSCompiler_object_inline_stack_2282.unstable_expectedLoadTime + typeof JSCompiler_object_inline_stack_2295.unstable_expectedLoadTime ) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2282 = + (JSCompiler_object_inline_stack_2295 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_digest_2281, + JSCompiler_object_inline_digest_2294, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_message_2280 = workInProgress.child), - (JSCompiler_object_inline_message_2280.memoizedState = + (JSCompiler_object_inline_message_2293 = workInProgress.child), + (JSCompiler_object_inline_message_2293.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_message_2280.childLanes = + (JSCompiler_object_inline_message_2293.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2283, + JSCompiler_object_inline_componentStack_2296, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - JSCompiler_object_inline_stack_2282 + JSCompiler_object_inline_stack_2295 ); pushPrimaryTreeSuspenseHandler(workInProgress); return mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_digest_2281 + JSCompiler_object_inline_digest_2294 ); } var prevState = current.memoizedState; if ( null !== prevState && - ((JSCompiler_object_inline_digest_2281 = prevState.dehydrated), - null !== JSCompiler_object_inline_digest_2281) + ((JSCompiler_object_inline_digest_2294 = prevState.dehydrated), + null !== JSCompiler_object_inline_digest_2294) ) { if (didSuspend) workInProgress.flags & 256 @@ -9048,94 +9068,94 @@ (workInProgress.flags |= 128), (workInProgress = null)) : (reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_message_2280 = - JSCompiler_object_inline_stack_2282.fallback), - (JSCompiler_object_inline_digest_2281 = workInProgress.mode), - (JSCompiler_object_inline_stack_2282 = + (JSCompiler_object_inline_message_2293 = + JSCompiler_object_inline_stack_2295.fallback), + (JSCompiler_object_inline_digest_2294 = workInProgress.mode), + (JSCompiler_object_inline_stack_2295 = mountWorkInProgressOffscreenFiber( { mode: "visible", - children: JSCompiler_object_inline_stack_2282.children + children: JSCompiler_object_inline_stack_2295.children }, - JSCompiler_object_inline_digest_2281 + JSCompiler_object_inline_digest_2294 )), - (JSCompiler_object_inline_message_2280 = + (JSCompiler_object_inline_message_2293 = createFiberFromFragment( - JSCompiler_object_inline_message_2280, - JSCompiler_object_inline_digest_2281, + JSCompiler_object_inline_message_2293, + JSCompiler_object_inline_digest_2294, renderLanes, null )), - (JSCompiler_object_inline_message_2280.flags |= 2), - (JSCompiler_object_inline_stack_2282.return = workInProgress), - (JSCompiler_object_inline_message_2280.return = workInProgress), - (JSCompiler_object_inline_stack_2282.sibling = - JSCompiler_object_inline_message_2280), - (workInProgress.child = JSCompiler_object_inline_stack_2282), + (JSCompiler_object_inline_message_2293.flags |= 2), + (JSCompiler_object_inline_stack_2295.return = workInProgress), + (JSCompiler_object_inline_message_2293.return = workInProgress), + (JSCompiler_object_inline_stack_2295.sibling = + JSCompiler_object_inline_message_2293), + (workInProgress.child = JSCompiler_object_inline_stack_2295), reconcileChildFibers( workInProgress, current.child, null, renderLanes ), - (JSCompiler_object_inline_stack_2282 = workInProgress.child), - (JSCompiler_object_inline_stack_2282.memoizedState = + (JSCompiler_object_inline_stack_2295 = workInProgress.child), + (JSCompiler_object_inline_stack_2295.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_stack_2282.childLanes = + (JSCompiler_object_inline_stack_2295.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2283, + JSCompiler_object_inline_componentStack_2296, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress = JSCompiler_object_inline_message_2280)); + (workInProgress = JSCompiler_object_inline_message_2293)); else if ( (pushPrimaryTreeSuspenseHandler(workInProgress), isHydrating && console.error( "We should not be hydrating here. This is a bug in React. Please file a bug." ), - JSCompiler_object_inline_digest_2281.data === + JSCompiler_object_inline_digest_2294.data === SUSPENSE_FALLBACK_START_DATA) ) { - JSCompiler_object_inline_componentStack_2283 = - JSCompiler_object_inline_digest_2281.nextSibling && - JSCompiler_object_inline_digest_2281.nextSibling.dataset; - if (JSCompiler_object_inline_componentStack_2283) { - JSCompiler_temp = JSCompiler_object_inline_componentStack_2283.dgst; - var message = JSCompiler_object_inline_componentStack_2283.msg; - instance = JSCompiler_object_inline_componentStack_2283.stck; + JSCompiler_object_inline_componentStack_2296 = + JSCompiler_object_inline_digest_2294.nextSibling && + JSCompiler_object_inline_digest_2294.nextSibling.dataset; + if (JSCompiler_object_inline_componentStack_2296) { + JSCompiler_temp = JSCompiler_object_inline_componentStack_2296.dgst; + var message = JSCompiler_object_inline_componentStack_2296.msg; + instance = JSCompiler_object_inline_componentStack_2296.stck; var componentStack = - JSCompiler_object_inline_componentStack_2283.cstck; + JSCompiler_object_inline_componentStack_2296.cstck; } - JSCompiler_object_inline_message_2280 = message; - JSCompiler_object_inline_digest_2281 = JSCompiler_temp; - JSCompiler_object_inline_stack_2282 = instance; - JSCompiler_object_inline_componentStack_2283 = componentStack; - "POSTPONE" !== JSCompiler_object_inline_digest_2281 && - ((JSCompiler_object_inline_message_2280 = - JSCompiler_object_inline_message_2280 - ? Error(JSCompiler_object_inline_message_2280) + JSCompiler_object_inline_message_2293 = message; + JSCompiler_object_inline_digest_2294 = JSCompiler_temp; + JSCompiler_object_inline_stack_2295 = instance; + JSCompiler_object_inline_componentStack_2296 = componentStack; + "POSTPONE" !== JSCompiler_object_inline_digest_2294 && + ((JSCompiler_object_inline_message_2293 = + JSCompiler_object_inline_message_2293 + ? Error(JSCompiler_object_inline_message_2293) : Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." )), - (JSCompiler_object_inline_message_2280.stack = - JSCompiler_object_inline_stack_2282 || ""), - (JSCompiler_object_inline_message_2280.digest = - JSCompiler_object_inline_digest_2281), - (JSCompiler_object_inline_componentStack_2283 = - void 0 === JSCompiler_object_inline_componentStack_2283 + (JSCompiler_object_inline_message_2293.stack = + JSCompiler_object_inline_stack_2295 || ""), + (JSCompiler_object_inline_message_2293.digest = + JSCompiler_object_inline_digest_2294), + (JSCompiler_object_inline_componentStack_2296 = + void 0 === JSCompiler_object_inline_componentStack_2296 ? null - : JSCompiler_object_inline_componentStack_2283), - "string" === typeof JSCompiler_object_inline_componentStack_2283 && + : JSCompiler_object_inline_componentStack_2296), + "string" === typeof JSCompiler_object_inline_componentStack_2296 && CapturedStacks.set( - JSCompiler_object_inline_message_2280, - JSCompiler_object_inline_componentStack_2283 + JSCompiler_object_inline_message_2293, + JSCompiler_object_inline_componentStack_2296 ), queueHydrationError({ - value: JSCompiler_object_inline_message_2280, + value: JSCompiler_object_inline_message_2293, source: null, - stack: JSCompiler_object_inline_componentStack_2283 + stack: JSCompiler_object_inline_componentStack_2296 })); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9150,25 +9170,25 @@ renderLanes, !1 ), - (JSCompiler_object_inline_componentStack_2283 = + (JSCompiler_object_inline_componentStack_2296 = 0 !== (renderLanes & current.childLanes)), - didReceiveUpdate || JSCompiler_object_inline_componentStack_2283) + didReceiveUpdate || JSCompiler_object_inline_componentStack_2296) ) { - JSCompiler_object_inline_componentStack_2283 = workInProgressRoot; - if (null !== JSCompiler_object_inline_componentStack_2283) { - JSCompiler_object_inline_stack_2282 = renderLanes & -renderLanes; - if (0 !== (JSCompiler_object_inline_stack_2282 & 42)) - JSCompiler_object_inline_stack_2282 = 1; + JSCompiler_object_inline_componentStack_2296 = workInProgressRoot; + if (null !== JSCompiler_object_inline_componentStack_2296) { + JSCompiler_object_inline_stack_2295 = renderLanes & -renderLanes; + if (0 !== (JSCompiler_object_inline_stack_2295 & 42)) + JSCompiler_object_inline_stack_2295 = 1; else - switch (JSCompiler_object_inline_stack_2282) { + switch (JSCompiler_object_inline_stack_2295) { case 2: - JSCompiler_object_inline_stack_2282 = 1; + JSCompiler_object_inline_stack_2295 = 1; break; case 8: - JSCompiler_object_inline_stack_2282 = 4; + JSCompiler_object_inline_stack_2295 = 4; break; case 32: - JSCompiler_object_inline_stack_2282 = 16; + JSCompiler_object_inline_stack_2295 = 16; break; case 128: case 256: @@ -9189,40 +9209,40 @@ case 8388608: case 16777216: case 33554432: - JSCompiler_object_inline_stack_2282 = 64; + JSCompiler_object_inline_stack_2295 = 64; break; case 268435456: - JSCompiler_object_inline_stack_2282 = 134217728; + JSCompiler_object_inline_stack_2295 = 134217728; break; default: - JSCompiler_object_inline_stack_2282 = 0; + JSCompiler_object_inline_stack_2295 = 0; } - JSCompiler_object_inline_stack_2282 = + JSCompiler_object_inline_stack_2295 = 0 !== - (JSCompiler_object_inline_stack_2282 & - (JSCompiler_object_inline_componentStack_2283.suspendedLanes | + (JSCompiler_object_inline_stack_2295 & + (JSCompiler_object_inline_componentStack_2296.suspendedLanes | renderLanes)) ? 0 - : JSCompiler_object_inline_stack_2282; + : JSCompiler_object_inline_stack_2295; if ( - 0 !== JSCompiler_object_inline_stack_2282 && - JSCompiler_object_inline_stack_2282 !== prevState.retryLane + 0 !== JSCompiler_object_inline_stack_2295 && + JSCompiler_object_inline_stack_2295 !== prevState.retryLane ) throw ( - ((prevState.retryLane = JSCompiler_object_inline_stack_2282), + ((prevState.retryLane = JSCompiler_object_inline_stack_2295), enqueueConcurrentRenderForLane( current, - JSCompiler_object_inline_stack_2282 + JSCompiler_object_inline_stack_2295 ), scheduleUpdateOnFiber( - JSCompiler_object_inline_componentStack_2283, + JSCompiler_object_inline_componentStack_2296, current, - JSCompiler_object_inline_stack_2282 + JSCompiler_object_inline_stack_2295 ), SelectiveHydrationException) ); } - JSCompiler_object_inline_digest_2281.data === + JSCompiler_object_inline_digest_2294.data === SUSPENSE_PENDING_START_DATA || renderDidSuspendDelayIfPossible(); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9230,7 +9250,7 @@ renderLanes ); } else - JSCompiler_object_inline_digest_2281.data === + JSCompiler_object_inline_digest_2294.data === SUSPENSE_PENDING_START_DATA ? ((workInProgress.flags |= 128), (workInProgress.child = current.child), @@ -9238,12 +9258,12 @@ null, current )), - (JSCompiler_object_inline_digest_2281._reactRetry = + (JSCompiler_object_inline_digest_2294._reactRetry = workInProgress), (workInProgress = null)) : ((current = prevState.treeContext), (nextHydratableInstance = getNextHydratable( - JSCompiler_object_inline_digest_2281.nextSibling + JSCompiler_object_inline_digest_2294.nextSibling )), (hydrationParentFiber = workInProgress), (isHydrating = !0), @@ -9261,54 +9281,54 @@ (treeContextProvider = workInProgress)), (workInProgress = mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_stack_2282.children + JSCompiler_object_inline_stack_2295.children )), (workInProgress.flags |= 4096)); return workInProgress; } - if (JSCompiler_object_inline_message_2280) + if (JSCompiler_object_inline_message_2293) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_message_2280 = - JSCompiler_object_inline_stack_2282.fallback), - (JSCompiler_object_inline_digest_2281 = workInProgress.mode), + (JSCompiler_object_inline_message_2293 = + JSCompiler_object_inline_stack_2295.fallback), + (JSCompiler_object_inline_digest_2294 = workInProgress.mode), (JSCompiler_temp = current.child), (instance = JSCompiler_temp.sibling), - (JSCompiler_object_inline_stack_2282 = createWorkInProgress( + (JSCompiler_object_inline_stack_2295 = createWorkInProgress( JSCompiler_temp, { mode: "hidden", - children: JSCompiler_object_inline_stack_2282.children + children: JSCompiler_object_inline_stack_2295.children } )), - (JSCompiler_object_inline_stack_2282.subtreeFlags = + (JSCompiler_object_inline_stack_2295.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280), null !== instance - ? (JSCompiler_object_inline_message_2280 = createWorkInProgress( + ? (JSCompiler_object_inline_message_2293 = createWorkInProgress( instance, - JSCompiler_object_inline_message_2280 + JSCompiler_object_inline_message_2293 )) - : ((JSCompiler_object_inline_message_2280 = createFiberFromFragment( - JSCompiler_object_inline_message_2280, - JSCompiler_object_inline_digest_2281, + : ((JSCompiler_object_inline_message_2293 = createFiberFromFragment( + JSCompiler_object_inline_message_2293, + JSCompiler_object_inline_digest_2294, renderLanes, null )), - (JSCompiler_object_inline_message_2280.flags |= 2)), - (JSCompiler_object_inline_message_2280.return = workInProgress), - (JSCompiler_object_inline_stack_2282.return = workInProgress), - (JSCompiler_object_inline_stack_2282.sibling = - JSCompiler_object_inline_message_2280), - (workInProgress.child = JSCompiler_object_inline_stack_2282), - (JSCompiler_object_inline_stack_2282 = - JSCompiler_object_inline_message_2280), - (JSCompiler_object_inline_message_2280 = workInProgress.child), - (JSCompiler_object_inline_digest_2281 = current.child.memoizedState), - null === JSCompiler_object_inline_digest_2281 - ? (JSCompiler_object_inline_digest_2281 = + (JSCompiler_object_inline_message_2293.flags |= 2)), + (JSCompiler_object_inline_message_2293.return = workInProgress), + (JSCompiler_object_inline_stack_2295.return = workInProgress), + (JSCompiler_object_inline_stack_2295.sibling = + JSCompiler_object_inline_message_2293), + (workInProgress.child = JSCompiler_object_inline_stack_2295), + (JSCompiler_object_inline_stack_2295 = + JSCompiler_object_inline_message_2293), + (JSCompiler_object_inline_message_2293 = workInProgress.child), + (JSCompiler_object_inline_digest_2294 = current.child.memoizedState), + null === JSCompiler_object_inline_digest_2294 + ? (JSCompiler_object_inline_digest_2294 = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = - JSCompiler_object_inline_digest_2281.cachePool), + JSCompiler_object_inline_digest_2294.cachePool), null !== JSCompiler_temp ? ((instance = CacheContext._currentValue), (JSCompiler_temp = @@ -9316,38 +9336,38 @@ ? { parent: instance, pool: instance } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), - (JSCompiler_object_inline_digest_2281 = { + (JSCompiler_object_inline_digest_2294 = { baseLanes: - JSCompiler_object_inline_digest_2281.baseLanes | renderLanes, + JSCompiler_object_inline_digest_2294.baseLanes | renderLanes, cachePool: JSCompiler_temp })), - (JSCompiler_object_inline_message_2280.memoizedState = - JSCompiler_object_inline_digest_2281), - (JSCompiler_object_inline_message_2280.childLanes = + (JSCompiler_object_inline_message_2293.memoizedState = + JSCompiler_object_inline_digest_2294), + (JSCompiler_object_inline_message_2293.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2283, + JSCompiler_object_inline_componentStack_2296, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2282 + JSCompiler_object_inline_stack_2295 ); pushPrimaryTreeSuspenseHandler(workInProgress); renderLanes = current.child; current = renderLanes.sibling; renderLanes = createWorkInProgress(renderLanes, { mode: "visible", - children: JSCompiler_object_inline_stack_2282.children + children: JSCompiler_object_inline_stack_2295.children }); renderLanes.return = workInProgress; renderLanes.sibling = null; null !== current && - ((JSCompiler_object_inline_componentStack_2283 = + ((JSCompiler_object_inline_componentStack_2296 = workInProgress.deletions), - null === JSCompiler_object_inline_componentStack_2283 + null === JSCompiler_object_inline_componentStack_2296 ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) - : JSCompiler_object_inline_componentStack_2283.push(current)); + : JSCompiler_object_inline_componentStack_2296.push(current)); workInProgress.child = renderLanes; workInProgress.memoizedState = null; return renderLanes; @@ -14571,7 +14591,7 @@ workInProgressDeferredLane, workInProgressRootDidSkipSuspendedSiblings ); - markRootUpdated(root, lane); + markRootUpdated$1(root, lane); if ( 0 !== (executionContext & RenderContext) && root === workInProgressRoot @@ -14902,18 +14922,6 @@ } return !0; } - function markRootUpdated(root, updatedLanes) { - root.pendingLanes |= updatedLanes; - 268435456 !== updatedLanes && - ((root.suspendedLanes = 0), - (root.pingedLanes = 0), - (root.warmLanes = 0)); - executionContext & RenderContext - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & CommitContext && - (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); - } function markRootSuspended( root, suspendedLanes, @@ -15607,13 +15615,14 @@ ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); if ((executionContext & (RenderContext | CommitContext)) !== NoContext) throw Error("Should not already be working."); - var finishedWork = root.finishedWork, - lanes = root.finishedLanes; - reusableComponentDevToolDetails.track = - getGroupNameOfHighestPriorityLane(lanes); + var finishedWork = root.finishedWork; + didIncludeRenderPhaseUpdate = root.finishedLanes; + reusableComponentDevToolDetails.track = getGroupNameOfHighestPriorityLane( + didIncludeRenderPhaseUpdate + ); logRenderPhase(completedRenderStartTime, completedRenderEndTime); if (null === finishedWork) return null; - 0 === lanes && + 0 === didIncludeRenderPhaseUpdate && console.error( "root.finishedLanes should not be empty during a commit. This is a bug in React." ); @@ -15630,13 +15639,12 @@ completedRenderStartTime |= concurrentlyUpdatedLanes; markRootFinished( root, - lanes, + didIncludeRenderPhaseUpdate, completedRenderStartTime, spawnedLane, updatedLanes, suspendedRetryLanes ); - didIncludeCommitPhaseUpdate = !1; root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -15666,12 +15674,16 @@ (updatedLanes = executionContext), (executionContext |= CommitContext), commitBeforeMutationEffects(root, finishedWork), - commitMutationEffects(root, finishedWork, lanes), + commitMutationEffects( + root, + finishedWork, + didIncludeRenderPhaseUpdate + ), restoreSelection(selectionInformation, root.containerInfo), (_enabled = !!eventsEnabled), (selectionInformation = eventsEnabled = null), (root.current = finishedWork), - commitLayoutEffects(finishedWork, root, lanes), + commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate), requestPaint(), (executionContext = updatedLanes), (ReactDOMSharedInternals.p = spawnedLane), @@ -15682,7 +15694,7 @@ (transitions = rootDoesHavePassiveEffects) ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = lanes)) + (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) : (releaseRootPooledCache(root, completedRenderStartTime), (nestedPassiveUpdateCount = 0), (rootWithPassiveNestedUpdates = null)); @@ -15710,15 +15722,14 @@ ); 0 !== (pendingPassiveEffectsLanes & 3) && flushPassiveEffects(); completedRenderStartTime = root.pendingLanes; - didIncludeRenderPhaseUpdate || - didIncludeCommitPhaseUpdate || - (0 !== (lanes & 4194218) && 0 !== (completedRenderStartTime & 42)) + 0 !== (didIncludeRenderPhaseUpdate & 4194218) && + 0 !== (completedRenderStartTime & 42) ? ((nestedUpdateScheduled = !0), root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))) : (nestedUpdateCount = 0); - transitions || finalizeRender(lanes, now$1()); + transitions || finalizeRender(didIncludeRenderPhaseUpdate, now$1()); flushSyncWorkAcrossRoots_impl(0, !1); return null; } @@ -15857,7 +15868,7 @@ sourceFiber = createRootErrorUpdate(rootFiber.stateNode, sourceFiber, 2); rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); null !== rootFiber && - (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); + (markRootUpdated$1(rootFiber, 2), ensureRootIsScheduled(rootFiber)); } function captureCommitPhaseError( sourceFiber, @@ -15896,7 +15907,7 @@ nearestMountedAncestor, sourceFiber ), - markRootUpdated(instance, 2), + markRootUpdated$1(instance, 2), ensureRootIsScheduled(instance)); return; } @@ -15931,11 +15942,6 @@ null !== pingCache && pingCache.delete(wakeable); root.pingedLanes |= root.suspendedLanes & pingedLanes; root.warmLanes &= ~pingedLanes; - executionContext & RenderContext - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & CommitContext && - (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); isConcurrentActEnvironment() && null === ReactSharedInternals.actQueue && console.error( @@ -15959,7 +15965,7 @@ 0 === retryLane && (retryLane = claimNextRetryLane()); boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); null !== boundaryFiber && - (markRootUpdated(boundaryFiber, retryLane), + (markRootUpdated$1(boundaryFiber, retryLane), ensureRootIsScheduled(boundaryFiber)); } function retryDehydratedSuspenseBoundary(boundaryFiber) { @@ -15990,26 +15996,6 @@ null !== retryCache && retryCache.delete(wakeable); retryTimedOutBoundary(boundaryFiber, retryLane); } - function throwIfInfiniteUpdateLoopDetected() { - if (nestedUpdateCount > NESTED_UPDATE_LIMIT) - throw ( - ((nestedPassiveUpdateCount = nestedUpdateCount = 0), - (rootWithPassiveNestedUpdates = rootWithNestedUpdates = null), - executionContext & RenderContext && - null !== workInProgressRoot && - (workInProgressRoot.errorRecoveryDisabledLanes |= - workInProgressRootRenderLanes), - Error( - "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." - )) - ); - nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT && - ((nestedPassiveUpdateCount = 0), - (rootWithPassiveNestedUpdates = null), - console.error( - "Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render." - )); - } function recursivelyTraverseAndDoubleInvokeEffectsInDEV( root$jscomp$0, parentFiber, @@ -24364,7 +24350,6 @@ workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, workInProgressRootDidIncludeRecursiveRenderUpdate = !1, - didIncludeCommitPhaseUpdate = !1, globalMostRecentFallbackTime = 0, FALLBACK_THROTTLE_MS = 300, workInProgressRootRenderTargetTime = Infinity, @@ -24377,12 +24362,12 @@ pendingPassiveEffectsRemainingLanes = 0, pendingPassiveEffectsRenderEndTime = -0, pendingPassiveTransitions = null, - NESTED_UPDATE_LIMIT = 100, + NESTED_UPDATE_LIMIT = 50, nestedUpdateCount = 0, rootWithNestedUpdates = null, isFlushingPassiveEffects = !1, didScheduleUpdateDuringPassiveEffects = !1, - NESTED_PASSIVE_UPDATE_LIMIT = 100, + NESTED_PASSIVE_UPDATE_LIMIT = 50, nestedPassiveUpdateCount = 0, rootWithPassiveNestedUpdates = null, isRunningInsertionEffect = !1, @@ -24933,11 +24918,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-2d16326d-20240930" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-1460d67c-20241003" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -24974,11 +24959,11 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-experimental-2d16326d-20240930", + version: "19.0.0-experimental-1460d67c-20241003", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-2d16326d-20240930" + reconcilerVersion: "19.0.0-experimental-1460d67c-20241003" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25114,13 +25099,13 @@ identifierPrefix.callback = null; enqueueUpdate(options, identifierPrefix, isStrictMode); initialChildren.current.lanes = isStrictMode; - markRootUpdated(initialChildren, isStrictMode); + markRootUpdated$1(initialChildren, isStrictMode); ensureRootIsScheduled(initialChildren); container[internalContainerInstanceKey] = initialChildren.current; listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.0.0-experimental-2d16326d-20240930"; + exports.version = "19.0.0-experimental-1460d67c-20241003"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.production.js index 565310563532e..b7a449da86594 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-client.production.js @@ -691,6 +691,11 @@ function createLaneMap(initial) { for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; } +function markRootUpdated$1(root, updateLane) { + root.pendingLanes |= updateLane; + 268435456 !== updateLane && + ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); +} function markRootFinished( root, finishedLanes, @@ -2398,7 +2403,12 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { - throwIfInfiniteUpdateLoopDetected(); + if (50 < nestedUpdateCount) + throw ( + ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))) + ); for (var parent = sourceFiber.return; null !== parent; ) (sourceFiber = parent), (parent = sourceFiber.return); return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; @@ -10334,7 +10344,6 @@ var DefaultAsyncDispatcher = { workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, workInProgressRootDidIncludeRecursiveRenderUpdate = !1, - didIncludeCommitPhaseUpdate = !1, globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, workInProgressTransitions = null, @@ -10377,7 +10386,7 @@ function scheduleUpdateOnFiber(root, fiber, lane) { workInProgressDeferredLane, workInProgressRootDidSkipSuspendedSiblings ); - markRootUpdated(root, lane); + markRootUpdated$1(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) root === workInProgressRoot && (0 === (executionContext & 2) && @@ -10656,15 +10665,6 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootUpdated(root, updatedLanes) { - root.pendingLanes |= updatedLanes; - 268435456 !== updatedLanes && - ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); - executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); -} function markRootSuspended( root, suspendedLanes, @@ -11163,8 +11163,8 @@ function commitRootImpl( do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); - var finishedWork = root.finishedWork, - lanes = root.finishedLanes; + var finishedWork = root.finishedWork; + didIncludeRenderPhaseUpdate = root.finishedLanes; if (null === finishedWork) return null; root.finishedWork = null; root.finishedLanes = 0; @@ -11176,13 +11176,12 @@ function commitRootImpl( remainingLanes |= concurrentlyUpdatedLanes; markRootFinished( root, - lanes, + didIncludeRenderPhaseUpdate, remainingLanes, spawnedLane, updatedLanes, suspendedRetryLanes ); - didIncludeCommitPhaseUpdate = !1; root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -11219,7 +11218,7 @@ function commitRootImpl( rootDoesHavePassiveEffects ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = lanes)) + (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) : releaseRootPooledCache(root, remainingLanes); remainingLanes = root.pendingLanes; 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); @@ -11237,9 +11236,7 @@ function commitRootImpl( }); 0 !== (pendingPassiveEffectsLanes & 3) && flushPassiveEffects(); remainingLanes = root.pendingLanes; - didIncludeRenderPhaseUpdate || - didIncludeCommitPhaseUpdate || - (0 !== (lanes & 4194218) && 0 !== (remainingLanes & 42)) + 0 !== (didIncludeRenderPhaseUpdate & 4194218) && 0 !== (remainingLanes & 42) ? root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) @@ -11304,7 +11301,7 @@ function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { sourceFiber = createRootErrorUpdate(rootFiber.stateNode, sourceFiber, 2); rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); null !== rootFiber && - (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); + (markRootUpdated$1(rootFiber, 2), ensureRootIsScheduled(rootFiber)); } function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { if (3 === sourceFiber.tag) @@ -11337,7 +11334,7 @@ function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { nearestMountedAncestor, sourceFiber ), - markRootUpdated(instance, 2), + markRootUpdated$1(instance, 2), ensureRootIsScheduled(instance)); break; } @@ -11366,10 +11363,6 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { null !== pingCache && pingCache.delete(wakeable); root.pingedLanes |= root.suspendedLanes & pingedLanes; root.warmLanes &= ~pingedLanes; - executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); workInProgressRoot === root && (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || @@ -11387,7 +11380,7 @@ function retryTimedOutBoundary(boundaryFiber, retryLane) { 0 === retryLane && (retryLane = claimNextRetryLane()); boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); null !== boundaryFiber && - (markRootUpdated(boundaryFiber, retryLane), + (markRootUpdated$1(boundaryFiber, retryLane), ensureRootIsScheduled(boundaryFiber)); } function retryDehydratedSuspenseBoundary(boundaryFiber) { @@ -11416,18 +11409,6 @@ function resolveRetryWakeable(boundaryFiber, wakeable) { null !== retryCache && retryCache.delete(wakeable); retryTimedOutBoundary(boundaryFiber, retryLane); } -function throwIfInfiniteUpdateLoopDetected() { - if (100 < nestedUpdateCount) - throw ( - ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - executionContext & 2 && - null !== workInProgressRoot && - (workInProgressRoot.errorRecoveryDisabledLanes |= - workInProgressRootRenderLanes), - Error(formatProdErrorMessage(185))) - ); -} function scheduleCallback$1(priorityLevel, callback) { return scheduleCallback$3(priorityLevel, callback); } @@ -11714,20 +11695,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1412 = 0; - i$jscomp$inline_1412 < simpleEventPluginEvents.length; - i$jscomp$inline_1412++ + var i$jscomp$inline_1425 = 0; + i$jscomp$inline_1425 < simpleEventPluginEvents.length; + i$jscomp$inline_1425++ ) { - var eventName$jscomp$inline_1413 = - simpleEventPluginEvents[i$jscomp$inline_1412], - domEventName$jscomp$inline_1414 = - eventName$jscomp$inline_1413.toLowerCase(), - capitalizedEvent$jscomp$inline_1415 = - eventName$jscomp$inline_1413[0].toUpperCase() + - eventName$jscomp$inline_1413.slice(1); + var eventName$jscomp$inline_1426 = + simpleEventPluginEvents[i$jscomp$inline_1425], + domEventName$jscomp$inline_1427 = + eventName$jscomp$inline_1426.toLowerCase(), + capitalizedEvent$jscomp$inline_1428 = + eventName$jscomp$inline_1426[0].toUpperCase() + + eventName$jscomp$inline_1426.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1414, - "on" + capitalizedEvent$jscomp$inline_1415 + domEventName$jscomp$inline_1427, + "on" + capitalizedEvent$jscomp$inline_1428 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -15168,16 +15149,16 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { 0 === i && attemptExplicitHydrationTarget(target); } }; -var isomorphicReactPackageVersion$jscomp$inline_1659 = React.version; +var isomorphicReactPackageVersion$jscomp$inline_1672 = React.version; if ( - "19.0.0-experimental-2d16326d-20240930" !== - isomorphicReactPackageVersion$jscomp$inline_1659 + "19.0.0-experimental-1460d67c-20241003" !== + isomorphicReactPackageVersion$jscomp$inline_1672 ) throw Error( formatProdErrorMessage( 527, - isomorphicReactPackageVersion$jscomp$inline_1659, - "19.0.0-experimental-2d16326d-20240930" + isomorphicReactPackageVersion$jscomp$inline_1672, + "19.0.0-experimental-1460d67c-20241003" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15197,25 +15178,25 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { null === componentOrElement ? null : componentOrElement.stateNode; return componentOrElement; }; -var internals$jscomp$inline_2124 = { +var internals$jscomp$inline_2137 = { bundleType: 0, - version: "19.0.0-experimental-2d16326d-20240930", + version: "19.0.0-experimental-1460d67c-20241003", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-2d16326d-20240930" + reconcilerVersion: "19.0.0-experimental-1460d67c-20241003" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2125 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2138 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2125.isDisabled && - hook$jscomp$inline_2125.supportsFiber + !hook$jscomp$inline_2138.isDisabled && + hook$jscomp$inline_2138.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2125.inject( - internals$jscomp$inline_2124 + (rendererID = hook$jscomp$inline_2138.inject( + internals$jscomp$inline_2137 )), - (injectedHook = hook$jscomp$inline_2125); + (injectedHook = hook$jscomp$inline_2138); } catch (err) {} } exports.createRoot = function (container, options) { @@ -15301,10 +15282,10 @@ exports.hydrateRoot = function (container, initialChildren, options) { identifierPrefix.callback = null; enqueueUpdate(options, identifierPrefix, isStrictMode); initialChildren.current.lanes = isStrictMode; - markRootUpdated(initialChildren, isStrictMode); + markRootUpdated$1(initialChildren, isStrictMode); ensureRootIsScheduled(initialChildren); container[internalContainerInstanceKey] = initialChildren.current; listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.0.0-experimental-2d16326d-20240930"; +exports.version = "19.0.0-experimental-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.development.js index 89e846f94100f..6c0a87dffd2aa 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.development.js @@ -1138,6 +1138,13 @@ for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; } + function markRootUpdated$1(root, updateLane) { + root.pendingLanes |= updateLane; + 268435456 !== updateLane && + ((root.suspendedLanes = 0), + (root.pingedLanes = 0), + (root.warmLanes = 0)); + } function markRootFinished( root, finishedLanes, @@ -3884,7 +3891,20 @@ (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { - throwIfInfiniteUpdateLoopDetected(); + if (nestedUpdateCount > NESTED_UPDATE_LIMIT) + throw ( + ((nestedPassiveUpdateCount = nestedUpdateCount = 0), + (rootWithPassiveNestedUpdates = rootWithNestedUpdates = null), + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + )) + ); + nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT && + ((nestedPassiveUpdateCount = 0), + (rootWithPassiveNestedUpdates = null), + console.error( + "Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render." + )); null === sourceFiber.alternate && 0 !== (sourceFiber.flags & 4098) && warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); @@ -8891,33 +8911,33 @@ return current; } function updateSuspenseComponent(current, workInProgress, renderLanes) { - var JSCompiler_object_inline_componentStack_2288; - var JSCompiler_object_inline_stack_2287 = workInProgress.pendingProps; + var JSCompiler_object_inline_componentStack_2301; + var JSCompiler_object_inline_stack_2300 = workInProgress.pendingProps; shouldSuspendImpl(workInProgress) && (workInProgress.flags |= 128); - var JSCompiler_object_inline_message_2285 = !1; + var JSCompiler_object_inline_message_2298 = !1; var didSuspend = 0 !== (workInProgress.flags & 128); - (JSCompiler_object_inline_componentStack_2288 = didSuspend) || - (JSCompiler_object_inline_componentStack_2288 = + (JSCompiler_object_inline_componentStack_2301 = didSuspend) || + (JSCompiler_object_inline_componentStack_2301 = null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseStackCursor.current & ForceSuspenseFallback)); - JSCompiler_object_inline_componentStack_2288 && - ((JSCompiler_object_inline_message_2285 = !0), + JSCompiler_object_inline_componentStack_2301 && + ((JSCompiler_object_inline_message_2298 = !0), (workInProgress.flags &= -129)); - JSCompiler_object_inline_componentStack_2288 = + JSCompiler_object_inline_componentStack_2301 = 0 !== (workInProgress.flags & 32); workInProgress.flags &= -33; if (null === current) { if (isHydrating) { - JSCompiler_object_inline_message_2285 + JSCompiler_object_inline_message_2298 ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); if (isHydrating) { - var JSCompiler_object_inline_digest_2286 = nextHydratableInstance; + var JSCompiler_object_inline_digest_2299 = nextHydratableInstance; var JSCompiler_temp; - if (!(JSCompiler_temp = !JSCompiler_object_inline_digest_2286)) { + if (!(JSCompiler_temp = !JSCompiler_object_inline_digest_2299)) { c: { - var instance = JSCompiler_object_inline_digest_2286; + var instance = JSCompiler_object_inline_digest_2299; for ( JSCompiler_temp = rootOrSingletonContext; 8 !== instance.nodeType; @@ -8958,19 +8978,19 @@ JSCompiler_temp && (warnNonHydratedInstance( workInProgress, - JSCompiler_object_inline_digest_2286 + JSCompiler_object_inline_digest_2299 ), throwOnHydrationMismatch(workInProgress)); } - JSCompiler_object_inline_digest_2286 = workInProgress.memoizedState; + JSCompiler_object_inline_digest_2299 = workInProgress.memoizedState; if ( - null !== JSCompiler_object_inline_digest_2286 && - ((JSCompiler_object_inline_digest_2286 = - JSCompiler_object_inline_digest_2286.dehydrated), - null !== JSCompiler_object_inline_digest_2286) + null !== JSCompiler_object_inline_digest_2299 && + ((JSCompiler_object_inline_digest_2299 = + JSCompiler_object_inline_digest_2299.dehydrated), + null !== JSCompiler_object_inline_digest_2299) ) return ( - JSCompiler_object_inline_digest_2286.data === + JSCompiler_object_inline_digest_2299.data === SUSPENSE_FALLBACK_START_DATA ? (workInProgress.lanes = 16) : (workInProgress.lanes = 536870912), @@ -8978,68 +8998,68 @@ ); popSuspenseHandler(workInProgress); } - JSCompiler_object_inline_digest_2286 = - JSCompiler_object_inline_stack_2287.children; - JSCompiler_temp = JSCompiler_object_inline_stack_2287.fallback; - if (JSCompiler_object_inline_message_2285) + JSCompiler_object_inline_digest_2299 = + JSCompiler_object_inline_stack_2300.children; + JSCompiler_temp = JSCompiler_object_inline_stack_2300.fallback; + if (JSCompiler_object_inline_message_2298) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2287 = + (JSCompiler_object_inline_stack_2300 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_digest_2286, + JSCompiler_object_inline_digest_2299, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_message_2285 = workInProgress.child), - (JSCompiler_object_inline_message_2285.memoizedState = + (JSCompiler_object_inline_message_2298 = workInProgress.child), + (JSCompiler_object_inline_message_2298.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_message_2285.childLanes = + (JSCompiler_object_inline_message_2298.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2288, + JSCompiler_object_inline_componentStack_2301, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2287 + JSCompiler_object_inline_stack_2300 ); if ( "number" === - typeof JSCompiler_object_inline_stack_2287.unstable_expectedLoadTime + typeof JSCompiler_object_inline_stack_2300.unstable_expectedLoadTime ) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2287 = + (JSCompiler_object_inline_stack_2300 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_digest_2286, + JSCompiler_object_inline_digest_2299, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_message_2285 = workInProgress.child), - (JSCompiler_object_inline_message_2285.memoizedState = + (JSCompiler_object_inline_message_2298 = workInProgress.child), + (JSCompiler_object_inline_message_2298.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_message_2285.childLanes = + (JSCompiler_object_inline_message_2298.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2288, + JSCompiler_object_inline_componentStack_2301, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - JSCompiler_object_inline_stack_2287 + JSCompiler_object_inline_stack_2300 ); pushPrimaryTreeSuspenseHandler(workInProgress); return mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_digest_2286 + JSCompiler_object_inline_digest_2299 ); } var prevState = current.memoizedState; if ( null !== prevState && - ((JSCompiler_object_inline_digest_2286 = prevState.dehydrated), - null !== JSCompiler_object_inline_digest_2286) + ((JSCompiler_object_inline_digest_2299 = prevState.dehydrated), + null !== JSCompiler_object_inline_digest_2299) ) { if (didSuspend) workInProgress.flags & 256 @@ -9056,94 +9076,94 @@ (workInProgress.flags |= 128), (workInProgress = null)) : (reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_message_2285 = - JSCompiler_object_inline_stack_2287.fallback), - (JSCompiler_object_inline_digest_2286 = workInProgress.mode), - (JSCompiler_object_inline_stack_2287 = + (JSCompiler_object_inline_message_2298 = + JSCompiler_object_inline_stack_2300.fallback), + (JSCompiler_object_inline_digest_2299 = workInProgress.mode), + (JSCompiler_object_inline_stack_2300 = mountWorkInProgressOffscreenFiber( { mode: "visible", - children: JSCompiler_object_inline_stack_2287.children + children: JSCompiler_object_inline_stack_2300.children }, - JSCompiler_object_inline_digest_2286 + JSCompiler_object_inline_digest_2299 )), - (JSCompiler_object_inline_message_2285 = + (JSCompiler_object_inline_message_2298 = createFiberFromFragment( - JSCompiler_object_inline_message_2285, - JSCompiler_object_inline_digest_2286, + JSCompiler_object_inline_message_2298, + JSCompiler_object_inline_digest_2299, renderLanes, null )), - (JSCompiler_object_inline_message_2285.flags |= 2), - (JSCompiler_object_inline_stack_2287.return = workInProgress), - (JSCompiler_object_inline_message_2285.return = workInProgress), - (JSCompiler_object_inline_stack_2287.sibling = - JSCompiler_object_inline_message_2285), - (workInProgress.child = JSCompiler_object_inline_stack_2287), + (JSCompiler_object_inline_message_2298.flags |= 2), + (JSCompiler_object_inline_stack_2300.return = workInProgress), + (JSCompiler_object_inline_message_2298.return = workInProgress), + (JSCompiler_object_inline_stack_2300.sibling = + JSCompiler_object_inline_message_2298), + (workInProgress.child = JSCompiler_object_inline_stack_2300), reconcileChildFibers( workInProgress, current.child, null, renderLanes ), - (JSCompiler_object_inline_stack_2287 = workInProgress.child), - (JSCompiler_object_inline_stack_2287.memoizedState = + (JSCompiler_object_inline_stack_2300 = workInProgress.child), + (JSCompiler_object_inline_stack_2300.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_stack_2287.childLanes = + (JSCompiler_object_inline_stack_2300.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2288, + JSCompiler_object_inline_componentStack_2301, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress = JSCompiler_object_inline_message_2285)); + (workInProgress = JSCompiler_object_inline_message_2298)); else if ( (pushPrimaryTreeSuspenseHandler(workInProgress), isHydrating && console.error( "We should not be hydrating here. This is a bug in React. Please file a bug." ), - JSCompiler_object_inline_digest_2286.data === + JSCompiler_object_inline_digest_2299.data === SUSPENSE_FALLBACK_START_DATA) ) { - JSCompiler_object_inline_componentStack_2288 = - JSCompiler_object_inline_digest_2286.nextSibling && - JSCompiler_object_inline_digest_2286.nextSibling.dataset; - if (JSCompiler_object_inline_componentStack_2288) { - JSCompiler_temp = JSCompiler_object_inline_componentStack_2288.dgst; - var message = JSCompiler_object_inline_componentStack_2288.msg; - instance = JSCompiler_object_inline_componentStack_2288.stck; + JSCompiler_object_inline_componentStack_2301 = + JSCompiler_object_inline_digest_2299.nextSibling && + JSCompiler_object_inline_digest_2299.nextSibling.dataset; + if (JSCompiler_object_inline_componentStack_2301) { + JSCompiler_temp = JSCompiler_object_inline_componentStack_2301.dgst; + var message = JSCompiler_object_inline_componentStack_2301.msg; + instance = JSCompiler_object_inline_componentStack_2301.stck; var componentStack = - JSCompiler_object_inline_componentStack_2288.cstck; + JSCompiler_object_inline_componentStack_2301.cstck; } - JSCompiler_object_inline_message_2285 = message; - JSCompiler_object_inline_digest_2286 = JSCompiler_temp; - JSCompiler_object_inline_stack_2287 = instance; - JSCompiler_object_inline_componentStack_2288 = componentStack; - "POSTPONE" !== JSCompiler_object_inline_digest_2286 && - ((JSCompiler_object_inline_message_2285 = - JSCompiler_object_inline_message_2285 - ? Error(JSCompiler_object_inline_message_2285) + JSCompiler_object_inline_message_2298 = message; + JSCompiler_object_inline_digest_2299 = JSCompiler_temp; + JSCompiler_object_inline_stack_2300 = instance; + JSCompiler_object_inline_componentStack_2301 = componentStack; + "POSTPONE" !== JSCompiler_object_inline_digest_2299 && + ((JSCompiler_object_inline_message_2298 = + JSCompiler_object_inline_message_2298 + ? Error(JSCompiler_object_inline_message_2298) : Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." )), - (JSCompiler_object_inline_message_2285.stack = - JSCompiler_object_inline_stack_2287 || ""), - (JSCompiler_object_inline_message_2285.digest = - JSCompiler_object_inline_digest_2286), - (JSCompiler_object_inline_componentStack_2288 = - void 0 === JSCompiler_object_inline_componentStack_2288 + (JSCompiler_object_inline_message_2298.stack = + JSCompiler_object_inline_stack_2300 || ""), + (JSCompiler_object_inline_message_2298.digest = + JSCompiler_object_inline_digest_2299), + (JSCompiler_object_inline_componentStack_2301 = + void 0 === JSCompiler_object_inline_componentStack_2301 ? null - : JSCompiler_object_inline_componentStack_2288), - "string" === typeof JSCompiler_object_inline_componentStack_2288 && + : JSCompiler_object_inline_componentStack_2301), + "string" === typeof JSCompiler_object_inline_componentStack_2301 && CapturedStacks.set( - JSCompiler_object_inline_message_2285, - JSCompiler_object_inline_componentStack_2288 + JSCompiler_object_inline_message_2298, + JSCompiler_object_inline_componentStack_2301 ), queueHydrationError({ - value: JSCompiler_object_inline_message_2285, + value: JSCompiler_object_inline_message_2298, source: null, - stack: JSCompiler_object_inline_componentStack_2288 + stack: JSCompiler_object_inline_componentStack_2301 })); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9158,25 +9178,25 @@ renderLanes, !1 ), - (JSCompiler_object_inline_componentStack_2288 = + (JSCompiler_object_inline_componentStack_2301 = 0 !== (renderLanes & current.childLanes)), - didReceiveUpdate || JSCompiler_object_inline_componentStack_2288) + didReceiveUpdate || JSCompiler_object_inline_componentStack_2301) ) { - JSCompiler_object_inline_componentStack_2288 = workInProgressRoot; - if (null !== JSCompiler_object_inline_componentStack_2288) { - JSCompiler_object_inline_stack_2287 = renderLanes & -renderLanes; - if (0 !== (JSCompiler_object_inline_stack_2287 & 42)) - JSCompiler_object_inline_stack_2287 = 1; + JSCompiler_object_inline_componentStack_2301 = workInProgressRoot; + if (null !== JSCompiler_object_inline_componentStack_2301) { + JSCompiler_object_inline_stack_2300 = renderLanes & -renderLanes; + if (0 !== (JSCompiler_object_inline_stack_2300 & 42)) + JSCompiler_object_inline_stack_2300 = 1; else - switch (JSCompiler_object_inline_stack_2287) { + switch (JSCompiler_object_inline_stack_2300) { case 2: - JSCompiler_object_inline_stack_2287 = 1; + JSCompiler_object_inline_stack_2300 = 1; break; case 8: - JSCompiler_object_inline_stack_2287 = 4; + JSCompiler_object_inline_stack_2300 = 4; break; case 32: - JSCompiler_object_inline_stack_2287 = 16; + JSCompiler_object_inline_stack_2300 = 16; break; case 128: case 256: @@ -9197,40 +9217,40 @@ case 8388608: case 16777216: case 33554432: - JSCompiler_object_inline_stack_2287 = 64; + JSCompiler_object_inline_stack_2300 = 64; break; case 268435456: - JSCompiler_object_inline_stack_2287 = 134217728; + JSCompiler_object_inline_stack_2300 = 134217728; break; default: - JSCompiler_object_inline_stack_2287 = 0; + JSCompiler_object_inline_stack_2300 = 0; } - JSCompiler_object_inline_stack_2287 = + JSCompiler_object_inline_stack_2300 = 0 !== - (JSCompiler_object_inline_stack_2287 & - (JSCompiler_object_inline_componentStack_2288.suspendedLanes | + (JSCompiler_object_inline_stack_2300 & + (JSCompiler_object_inline_componentStack_2301.suspendedLanes | renderLanes)) ? 0 - : JSCompiler_object_inline_stack_2287; + : JSCompiler_object_inline_stack_2300; if ( - 0 !== JSCompiler_object_inline_stack_2287 && - JSCompiler_object_inline_stack_2287 !== prevState.retryLane + 0 !== JSCompiler_object_inline_stack_2300 && + JSCompiler_object_inline_stack_2300 !== prevState.retryLane ) throw ( - ((prevState.retryLane = JSCompiler_object_inline_stack_2287), + ((prevState.retryLane = JSCompiler_object_inline_stack_2300), enqueueConcurrentRenderForLane( current, - JSCompiler_object_inline_stack_2287 + JSCompiler_object_inline_stack_2300 ), scheduleUpdateOnFiber( - JSCompiler_object_inline_componentStack_2288, + JSCompiler_object_inline_componentStack_2301, current, - JSCompiler_object_inline_stack_2287 + JSCompiler_object_inline_stack_2300 ), SelectiveHydrationException) ); } - JSCompiler_object_inline_digest_2286.data === + JSCompiler_object_inline_digest_2299.data === SUSPENSE_PENDING_START_DATA || renderDidSuspendDelayIfPossible(); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9238,7 +9258,7 @@ renderLanes ); } else - JSCompiler_object_inline_digest_2286.data === + JSCompiler_object_inline_digest_2299.data === SUSPENSE_PENDING_START_DATA ? ((workInProgress.flags |= 128), (workInProgress.child = current.child), @@ -9246,12 +9266,12 @@ null, current )), - (JSCompiler_object_inline_digest_2286._reactRetry = + (JSCompiler_object_inline_digest_2299._reactRetry = workInProgress), (workInProgress = null)) : ((current = prevState.treeContext), (nextHydratableInstance = getNextHydratable( - JSCompiler_object_inline_digest_2286.nextSibling + JSCompiler_object_inline_digest_2299.nextSibling )), (hydrationParentFiber = workInProgress), (isHydrating = !0), @@ -9269,54 +9289,54 @@ (treeContextProvider = workInProgress)), (workInProgress = mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_stack_2287.children + JSCompiler_object_inline_stack_2300.children )), (workInProgress.flags |= 4096)); return workInProgress; } - if (JSCompiler_object_inline_message_2285) + if (JSCompiler_object_inline_message_2298) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_message_2285 = - JSCompiler_object_inline_stack_2287.fallback), - (JSCompiler_object_inline_digest_2286 = workInProgress.mode), + (JSCompiler_object_inline_message_2298 = + JSCompiler_object_inline_stack_2300.fallback), + (JSCompiler_object_inline_digest_2299 = workInProgress.mode), (JSCompiler_temp = current.child), (instance = JSCompiler_temp.sibling), - (JSCompiler_object_inline_stack_2287 = createWorkInProgress( + (JSCompiler_object_inline_stack_2300 = createWorkInProgress( JSCompiler_temp, { mode: "hidden", - children: JSCompiler_object_inline_stack_2287.children + children: JSCompiler_object_inline_stack_2300.children } )), - (JSCompiler_object_inline_stack_2287.subtreeFlags = + (JSCompiler_object_inline_stack_2300.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280), null !== instance - ? (JSCompiler_object_inline_message_2285 = createWorkInProgress( + ? (JSCompiler_object_inline_message_2298 = createWorkInProgress( instance, - JSCompiler_object_inline_message_2285 + JSCompiler_object_inline_message_2298 )) - : ((JSCompiler_object_inline_message_2285 = createFiberFromFragment( - JSCompiler_object_inline_message_2285, - JSCompiler_object_inline_digest_2286, + : ((JSCompiler_object_inline_message_2298 = createFiberFromFragment( + JSCompiler_object_inline_message_2298, + JSCompiler_object_inline_digest_2299, renderLanes, null )), - (JSCompiler_object_inline_message_2285.flags |= 2)), - (JSCompiler_object_inline_message_2285.return = workInProgress), - (JSCompiler_object_inline_stack_2287.return = workInProgress), - (JSCompiler_object_inline_stack_2287.sibling = - JSCompiler_object_inline_message_2285), - (workInProgress.child = JSCompiler_object_inline_stack_2287), - (JSCompiler_object_inline_stack_2287 = - JSCompiler_object_inline_message_2285), - (JSCompiler_object_inline_message_2285 = workInProgress.child), - (JSCompiler_object_inline_digest_2286 = current.child.memoizedState), - null === JSCompiler_object_inline_digest_2286 - ? (JSCompiler_object_inline_digest_2286 = + (JSCompiler_object_inline_message_2298.flags |= 2)), + (JSCompiler_object_inline_message_2298.return = workInProgress), + (JSCompiler_object_inline_stack_2300.return = workInProgress), + (JSCompiler_object_inline_stack_2300.sibling = + JSCompiler_object_inline_message_2298), + (workInProgress.child = JSCompiler_object_inline_stack_2300), + (JSCompiler_object_inline_stack_2300 = + JSCompiler_object_inline_message_2298), + (JSCompiler_object_inline_message_2298 = workInProgress.child), + (JSCompiler_object_inline_digest_2299 = current.child.memoizedState), + null === JSCompiler_object_inline_digest_2299 + ? (JSCompiler_object_inline_digest_2299 = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = - JSCompiler_object_inline_digest_2286.cachePool), + JSCompiler_object_inline_digest_2299.cachePool), null !== JSCompiler_temp ? ((instance = CacheContext._currentValue), (JSCompiler_temp = @@ -9324,38 +9344,38 @@ ? { parent: instance, pool: instance } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), - (JSCompiler_object_inline_digest_2286 = { + (JSCompiler_object_inline_digest_2299 = { baseLanes: - JSCompiler_object_inline_digest_2286.baseLanes | renderLanes, + JSCompiler_object_inline_digest_2299.baseLanes | renderLanes, cachePool: JSCompiler_temp })), - (JSCompiler_object_inline_message_2285.memoizedState = - JSCompiler_object_inline_digest_2286), - (JSCompiler_object_inline_message_2285.childLanes = + (JSCompiler_object_inline_message_2298.memoizedState = + JSCompiler_object_inline_digest_2299), + (JSCompiler_object_inline_message_2298.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2288, + JSCompiler_object_inline_componentStack_2301, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2287 + JSCompiler_object_inline_stack_2300 ); pushPrimaryTreeSuspenseHandler(workInProgress); renderLanes = current.child; current = renderLanes.sibling; renderLanes = createWorkInProgress(renderLanes, { mode: "visible", - children: JSCompiler_object_inline_stack_2287.children + children: JSCompiler_object_inline_stack_2300.children }); renderLanes.return = workInProgress; renderLanes.sibling = null; null !== current && - ((JSCompiler_object_inline_componentStack_2288 = + ((JSCompiler_object_inline_componentStack_2301 = workInProgress.deletions), - null === JSCompiler_object_inline_componentStack_2288 + null === JSCompiler_object_inline_componentStack_2301 ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) - : JSCompiler_object_inline_componentStack_2288.push(current)); + : JSCompiler_object_inline_componentStack_2301.push(current)); workInProgress.child = renderLanes; workInProgress.memoizedState = null; return renderLanes; @@ -14579,7 +14599,7 @@ workInProgressDeferredLane, workInProgressRootDidSkipSuspendedSiblings ); - markRootUpdated(root, lane); + markRootUpdated$1(root, lane); if ( 0 !== (executionContext & RenderContext) && root === workInProgressRoot @@ -14914,18 +14934,6 @@ } return !0; } - function markRootUpdated(root, updatedLanes) { - root.pendingLanes |= updatedLanes; - 268435456 !== updatedLanes && - ((root.suspendedLanes = 0), - (root.pingedLanes = 0), - (root.warmLanes = 0)); - executionContext & RenderContext - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & CommitContext && - (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); - } function markRootSuspended( root, suspendedLanes, @@ -15619,13 +15627,14 @@ ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); if ((executionContext & (RenderContext | CommitContext)) !== NoContext) throw Error("Should not already be working."); - var finishedWork = root.finishedWork, - lanes = root.finishedLanes; - reusableComponentDevToolDetails.track = - getGroupNameOfHighestPriorityLane(lanes); + var finishedWork = root.finishedWork; + didIncludeRenderPhaseUpdate = root.finishedLanes; + reusableComponentDevToolDetails.track = getGroupNameOfHighestPriorityLane( + didIncludeRenderPhaseUpdate + ); logRenderPhase(completedRenderStartTime, completedRenderEndTime); if (null === finishedWork) return null; - 0 === lanes && + 0 === didIncludeRenderPhaseUpdate && console.error( "root.finishedLanes should not be empty during a commit. This is a bug in React." ); @@ -15642,13 +15651,12 @@ completedRenderStartTime |= concurrentlyUpdatedLanes; markRootFinished( root, - lanes, + didIncludeRenderPhaseUpdate, completedRenderStartTime, spawnedLane, updatedLanes, suspendedRetryLanes ); - didIncludeCommitPhaseUpdate = !1; root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -15678,12 +15686,16 @@ (updatedLanes = executionContext), (executionContext |= CommitContext), commitBeforeMutationEffects(root, finishedWork), - commitMutationEffects(root, finishedWork, lanes), + commitMutationEffects( + root, + finishedWork, + didIncludeRenderPhaseUpdate + ), restoreSelection(selectionInformation, root.containerInfo), (_enabled = !!eventsEnabled), (selectionInformation = eventsEnabled = null), (root.current = finishedWork), - commitLayoutEffects(finishedWork, root, lanes), + commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate), requestPaint(), (executionContext = updatedLanes), (ReactDOMSharedInternals.p = spawnedLane), @@ -15694,7 +15706,7 @@ (transitions = rootDoesHavePassiveEffects) ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = lanes)) + (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) : (releaseRootPooledCache(root, completedRenderStartTime), (nestedPassiveUpdateCount = 0), (rootWithPassiveNestedUpdates = null)); @@ -15722,15 +15734,14 @@ ); 0 !== (pendingPassiveEffectsLanes & 3) && flushPassiveEffects(); completedRenderStartTime = root.pendingLanes; - didIncludeRenderPhaseUpdate || - didIncludeCommitPhaseUpdate || - (0 !== (lanes & 4194218) && 0 !== (completedRenderStartTime & 42)) + 0 !== (didIncludeRenderPhaseUpdate & 4194218) && + 0 !== (completedRenderStartTime & 42) ? ((nestedUpdateScheduled = !0), root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))) : (nestedUpdateCount = 0); - transitions || finalizeRender(lanes, now$1()); + transitions || finalizeRender(didIncludeRenderPhaseUpdate, now$1()); flushSyncWorkAcrossRoots_impl(0, !1); return null; } @@ -15869,7 +15880,7 @@ sourceFiber = createRootErrorUpdate(rootFiber.stateNode, sourceFiber, 2); rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); null !== rootFiber && - (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); + (markRootUpdated$1(rootFiber, 2), ensureRootIsScheduled(rootFiber)); } function captureCommitPhaseError( sourceFiber, @@ -15908,7 +15919,7 @@ nearestMountedAncestor, sourceFiber ), - markRootUpdated(instance, 2), + markRootUpdated$1(instance, 2), ensureRootIsScheduled(instance)); return; } @@ -15943,11 +15954,6 @@ null !== pingCache && pingCache.delete(wakeable); root.pingedLanes |= root.suspendedLanes & pingedLanes; root.warmLanes &= ~pingedLanes; - executionContext & RenderContext - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & CommitContext && - (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); isConcurrentActEnvironment() && null === ReactSharedInternals.actQueue && console.error( @@ -15971,7 +15977,7 @@ 0 === retryLane && (retryLane = claimNextRetryLane()); boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); null !== boundaryFiber && - (markRootUpdated(boundaryFiber, retryLane), + (markRootUpdated$1(boundaryFiber, retryLane), ensureRootIsScheduled(boundaryFiber)); } function retryDehydratedSuspenseBoundary(boundaryFiber) { @@ -16002,26 +16008,6 @@ null !== retryCache && retryCache.delete(wakeable); retryTimedOutBoundary(boundaryFiber, retryLane); } - function throwIfInfiniteUpdateLoopDetected() { - if (nestedUpdateCount > NESTED_UPDATE_LIMIT) - throw ( - ((nestedPassiveUpdateCount = nestedUpdateCount = 0), - (rootWithPassiveNestedUpdates = rootWithNestedUpdates = null), - executionContext & RenderContext && - null !== workInProgressRoot && - (workInProgressRoot.errorRecoveryDisabledLanes |= - workInProgressRootRenderLanes), - Error( - "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." - )) - ); - nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT && - ((nestedPassiveUpdateCount = 0), - (rootWithPassiveNestedUpdates = null), - console.error( - "Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render." - )); - } function recursivelyTraverseAndDoubleInvokeEffectsInDEV( root$jscomp$0, parentFiber, @@ -24421,7 +24407,6 @@ workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, workInProgressRootDidIncludeRecursiveRenderUpdate = !1, - didIncludeCommitPhaseUpdate = !1, globalMostRecentFallbackTime = 0, FALLBACK_THROTTLE_MS = 300, workInProgressRootRenderTargetTime = Infinity, @@ -24434,12 +24419,12 @@ pendingPassiveEffectsRemainingLanes = 0, pendingPassiveEffectsRenderEndTime = -0, pendingPassiveTransitions = null, - NESTED_UPDATE_LIMIT = 100, + NESTED_UPDATE_LIMIT = 50, nestedUpdateCount = 0, rootWithNestedUpdates = null, isFlushingPassiveEffects = !1, didScheduleUpdateDuringPassiveEffects = !1, - NESTED_PASSIVE_UPDATE_LIMIT = 100, + NESTED_PASSIVE_UPDATE_LIMIT = 50, nestedPassiveUpdateCount = 0, rootWithPassiveNestedUpdates = null, isRunningInsertionEffect = !1, @@ -24990,11 +24975,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-2d16326d-20240930" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-1460d67c-20241003" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -25031,11 +25016,11 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-experimental-2d16326d-20240930", + version: "19.0.0-experimental-1460d67c-20241003", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-2d16326d-20240930" + reconcilerVersion: "19.0.0-experimental-1460d67c-20241003" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25228,7 +25213,7 @@ identifierPrefix.callback = null; enqueueUpdate(options, identifierPrefix, isStrictMode); initialChildren.current.lanes = isStrictMode; - markRootUpdated(initialChildren, isStrictMode); + markRootUpdated$1(initialChildren, isStrictMode); ensureRootIsScheduled(initialChildren); container[internalContainerInstanceKey] = initialChildren.current; listenToAllSupportedEvents(container); @@ -25507,7 +25492,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-experimental-2d16326d-20240930"; + exports.version = "19.0.0-experimental-1460d67c-20241003"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.profiling.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.profiling.js index 9e8edb55a908b..ad2b33bedc7a7 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.profiling.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-profiling.profiling.js @@ -769,6 +769,11 @@ function createLaneMap(initial) { for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; } +function markRootUpdated$1(root, updateLane) { + root.pendingLanes |= updateLane; + 268435456 !== updateLane && + ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); +} function markRootFinished( root, finishedLanes, @@ -2575,7 +2580,12 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { - throwIfInfiniteUpdateLoopDetected(); + if (50 < nestedUpdateCount) + throw ( + ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))) + ); for (var parent = sourceFiber.return; null !== parent; ) (sourceFiber = parent), (parent = sourceFiber.return); return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; @@ -11017,7 +11027,6 @@ var DefaultAsyncDispatcher = { workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, workInProgressRootDidIncludeRecursiveRenderUpdate = !1, - didIncludeCommitPhaseUpdate = !1, globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, workInProgressTransitions = null, @@ -11061,7 +11070,7 @@ function scheduleUpdateOnFiber(root, fiber, lane) { workInProgressDeferredLane, workInProgressRootDidSkipSuspendedSiblings ); - markRootUpdated(root, lane); + markRootUpdated$1(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) isDevToolsPresent && addFiberToLanesMap(root, fiber, lane), root === workInProgressRoot && @@ -11342,15 +11351,6 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootUpdated(root, updatedLanes) { - root.pendingLanes |= updatedLanes; - 268435456 !== updatedLanes && - ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); - executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); -} function markRootSuspended( root, suspendedLanes, @@ -11961,10 +11961,11 @@ function commitRootImpl( do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); - var finishedWork = root.finishedWork, - lanes = root.finishedLanes; - reusableComponentDevToolDetails.track = - getGroupNameOfHighestPriorityLane(lanes); + var finishedWork = root.finishedWork; + didIncludeRenderPhaseUpdate = root.finishedLanes; + reusableComponentDevToolDetails.track = getGroupNameOfHighestPriorityLane( + didIncludeRenderPhaseUpdate + ); logRenderPhase(completedRenderStartTime, completedRenderEndTime); if (null === finishedWork) return null; root.finishedWork = null; @@ -11977,13 +11978,12 @@ function commitRootImpl( completedRenderStartTime |= concurrentlyUpdatedLanes; markRootFinished( root, - lanes, + didIncludeRenderPhaseUpdate, completedRenderStartTime, spawnedLane, updatedLanes, suspendedRetryLanes ); - didIncludeCommitPhaseUpdate = !1; root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -12013,12 +12013,12 @@ function commitRootImpl( (updatedLanes = executionContext), (executionContext |= 4), commitBeforeMutationEffects(root, finishedWork), - commitMutationEffects(root, finishedWork, lanes), + commitMutationEffects(root, finishedWork, didIncludeRenderPhaseUpdate), restoreSelection(selectionInformation, root.containerInfo), (_enabled = !!eventsEnabled), (selectionInformation = eventsEnabled = null), (root.current = finishedWork), - commitLayoutEffects(finishedWork, root, lanes), + commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate), requestPaint(), (executionContext = updatedLanes), (ReactDOMSharedInternals.p = spawnedLane), @@ -12029,7 +12029,7 @@ function commitRootImpl( (transitions = rootDoesHavePassiveEffects) ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = lanes)) + (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) : releaseRootPooledCache(root, completedRenderStartTime); completedRenderStartTime = root.pendingLanes; 0 === completedRenderStartTime && @@ -12049,15 +12049,14 @@ function commitRootImpl( }); 0 !== (pendingPassiveEffectsLanes & 3) && flushPassiveEffects(); completedRenderStartTime = root.pendingLanes; - didIncludeRenderPhaseUpdate || - didIncludeCommitPhaseUpdate || - (0 !== (lanes & 4194218) && 0 !== (completedRenderStartTime & 42)) + 0 !== (didIncludeRenderPhaseUpdate & 4194218) && + 0 !== (completedRenderStartTime & 42) ? ((nestedUpdateScheduled = !0), root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))) : (nestedUpdateCount = 0); - transitions || finalizeRender(lanes, now$1()); + transitions || finalizeRender(didIncludeRenderPhaseUpdate, now$1()); flushSyncWorkAcrossRoots_impl(0, !1); return null; } @@ -12155,7 +12154,7 @@ function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { sourceFiber = createRootErrorUpdate(rootFiber.stateNode, sourceFiber, 2); rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); null !== rootFiber && - (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); + (markRootUpdated$1(rootFiber, 2), ensureRootIsScheduled(rootFiber)); } function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { if (3 === sourceFiber.tag) @@ -12188,7 +12187,7 @@ function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { nearestMountedAncestor, sourceFiber ), - markRootUpdated(instance, 2), + markRootUpdated$1(instance, 2), ensureRootIsScheduled(instance)); break; } @@ -12218,10 +12217,6 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { null !== pingCache && pingCache.delete(wakeable); root.pingedLanes |= root.suspendedLanes & pingedLanes; root.warmLanes &= ~pingedLanes; - executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); workInProgressRoot === root && (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || @@ -12239,7 +12234,7 @@ function retryTimedOutBoundary(boundaryFiber, retryLane) { 0 === retryLane && (retryLane = claimNextRetryLane()); boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); null !== boundaryFiber && - (markRootUpdated(boundaryFiber, retryLane), + (markRootUpdated$1(boundaryFiber, retryLane), ensureRootIsScheduled(boundaryFiber)); } function retryDehydratedSuspenseBoundary(boundaryFiber) { @@ -12268,18 +12263,6 @@ function resolveRetryWakeable(boundaryFiber, wakeable) { null !== retryCache && retryCache.delete(wakeable); retryTimedOutBoundary(boundaryFiber, retryLane); } -function throwIfInfiniteUpdateLoopDetected() { - if (100 < nestedUpdateCount) - throw ( - ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - executionContext & 2 && - null !== workInProgressRoot && - (workInProgressRoot.errorRecoveryDisabledLanes |= - workInProgressRootRenderLanes), - Error(formatProdErrorMessage(185))) - ); -} function restorePendingUpdaters(root, lanes) { isDevToolsPresent && root.memoizedUpdaters.forEach(function (schedulingFiber) { @@ -12575,20 +12558,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1485 = 0; - i$jscomp$inline_1485 < simpleEventPluginEvents.length; - i$jscomp$inline_1485++ + var i$jscomp$inline_1498 = 0; + i$jscomp$inline_1498 < simpleEventPluginEvents.length; + i$jscomp$inline_1498++ ) { - var eventName$jscomp$inline_1486 = - simpleEventPluginEvents[i$jscomp$inline_1485], - domEventName$jscomp$inline_1487 = - eventName$jscomp$inline_1486.toLowerCase(), - capitalizedEvent$jscomp$inline_1488 = - eventName$jscomp$inline_1486[0].toUpperCase() + - eventName$jscomp$inline_1486.slice(1); + var eventName$jscomp$inline_1499 = + simpleEventPluginEvents[i$jscomp$inline_1498], + domEventName$jscomp$inline_1500 = + eventName$jscomp$inline_1499.toLowerCase(), + capitalizedEvent$jscomp$inline_1501 = + eventName$jscomp$inline_1499[0].toUpperCase() + + eventName$jscomp$inline_1499.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1487, - "on" + capitalizedEvent$jscomp$inline_1488 + domEventName$jscomp$inline_1500, + "on" + capitalizedEvent$jscomp$inline_1501 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -16054,16 +16037,16 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { 0 === i && attemptExplicitHydrationTarget(target); } }; -var isomorphicReactPackageVersion$jscomp$inline_1732 = React.version; +var isomorphicReactPackageVersion$jscomp$inline_1745 = React.version; if ( - "19.0.0-experimental-2d16326d-20240930" !== - isomorphicReactPackageVersion$jscomp$inline_1732 + "19.0.0-experimental-1460d67c-20241003" !== + isomorphicReactPackageVersion$jscomp$inline_1745 ) throw Error( formatProdErrorMessage( 527, - isomorphicReactPackageVersion$jscomp$inline_1732, - "19.0.0-experimental-2d16326d-20240930" + isomorphicReactPackageVersion$jscomp$inline_1745, + "19.0.0-experimental-1460d67c-20241003" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -16083,25 +16066,25 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { null === componentOrElement ? null : componentOrElement.stateNode; return componentOrElement; }; -var internals$jscomp$inline_2170 = { +var internals$jscomp$inline_2183 = { bundleType: 0, - version: "19.0.0-experimental-2d16326d-20240930", + version: "19.0.0-experimental-1460d67c-20241003", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-2d16326d-20240930" + reconcilerVersion: "19.0.0-experimental-1460d67c-20241003" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2171 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2184 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2171.isDisabled && - hook$jscomp$inline_2171.supportsFiber + !hook$jscomp$inline_2184.isDisabled && + hook$jscomp$inline_2184.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2171.inject( - internals$jscomp$inline_2170 + (rendererID = hook$jscomp$inline_2184.inject( + internals$jscomp$inline_2183 )), - (injectedHook = hook$jscomp$inline_2171); + (injectedHook = hook$jscomp$inline_2184); } catch (err) {} } function noop() {} @@ -16228,7 +16211,7 @@ exports.hydrateRoot = function (container, initialChildren, options) { identifierPrefix.callback = null; enqueueUpdate(options, identifierPrefix, isStrictMode); initialChildren.current.lanes = isStrictMode; - markRootUpdated(initialChildren, isStrictMode); + markRootUpdated$1(initialChildren, isStrictMode); ensureRootIsScheduled(initialChildren); container[internalContainerInstanceKey] = initialChildren.current; listenToAllSupportedEvents(container); @@ -16354,7 +16337,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-experimental-2d16326d-20240930"; +exports.version = "19.0.0-experimental-1460d67c-20241003"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js index 160085ea6b5cb..c2a1075ec368a 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.development.js @@ -9291,5 +9291,5 @@ 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; - exports.version = "19.0.0-experimental-2d16326d-20240930"; + exports.version = "19.0.0-experimental-1460d67c-20241003"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.js index 7be2214bc5e2d..8e05976a1b904 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.browser.production.js @@ -6058,4 +6058,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "19.0.0-experimental-2d16326d-20240930"; +exports.version = "19.0.0-experimental-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.development.js index fc2f1b435a219..ffbff5e6aa6ad 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.development.js @@ -9291,5 +9291,5 @@ 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToPipeableStream" which supports Suspense on the server' ); }; - exports.version = "19.0.0-experimental-2d16326d-20240930"; + exports.version = "19.0.0-experimental-1460d67c-20241003"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.production.js index f38e18c012a65..c934dbe8eb9bc 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server-legacy.node.production.js @@ -6150,4 +6150,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToPipeableStream" which supports Suspense on the server' ); }; -exports.version = "19.0.0-experimental-2d16326d-20240930"; +exports.version = "19.0.0-experimental-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.development.js index dbd60c9759270..972c95de81472 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.development.js @@ -8189,11 +8189,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-2d16326d-20240930" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-1460d67c-20241003" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react-experimental"), @@ -9973,5 +9973,5 @@ startWork(request); }); }; - exports.version = "19.0.0-experimental-2d16326d-20240930"; + exports.version = "19.0.0-experimental-1460d67c-20241003"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.production.js index ab8ca32d547ed..0417087f26ed6 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.browser.production.js @@ -6587,12 +6587,12 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-2d16326d-20240930" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-1460d67c-20241003" !== isomorphicReactPackageVersion) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion, - "19.0.0-experimental-2d16326d-20240930" + "19.0.0-experimental-1460d67c-20241003" ) ); } @@ -6847,4 +6847,4 @@ exports.resumeAndPrerender = function (children, postponedState, options) { startWork(request); }); }; -exports.version = "19.0.0-experimental-2d16326d-20240930"; +exports.version = "19.0.0-experimental-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.bun.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.bun.production.js index a41ccc466b676..d503029efdde5 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.bun.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.bun.production.js @@ -6069,13 +6069,13 @@ function addToReplayParent(node, parentKeyPath, trackedPostpones) { } var isomorphicReactPackageVersion$jscomp$inline_779 = React.version; if ( - "19.0.0-experimental-2d16326d-20240930" !== + "19.0.0-experimental-1460d67c-20241003" !== isomorphicReactPackageVersion$jscomp$inline_779 ) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion$jscomp$inline_779 + - "\n - react-dom: 19.0.0-experimental-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); exports.renderToReadableStream = function (children, options) { return new Promise(function (resolve, reject) { @@ -6166,4 +6166,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.0.0-experimental-2d16326d-20240930"; +exports.version = "19.0.0-experimental-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.development.js index cb99a49dce055..9d2e322f9ad7b 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.development.js @@ -8206,11 +8206,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-2d16326d-20240930" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-1460d67c-20241003" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); } var React = require("next/dist/compiled/react-experimental"), @@ -9997,5 +9997,5 @@ const setTimeoutOrImmediate = ? globalThis['set' + 'Immediate'] : setTimeout; - exports.version = "19.0.0-experimental-2d16326d-20240930"; + exports.version = "19.0.0-experimental-1460d67c-20241003"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.production.js index 95a1295cf8f01..2136b9b833d27 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.edge.production.js @@ -6689,11 +6689,11 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-2d16326d-20240930" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-1460d67c-20241003" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -6958,4 +6958,4 @@ const setTimeoutOrImmediate = ? globalThis['set' + 'Immediate'] : setTimeout; -exports.version = "19.0.0-experimental-2d16326d-20240930"; +exports.version = "19.0.0-experimental-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.development.js index b5f342f00be3b..3342e1c8ab829 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.development.js @@ -8070,11 +8070,11 @@ } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-2d16326d-20240930" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-1460d67c-20241003" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); } function createDrainHandler(destination, request) { @@ -9847,5 +9847,5 @@ } }; }; - exports.version = "19.0.0-experimental-2d16326d-20240930"; + exports.version = "19.0.0-experimental-1460d67c-20241003"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.production.js index 35e364eedde84..d7ffd5f7f8df3 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-server.node.production.js @@ -6568,11 +6568,11 @@ function getPostponedState(request) { } function ensureCorrectIsomorphicReactVersion() { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-2d16326d-20240930" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-1460d67c-20241003" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); } ensureCorrectIsomorphicReactVersion(); @@ -6823,4 +6823,4 @@ exports.resumeToPipeableStream = function (children, postponedState, options) { } }; }; -exports.version = "19.0.0-experimental-2d16326d-20240930"; +exports.version = "19.0.0-experimental-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.development.js index 2252aaa0b79b4..30cc27a133a65 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.development.js @@ -1130,6 +1130,13 @@ for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; } + function markRootUpdated$1(root, updateLane) { + root.pendingLanes |= updateLane; + 268435456 !== updateLane && + ((root.suspendedLanes = 0), + (root.pingedLanes = 0), + (root.warmLanes = 0)); + } function markRootFinished( root, finishedLanes, @@ -3917,7 +3924,20 @@ (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { - throwIfInfiniteUpdateLoopDetected(); + if (nestedUpdateCount > NESTED_UPDATE_LIMIT) + throw ( + ((nestedPassiveUpdateCount = nestedUpdateCount = 0), + (rootWithPassiveNestedUpdates = rootWithNestedUpdates = null), + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + )) + ); + nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT && + ((nestedPassiveUpdateCount = 0), + (rootWithPassiveNestedUpdates = null), + console.error( + "Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render." + )); null === sourceFiber.alternate && 0 !== (sourceFiber.flags & 4098) && warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); @@ -8924,33 +8944,33 @@ return current; } function updateSuspenseComponent(current, workInProgress, renderLanes) { - var JSCompiler_object_inline_componentStack_2317; - var JSCompiler_object_inline_stack_2316 = workInProgress.pendingProps; + var JSCompiler_object_inline_componentStack_2330; + var JSCompiler_object_inline_stack_2329 = workInProgress.pendingProps; shouldSuspendImpl(workInProgress) && (workInProgress.flags |= 128); - var JSCompiler_object_inline_message_2314 = !1; + var JSCompiler_object_inline_message_2327 = !1; var didSuspend = 0 !== (workInProgress.flags & 128); - (JSCompiler_object_inline_componentStack_2317 = didSuspend) || - (JSCompiler_object_inline_componentStack_2317 = + (JSCompiler_object_inline_componentStack_2330 = didSuspend) || + (JSCompiler_object_inline_componentStack_2330 = null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseStackCursor.current & ForceSuspenseFallback)); - JSCompiler_object_inline_componentStack_2317 && - ((JSCompiler_object_inline_message_2314 = !0), + JSCompiler_object_inline_componentStack_2330 && + ((JSCompiler_object_inline_message_2327 = !0), (workInProgress.flags &= -129)); - JSCompiler_object_inline_componentStack_2317 = + JSCompiler_object_inline_componentStack_2330 = 0 !== (workInProgress.flags & 32); workInProgress.flags &= -33; if (null === current) { if (isHydrating) { - JSCompiler_object_inline_message_2314 + JSCompiler_object_inline_message_2327 ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); if (isHydrating) { - var JSCompiler_object_inline_digest_2315 = nextHydratableInstance; + var JSCompiler_object_inline_digest_2328 = nextHydratableInstance; var JSCompiler_temp; - if (!(JSCompiler_temp = !JSCompiler_object_inline_digest_2315)) { + if (!(JSCompiler_temp = !JSCompiler_object_inline_digest_2328)) { c: { - var instance = JSCompiler_object_inline_digest_2315; + var instance = JSCompiler_object_inline_digest_2328; for ( JSCompiler_temp = rootOrSingletonContext; 8 !== instance.nodeType; @@ -8991,19 +9011,19 @@ JSCompiler_temp && (warnNonHydratedInstance( workInProgress, - JSCompiler_object_inline_digest_2315 + JSCompiler_object_inline_digest_2328 ), throwOnHydrationMismatch(workInProgress)); } - JSCompiler_object_inline_digest_2315 = workInProgress.memoizedState; + JSCompiler_object_inline_digest_2328 = workInProgress.memoizedState; if ( - null !== JSCompiler_object_inline_digest_2315 && - ((JSCompiler_object_inline_digest_2315 = - JSCompiler_object_inline_digest_2315.dehydrated), - null !== JSCompiler_object_inline_digest_2315) + null !== JSCompiler_object_inline_digest_2328 && + ((JSCompiler_object_inline_digest_2328 = + JSCompiler_object_inline_digest_2328.dehydrated), + null !== JSCompiler_object_inline_digest_2328) ) return ( - JSCompiler_object_inline_digest_2315.data === + JSCompiler_object_inline_digest_2328.data === SUSPENSE_FALLBACK_START_DATA ? (workInProgress.lanes = 16) : (workInProgress.lanes = 536870912), @@ -9011,68 +9031,68 @@ ); popSuspenseHandler(workInProgress); } - JSCompiler_object_inline_digest_2315 = - JSCompiler_object_inline_stack_2316.children; - JSCompiler_temp = JSCompiler_object_inline_stack_2316.fallback; - if (JSCompiler_object_inline_message_2314) + JSCompiler_object_inline_digest_2328 = + JSCompiler_object_inline_stack_2329.children; + JSCompiler_temp = JSCompiler_object_inline_stack_2329.fallback; + if (JSCompiler_object_inline_message_2327) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2316 = + (JSCompiler_object_inline_stack_2329 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_digest_2315, + JSCompiler_object_inline_digest_2328, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_message_2314 = workInProgress.child), - (JSCompiler_object_inline_message_2314.memoizedState = + (JSCompiler_object_inline_message_2327 = workInProgress.child), + (JSCompiler_object_inline_message_2327.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_message_2314.childLanes = + (JSCompiler_object_inline_message_2327.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2317, + JSCompiler_object_inline_componentStack_2330, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2316 + JSCompiler_object_inline_stack_2329 ); if ( "number" === - typeof JSCompiler_object_inline_stack_2316.unstable_expectedLoadTime + typeof JSCompiler_object_inline_stack_2329.unstable_expectedLoadTime ) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_stack_2316 = + (JSCompiler_object_inline_stack_2329 = mountSuspenseFallbackChildren( workInProgress, - JSCompiler_object_inline_digest_2315, + JSCompiler_object_inline_digest_2328, JSCompiler_temp, renderLanes )), - (JSCompiler_object_inline_message_2314 = workInProgress.child), - (JSCompiler_object_inline_message_2314.memoizedState = + (JSCompiler_object_inline_message_2327 = workInProgress.child), + (JSCompiler_object_inline_message_2327.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_message_2314.childLanes = + (JSCompiler_object_inline_message_2327.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2317, + JSCompiler_object_inline_componentStack_2330, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress.lanes = 4194304), - JSCompiler_object_inline_stack_2316 + JSCompiler_object_inline_stack_2329 ); pushPrimaryTreeSuspenseHandler(workInProgress); return mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_digest_2315 + JSCompiler_object_inline_digest_2328 ); } var prevState = current.memoizedState; if ( null !== prevState && - ((JSCompiler_object_inline_digest_2315 = prevState.dehydrated), - null !== JSCompiler_object_inline_digest_2315) + ((JSCompiler_object_inline_digest_2328 = prevState.dehydrated), + null !== JSCompiler_object_inline_digest_2328) ) { if (didSuspend) workInProgress.flags & 256 @@ -9089,94 +9109,94 @@ (workInProgress.flags |= 128), (workInProgress = null)) : (reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_message_2314 = - JSCompiler_object_inline_stack_2316.fallback), - (JSCompiler_object_inline_digest_2315 = workInProgress.mode), - (JSCompiler_object_inline_stack_2316 = + (JSCompiler_object_inline_message_2327 = + JSCompiler_object_inline_stack_2329.fallback), + (JSCompiler_object_inline_digest_2328 = workInProgress.mode), + (JSCompiler_object_inline_stack_2329 = mountWorkInProgressOffscreenFiber( { mode: "visible", - children: JSCompiler_object_inline_stack_2316.children + children: JSCompiler_object_inline_stack_2329.children }, - JSCompiler_object_inline_digest_2315 + JSCompiler_object_inline_digest_2328 )), - (JSCompiler_object_inline_message_2314 = + (JSCompiler_object_inline_message_2327 = createFiberFromFragment( - JSCompiler_object_inline_message_2314, - JSCompiler_object_inline_digest_2315, + JSCompiler_object_inline_message_2327, + JSCompiler_object_inline_digest_2328, renderLanes, null )), - (JSCompiler_object_inline_message_2314.flags |= 2), - (JSCompiler_object_inline_stack_2316.return = workInProgress), - (JSCompiler_object_inline_message_2314.return = workInProgress), - (JSCompiler_object_inline_stack_2316.sibling = - JSCompiler_object_inline_message_2314), - (workInProgress.child = JSCompiler_object_inline_stack_2316), + (JSCompiler_object_inline_message_2327.flags |= 2), + (JSCompiler_object_inline_stack_2329.return = workInProgress), + (JSCompiler_object_inline_message_2327.return = workInProgress), + (JSCompiler_object_inline_stack_2329.sibling = + JSCompiler_object_inline_message_2327), + (workInProgress.child = JSCompiler_object_inline_stack_2329), reconcileChildFibers( workInProgress, current.child, null, renderLanes ), - (JSCompiler_object_inline_stack_2316 = workInProgress.child), - (JSCompiler_object_inline_stack_2316.memoizedState = + (JSCompiler_object_inline_stack_2329 = workInProgress.child), + (JSCompiler_object_inline_stack_2329.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_stack_2316.childLanes = + (JSCompiler_object_inline_stack_2329.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2317, + JSCompiler_object_inline_componentStack_2330, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - (workInProgress = JSCompiler_object_inline_message_2314)); + (workInProgress = JSCompiler_object_inline_message_2327)); else if ( (pushPrimaryTreeSuspenseHandler(workInProgress), isHydrating && console.error( "We should not be hydrating here. This is a bug in React. Please file a bug." ), - JSCompiler_object_inline_digest_2315.data === + JSCompiler_object_inline_digest_2328.data === SUSPENSE_FALLBACK_START_DATA) ) { - JSCompiler_object_inline_componentStack_2317 = - JSCompiler_object_inline_digest_2315.nextSibling && - JSCompiler_object_inline_digest_2315.nextSibling.dataset; - if (JSCompiler_object_inline_componentStack_2317) { - JSCompiler_temp = JSCompiler_object_inline_componentStack_2317.dgst; - var message = JSCompiler_object_inline_componentStack_2317.msg; - instance = JSCompiler_object_inline_componentStack_2317.stck; + JSCompiler_object_inline_componentStack_2330 = + JSCompiler_object_inline_digest_2328.nextSibling && + JSCompiler_object_inline_digest_2328.nextSibling.dataset; + if (JSCompiler_object_inline_componentStack_2330) { + JSCompiler_temp = JSCompiler_object_inline_componentStack_2330.dgst; + var message = JSCompiler_object_inline_componentStack_2330.msg; + instance = JSCompiler_object_inline_componentStack_2330.stck; var componentStack = - JSCompiler_object_inline_componentStack_2317.cstck; + JSCompiler_object_inline_componentStack_2330.cstck; } - JSCompiler_object_inline_message_2314 = message; - JSCompiler_object_inline_digest_2315 = JSCompiler_temp; - JSCompiler_object_inline_stack_2316 = instance; - JSCompiler_object_inline_componentStack_2317 = componentStack; - "POSTPONE" !== JSCompiler_object_inline_digest_2315 && - ((JSCompiler_object_inline_message_2314 = - JSCompiler_object_inline_message_2314 - ? Error(JSCompiler_object_inline_message_2314) + JSCompiler_object_inline_message_2327 = message; + JSCompiler_object_inline_digest_2328 = JSCompiler_temp; + JSCompiler_object_inline_stack_2329 = instance; + JSCompiler_object_inline_componentStack_2330 = componentStack; + "POSTPONE" !== JSCompiler_object_inline_digest_2328 && + ((JSCompiler_object_inline_message_2327 = + JSCompiler_object_inline_message_2327 + ? Error(JSCompiler_object_inline_message_2327) : Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." )), - (JSCompiler_object_inline_message_2314.stack = - JSCompiler_object_inline_stack_2316 || ""), - (JSCompiler_object_inline_message_2314.digest = - JSCompiler_object_inline_digest_2315), - (JSCompiler_object_inline_componentStack_2317 = - void 0 === JSCompiler_object_inline_componentStack_2317 + (JSCompiler_object_inline_message_2327.stack = + JSCompiler_object_inline_stack_2329 || ""), + (JSCompiler_object_inline_message_2327.digest = + JSCompiler_object_inline_digest_2328), + (JSCompiler_object_inline_componentStack_2330 = + void 0 === JSCompiler_object_inline_componentStack_2330 ? null - : JSCompiler_object_inline_componentStack_2317), - "string" === typeof JSCompiler_object_inline_componentStack_2317 && + : JSCompiler_object_inline_componentStack_2330), + "string" === typeof JSCompiler_object_inline_componentStack_2330 && CapturedStacks.set( - JSCompiler_object_inline_message_2314, - JSCompiler_object_inline_componentStack_2317 + JSCompiler_object_inline_message_2327, + JSCompiler_object_inline_componentStack_2330 ), queueHydrationError({ - value: JSCompiler_object_inline_message_2314, + value: JSCompiler_object_inline_message_2327, source: null, - stack: JSCompiler_object_inline_componentStack_2317 + stack: JSCompiler_object_inline_componentStack_2330 })); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9191,25 +9211,25 @@ renderLanes, !1 ), - (JSCompiler_object_inline_componentStack_2317 = + (JSCompiler_object_inline_componentStack_2330 = 0 !== (renderLanes & current.childLanes)), - didReceiveUpdate || JSCompiler_object_inline_componentStack_2317) + didReceiveUpdate || JSCompiler_object_inline_componentStack_2330) ) { - JSCompiler_object_inline_componentStack_2317 = workInProgressRoot; - if (null !== JSCompiler_object_inline_componentStack_2317) { - JSCompiler_object_inline_stack_2316 = renderLanes & -renderLanes; - if (0 !== (JSCompiler_object_inline_stack_2316 & 42)) - JSCompiler_object_inline_stack_2316 = 1; + JSCompiler_object_inline_componentStack_2330 = workInProgressRoot; + if (null !== JSCompiler_object_inline_componentStack_2330) { + JSCompiler_object_inline_stack_2329 = renderLanes & -renderLanes; + if (0 !== (JSCompiler_object_inline_stack_2329 & 42)) + JSCompiler_object_inline_stack_2329 = 1; else - switch (JSCompiler_object_inline_stack_2316) { + switch (JSCompiler_object_inline_stack_2329) { case 2: - JSCompiler_object_inline_stack_2316 = 1; + JSCompiler_object_inline_stack_2329 = 1; break; case 8: - JSCompiler_object_inline_stack_2316 = 4; + JSCompiler_object_inline_stack_2329 = 4; break; case 32: - JSCompiler_object_inline_stack_2316 = 16; + JSCompiler_object_inline_stack_2329 = 16; break; case 128: case 256: @@ -9230,40 +9250,40 @@ case 8388608: case 16777216: case 33554432: - JSCompiler_object_inline_stack_2316 = 64; + JSCompiler_object_inline_stack_2329 = 64; break; case 268435456: - JSCompiler_object_inline_stack_2316 = 134217728; + JSCompiler_object_inline_stack_2329 = 134217728; break; default: - JSCompiler_object_inline_stack_2316 = 0; + JSCompiler_object_inline_stack_2329 = 0; } - JSCompiler_object_inline_stack_2316 = + JSCompiler_object_inline_stack_2329 = 0 !== - (JSCompiler_object_inline_stack_2316 & - (JSCompiler_object_inline_componentStack_2317.suspendedLanes | + (JSCompiler_object_inline_stack_2329 & + (JSCompiler_object_inline_componentStack_2330.suspendedLanes | renderLanes)) ? 0 - : JSCompiler_object_inline_stack_2316; + : JSCompiler_object_inline_stack_2329; if ( - 0 !== JSCompiler_object_inline_stack_2316 && - JSCompiler_object_inline_stack_2316 !== prevState.retryLane + 0 !== JSCompiler_object_inline_stack_2329 && + JSCompiler_object_inline_stack_2329 !== prevState.retryLane ) throw ( - ((prevState.retryLane = JSCompiler_object_inline_stack_2316), + ((prevState.retryLane = JSCompiler_object_inline_stack_2329), enqueueConcurrentRenderForLane( current, - JSCompiler_object_inline_stack_2316 + JSCompiler_object_inline_stack_2329 ), scheduleUpdateOnFiber( - JSCompiler_object_inline_componentStack_2317, + JSCompiler_object_inline_componentStack_2330, current, - JSCompiler_object_inline_stack_2316 + JSCompiler_object_inline_stack_2329 ), SelectiveHydrationException) ); } - JSCompiler_object_inline_digest_2315.data === + JSCompiler_object_inline_digest_2328.data === SUSPENSE_PENDING_START_DATA || renderDidSuspendDelayIfPossible(); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -9271,7 +9291,7 @@ renderLanes ); } else - JSCompiler_object_inline_digest_2315.data === + JSCompiler_object_inline_digest_2328.data === SUSPENSE_PENDING_START_DATA ? ((workInProgress.flags |= 128), (workInProgress.child = current.child), @@ -9279,12 +9299,12 @@ null, current )), - (JSCompiler_object_inline_digest_2315._reactRetry = + (JSCompiler_object_inline_digest_2328._reactRetry = workInProgress), (workInProgress = null)) : ((current = prevState.treeContext), (nextHydratableInstance = getNextHydratable( - JSCompiler_object_inline_digest_2315.nextSibling + JSCompiler_object_inline_digest_2328.nextSibling )), (hydrationParentFiber = workInProgress), (isHydrating = !0), @@ -9302,54 +9322,54 @@ (treeContextProvider = workInProgress)), (workInProgress = mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_stack_2316.children + JSCompiler_object_inline_stack_2329.children )), (workInProgress.flags |= 4096)); return workInProgress; } - if (JSCompiler_object_inline_message_2314) + if (JSCompiler_object_inline_message_2327) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_message_2314 = - JSCompiler_object_inline_stack_2316.fallback), - (JSCompiler_object_inline_digest_2315 = workInProgress.mode), + (JSCompiler_object_inline_message_2327 = + JSCompiler_object_inline_stack_2329.fallback), + (JSCompiler_object_inline_digest_2328 = workInProgress.mode), (JSCompiler_temp = current.child), (instance = JSCompiler_temp.sibling), - (JSCompiler_object_inline_stack_2316 = createWorkInProgress( + (JSCompiler_object_inline_stack_2329 = createWorkInProgress( JSCompiler_temp, { mode: "hidden", - children: JSCompiler_object_inline_stack_2316.children + children: JSCompiler_object_inline_stack_2329.children } )), - (JSCompiler_object_inline_stack_2316.subtreeFlags = + (JSCompiler_object_inline_stack_2329.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280), null !== instance - ? (JSCompiler_object_inline_message_2314 = createWorkInProgress( + ? (JSCompiler_object_inline_message_2327 = createWorkInProgress( instance, - JSCompiler_object_inline_message_2314 + JSCompiler_object_inline_message_2327 )) - : ((JSCompiler_object_inline_message_2314 = createFiberFromFragment( - JSCompiler_object_inline_message_2314, - JSCompiler_object_inline_digest_2315, + : ((JSCompiler_object_inline_message_2327 = createFiberFromFragment( + JSCompiler_object_inline_message_2327, + JSCompiler_object_inline_digest_2328, renderLanes, null )), - (JSCompiler_object_inline_message_2314.flags |= 2)), - (JSCompiler_object_inline_message_2314.return = workInProgress), - (JSCompiler_object_inline_stack_2316.return = workInProgress), - (JSCompiler_object_inline_stack_2316.sibling = - JSCompiler_object_inline_message_2314), - (workInProgress.child = JSCompiler_object_inline_stack_2316), - (JSCompiler_object_inline_stack_2316 = - JSCompiler_object_inline_message_2314), - (JSCompiler_object_inline_message_2314 = workInProgress.child), - (JSCompiler_object_inline_digest_2315 = current.child.memoizedState), - null === JSCompiler_object_inline_digest_2315 - ? (JSCompiler_object_inline_digest_2315 = + (JSCompiler_object_inline_message_2327.flags |= 2)), + (JSCompiler_object_inline_message_2327.return = workInProgress), + (JSCompiler_object_inline_stack_2329.return = workInProgress), + (JSCompiler_object_inline_stack_2329.sibling = + JSCompiler_object_inline_message_2327), + (workInProgress.child = JSCompiler_object_inline_stack_2329), + (JSCompiler_object_inline_stack_2329 = + JSCompiler_object_inline_message_2327), + (JSCompiler_object_inline_message_2327 = workInProgress.child), + (JSCompiler_object_inline_digest_2328 = current.child.memoizedState), + null === JSCompiler_object_inline_digest_2328 + ? (JSCompiler_object_inline_digest_2328 = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = - JSCompiler_object_inline_digest_2315.cachePool), + JSCompiler_object_inline_digest_2328.cachePool), null !== JSCompiler_temp ? ((instance = CacheContext._currentValue), (JSCompiler_temp = @@ -9357,38 +9377,38 @@ ? { parent: instance, pool: instance } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), - (JSCompiler_object_inline_digest_2315 = { + (JSCompiler_object_inline_digest_2328 = { baseLanes: - JSCompiler_object_inline_digest_2315.baseLanes | renderLanes, + JSCompiler_object_inline_digest_2328.baseLanes | renderLanes, cachePool: JSCompiler_temp })), - (JSCompiler_object_inline_message_2314.memoizedState = - JSCompiler_object_inline_digest_2315), - (JSCompiler_object_inline_message_2314.childLanes = + (JSCompiler_object_inline_message_2327.memoizedState = + JSCompiler_object_inline_digest_2328), + (JSCompiler_object_inline_message_2327.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_componentStack_2317, + JSCompiler_object_inline_componentStack_2330, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2316 + JSCompiler_object_inline_stack_2329 ); pushPrimaryTreeSuspenseHandler(workInProgress); renderLanes = current.child; current = renderLanes.sibling; renderLanes = createWorkInProgress(renderLanes, { mode: "visible", - children: JSCompiler_object_inline_stack_2316.children + children: JSCompiler_object_inline_stack_2329.children }); renderLanes.return = workInProgress; renderLanes.sibling = null; null !== current && - ((JSCompiler_object_inline_componentStack_2317 = + ((JSCompiler_object_inline_componentStack_2330 = workInProgress.deletions), - null === JSCompiler_object_inline_componentStack_2317 + null === JSCompiler_object_inline_componentStack_2330 ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) - : JSCompiler_object_inline_componentStack_2317.push(current)); + : JSCompiler_object_inline_componentStack_2330.push(current)); workInProgress.child = renderLanes; workInProgress.memoizedState = null; return renderLanes; @@ -14794,7 +14814,7 @@ workInProgressDeferredLane, workInProgressRootDidSkipSuspendedSiblings ); - markRootUpdated(root, lane); + markRootUpdated$1(root, lane); if ( 0 !== (executionContext & RenderContext) && root === workInProgressRoot @@ -15125,18 +15145,6 @@ } return !0; } - function markRootUpdated(root, updatedLanes) { - root.pendingLanes |= updatedLanes; - 268435456 !== updatedLanes && - ((root.suspendedLanes = 0), - (root.pingedLanes = 0), - (root.warmLanes = 0)); - executionContext & RenderContext - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & CommitContext && - (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); - } function markRootSuspended( root, suspendedLanes, @@ -15830,13 +15838,14 @@ ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); if ((executionContext & (RenderContext | CommitContext)) !== NoContext) throw Error("Should not already be working."); - var finishedWork = root.finishedWork, - lanes = root.finishedLanes; - reusableComponentDevToolDetails.track = - getGroupNameOfHighestPriorityLane(lanes); + var finishedWork = root.finishedWork; + didIncludeRenderPhaseUpdate = root.finishedLanes; + reusableComponentDevToolDetails.track = getGroupNameOfHighestPriorityLane( + didIncludeRenderPhaseUpdate + ); logRenderPhase(completedRenderStartTime, completedRenderEndTime); if (null === finishedWork) return null; - 0 === lanes && + 0 === didIncludeRenderPhaseUpdate && console.error( "root.finishedLanes should not be empty during a commit. This is a bug in React." ); @@ -15853,13 +15862,12 @@ completedRenderStartTime |= concurrentlyUpdatedLanes; markRootFinished( root, - lanes, + didIncludeRenderPhaseUpdate, completedRenderStartTime, spawnedLane, updatedLanes, suspendedRetryLanes ); - didIncludeCommitPhaseUpdate = !1; root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -15889,12 +15897,16 @@ (updatedLanes = executionContext), (executionContext |= CommitContext), commitBeforeMutationEffects(root, finishedWork), - commitMutationEffects(root, finishedWork, lanes), + commitMutationEffects( + root, + finishedWork, + didIncludeRenderPhaseUpdate + ), restoreSelection(selectionInformation, root.containerInfo), (_enabled = !!eventsEnabled), (selectionInformation = eventsEnabled = null), (root.current = finishedWork), - commitLayoutEffects(finishedWork, root, lanes), + commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate), requestPaint(), (executionContext = updatedLanes), (ReactDOMSharedInternals.p = spawnedLane), @@ -15905,7 +15917,7 @@ (transitions = rootDoesHavePassiveEffects) ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = lanes)) + (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) : (releaseRootPooledCache(root, completedRenderStartTime), (nestedPassiveUpdateCount = 0), (rootWithPassiveNestedUpdates = null)); @@ -15933,15 +15945,14 @@ ); 0 !== (pendingPassiveEffectsLanes & 3) && flushPassiveEffects(); completedRenderStartTime = root.pendingLanes; - didIncludeRenderPhaseUpdate || - didIncludeCommitPhaseUpdate || - (0 !== (lanes & 4194218) && 0 !== (completedRenderStartTime & 42)) + 0 !== (didIncludeRenderPhaseUpdate & 4194218) && + 0 !== (completedRenderStartTime & 42) ? ((nestedUpdateScheduled = !0), root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))) : (nestedUpdateCount = 0); - transitions || finalizeRender(lanes, now$1()); + transitions || finalizeRender(didIncludeRenderPhaseUpdate, now$1()); flushSyncWorkAcrossRoots_impl(0, !1); return null; } @@ -16080,7 +16091,7 @@ sourceFiber = createRootErrorUpdate(rootFiber.stateNode, sourceFiber, 2); rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); null !== rootFiber && - (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); + (markRootUpdated$1(rootFiber, 2), ensureRootIsScheduled(rootFiber)); } function captureCommitPhaseError( sourceFiber, @@ -16119,7 +16130,7 @@ nearestMountedAncestor, sourceFiber ), - markRootUpdated(instance, 2), + markRootUpdated$1(instance, 2), ensureRootIsScheduled(instance)); return; } @@ -16154,11 +16165,6 @@ null !== pingCache && pingCache.delete(wakeable); root.pingedLanes |= root.suspendedLanes & pingedLanes; root.warmLanes &= ~pingedLanes; - executionContext & RenderContext - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & CommitContext && - (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); isConcurrentActEnvironment() && null === ReactSharedInternals.actQueue && console.error( @@ -16182,7 +16188,7 @@ 0 === retryLane && (retryLane = claimNextRetryLane()); boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); null !== boundaryFiber && - (markRootUpdated(boundaryFiber, retryLane), + (markRootUpdated$1(boundaryFiber, retryLane), ensureRootIsScheduled(boundaryFiber)); } function retryDehydratedSuspenseBoundary(boundaryFiber) { @@ -16213,26 +16219,6 @@ null !== retryCache && retryCache.delete(wakeable); retryTimedOutBoundary(boundaryFiber, retryLane); } - function throwIfInfiniteUpdateLoopDetected() { - if (nestedUpdateCount > NESTED_UPDATE_LIMIT) - throw ( - ((nestedPassiveUpdateCount = nestedUpdateCount = 0), - (rootWithPassiveNestedUpdates = rootWithNestedUpdates = null), - executionContext & RenderContext && - null !== workInProgressRoot && - (workInProgressRoot.errorRecoveryDisabledLanes |= - workInProgressRootRenderLanes), - Error( - "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." - )) - ); - nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT && - ((nestedPassiveUpdateCount = 0), - (rootWithPassiveNestedUpdates = null), - console.error( - "Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render." - )); - } function recursivelyTraverseAndDoubleInvokeEffectsInDEV( root$jscomp$0, parentFiber, @@ -24698,7 +24684,6 @@ workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, workInProgressRootDidIncludeRecursiveRenderUpdate = !1, - didIncludeCommitPhaseUpdate = !1, globalMostRecentFallbackTime = 0, FALLBACK_THROTTLE_MS = 300, workInProgressRootRenderTargetTime = Infinity, @@ -24711,12 +24696,12 @@ pendingPassiveEffectsRemainingLanes = 0, pendingPassiveEffectsRenderEndTime = -0, pendingPassiveTransitions = null, - NESTED_UPDATE_LIMIT = 100, + NESTED_UPDATE_LIMIT = 50, nestedUpdateCount = 0, rootWithNestedUpdates = null, isFlushingPassiveEffects = !1, didScheduleUpdateDuringPassiveEffects = !1, - NESTED_PASSIVE_UPDATE_LIMIT = 100, + NESTED_PASSIVE_UPDATE_LIMIT = 50, nestedPassiveUpdateCount = 0, rootWithPassiveNestedUpdates = null, isRunningInsertionEffect = !1, @@ -25267,11 +25252,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-experimental-2d16326d-20240930" !== isomorphicReactPackageVersion) + if ("19.0.0-experimental-1460d67c-20241003" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-experimental-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-experimental-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -25308,11 +25293,11 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-experimental-2d16326d-20240930", + version: "19.0.0-experimental-1460d67c-20241003", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-2d16326d-20240930" + reconcilerVersion: "19.0.0-experimental-1460d67c-20241003" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -25585,7 +25570,7 @@ identifierPrefix.callback = null; enqueueUpdate(options, identifierPrefix, isStrictMode); initialChildren.current.lanes = isStrictMode; - markRootUpdated(initialChildren, isStrictMode); + markRootUpdated$1(initialChildren, isStrictMode); ensureRootIsScheduled(initialChildren); container[internalContainerInstanceKey] = initialChildren.current; listenToAllSupportedEvents(container); @@ -25620,5 +25605,5 @@ } }; }; - exports.version = "19.0.0-experimental-2d16326d-20240930"; + exports.version = "19.0.0-experimental-1460d67c-20241003"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.production.js index 9c0d8699de540..9233a2456bee1 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom-unstable_testing.production.js @@ -691,6 +691,11 @@ function createLaneMap(initial) { for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; } +function markRootUpdated$1(root, updateLane) { + root.pendingLanes |= updateLane; + 268435456 !== updateLane && + ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); +} function markRootFinished( root, finishedLanes, @@ -2484,7 +2489,12 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { - throwIfInfiniteUpdateLoopDetected(); + if (50 < nestedUpdateCount) + throw ( + ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))) + ); for (var parent = sourceFiber.return; null !== parent; ) (sourceFiber = parent), (parent = sourceFiber.return); return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; @@ -10606,7 +10616,6 @@ var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, workInProgressRootDidIncludeRecursiveRenderUpdate = !1, - didIncludeCommitPhaseUpdate = !1, globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, workInProgressTransitions = null, @@ -10649,7 +10658,7 @@ function scheduleUpdateOnFiber(root, fiber, lane) { workInProgressDeferredLane, workInProgressRootDidSkipSuspendedSiblings ); - markRootUpdated(root, lane); + markRootUpdated$1(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) root === workInProgressRoot && (0 === (executionContext & 2) && @@ -10928,15 +10937,6 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootUpdated(root, updatedLanes) { - root.pendingLanes |= updatedLanes; - 268435456 !== updatedLanes && - ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); - executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); -} function markRootSuspended( root, suspendedLanes, @@ -11435,8 +11435,8 @@ function commitRootImpl( do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); - var finishedWork = root.finishedWork, - lanes = root.finishedLanes; + var finishedWork = root.finishedWork; + didIncludeRenderPhaseUpdate = root.finishedLanes; if (null === finishedWork) return null; root.finishedWork = null; root.finishedLanes = 0; @@ -11448,13 +11448,12 @@ function commitRootImpl( remainingLanes |= concurrentlyUpdatedLanes; markRootFinished( root, - lanes, + didIncludeRenderPhaseUpdate, remainingLanes, spawnedLane, updatedLanes, suspendedRetryLanes ); - didIncludeCommitPhaseUpdate = !1; root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -11491,7 +11490,7 @@ function commitRootImpl( rootDoesHavePassiveEffects ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = lanes)) + (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) : releaseRootPooledCache(root, remainingLanes); remainingLanes = root.pendingLanes; 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); @@ -11509,9 +11508,7 @@ function commitRootImpl( }); 0 !== (pendingPassiveEffectsLanes & 3) && flushPassiveEffects(); remainingLanes = root.pendingLanes; - didIncludeRenderPhaseUpdate || - didIncludeCommitPhaseUpdate || - (0 !== (lanes & 4194218) && 0 !== (remainingLanes & 42)) + 0 !== (didIncludeRenderPhaseUpdate & 4194218) && 0 !== (remainingLanes & 42) ? root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) @@ -11576,7 +11573,7 @@ function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { sourceFiber = createRootErrorUpdate(rootFiber.stateNode, sourceFiber, 2); rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); null !== rootFiber && - (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); + (markRootUpdated$1(rootFiber, 2), ensureRootIsScheduled(rootFiber)); } function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { if (3 === sourceFiber.tag) @@ -11609,7 +11606,7 @@ function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { nearestMountedAncestor, sourceFiber ), - markRootUpdated(instance, 2), + markRootUpdated$1(instance, 2), ensureRootIsScheduled(instance)); break; } @@ -11638,10 +11635,6 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { null !== pingCache && pingCache.delete(wakeable); root.pingedLanes |= root.suspendedLanes & pingedLanes; root.warmLanes &= ~pingedLanes; - executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); workInProgressRoot === root && (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || @@ -11659,7 +11652,7 @@ function retryTimedOutBoundary(boundaryFiber, retryLane) { 0 === retryLane && (retryLane = claimNextRetryLane()); boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); null !== boundaryFiber && - (markRootUpdated(boundaryFiber, retryLane), + (markRootUpdated$1(boundaryFiber, retryLane), ensureRootIsScheduled(boundaryFiber)); } function retryDehydratedSuspenseBoundary(boundaryFiber) { @@ -11688,18 +11681,6 @@ function resolveRetryWakeable(boundaryFiber, wakeable) { null !== retryCache && retryCache.delete(wakeable); retryTimedOutBoundary(boundaryFiber, retryLane); } -function throwIfInfiniteUpdateLoopDetected() { - if (100 < nestedUpdateCount) - throw ( - ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - executionContext & 2 && - null !== workInProgressRoot && - (workInProgressRoot.errorRecoveryDisabledLanes |= - workInProgressRootRenderLanes), - Error(formatProdErrorMessage(185))) - ); -} function scheduleCallback$1(priorityLevel, callback) { return scheduleCallback$3(priorityLevel, callback); } @@ -11986,20 +11967,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1441 = 0; - i$jscomp$inline_1441 < simpleEventPluginEvents.length; - i$jscomp$inline_1441++ + var i$jscomp$inline_1454 = 0; + i$jscomp$inline_1454 < simpleEventPluginEvents.length; + i$jscomp$inline_1454++ ) { - var eventName$jscomp$inline_1442 = - simpleEventPluginEvents[i$jscomp$inline_1441], - domEventName$jscomp$inline_1443 = - eventName$jscomp$inline_1442.toLowerCase(), - capitalizedEvent$jscomp$inline_1444 = - eventName$jscomp$inline_1442[0].toUpperCase() + - eventName$jscomp$inline_1442.slice(1); + var eventName$jscomp$inline_1455 = + simpleEventPluginEvents[i$jscomp$inline_1454], + domEventName$jscomp$inline_1456 = + eventName$jscomp$inline_1455.toLowerCase(), + capitalizedEvent$jscomp$inline_1457 = + eventName$jscomp$inline_1455[0].toUpperCase() + + eventName$jscomp$inline_1455.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1443, - "on" + capitalizedEvent$jscomp$inline_1444 + domEventName$jscomp$inline_1456, + "on" + capitalizedEvent$jscomp$inline_1457 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -15497,16 +15478,16 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { 0 === i && attemptExplicitHydrationTarget(target); } }; -var isomorphicReactPackageVersion$jscomp$inline_1688 = React.version; +var isomorphicReactPackageVersion$jscomp$inline_1701 = React.version; if ( - "19.0.0-experimental-2d16326d-20240930" !== - isomorphicReactPackageVersion$jscomp$inline_1688 + "19.0.0-experimental-1460d67c-20241003" !== + isomorphicReactPackageVersion$jscomp$inline_1701 ) throw Error( formatProdErrorMessage( 527, - isomorphicReactPackageVersion$jscomp$inline_1688, - "19.0.0-experimental-2d16326d-20240930" + isomorphicReactPackageVersion$jscomp$inline_1701, + "19.0.0-experimental-1460d67c-20241003" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15526,25 +15507,25 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { null === componentOrElement ? null : componentOrElement.stateNode; return componentOrElement; }; -var internals$jscomp$inline_2158 = { +var internals$jscomp$inline_2171 = { bundleType: 0, - version: "19.0.0-experimental-2d16326d-20240930", + version: "19.0.0-experimental-1460d67c-20241003", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-experimental-2d16326d-20240930" + reconcilerVersion: "19.0.0-experimental-1460d67c-20241003" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2159 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2172 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2159.isDisabled && - hook$jscomp$inline_2159.supportsFiber + !hook$jscomp$inline_2172.isDisabled && + hook$jscomp$inline_2172.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2159.inject( - internals$jscomp$inline_2158 + (rendererID = hook$jscomp$inline_2172.inject( + internals$jscomp$inline_2171 )), - (injectedHook = hook$jscomp$inline_2159); + (injectedHook = hook$jscomp$inline_2172); } catch (err) {} } exports.createComponentSelector = function (component) { @@ -15763,7 +15744,7 @@ exports.hydrateRoot = function (container, initialChildren, options) { identifierPrefix.callback = null; enqueueUpdate(options, identifierPrefix, isStrictMode); initialChildren.current.lanes = isStrictMode; - markRootUpdated(initialChildren, isStrictMode); + markRootUpdated$1(initialChildren, isStrictMode); ensureRootIsScheduled(initialChildren); container[internalContainerInstanceKey] = initialChildren.current; listenToAllSupportedEvents(container); @@ -15787,4 +15768,4 @@ exports.observeVisibleRects = function ( } }; }; -exports.version = "19.0.0-experimental-2d16326d-20240930"; +exports.version = "19.0.0-experimental-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.development.js index 156f2f0717af0..1627f5d89c024 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.development.js @@ -416,7 +416,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-experimental-2d16326d-20240930"; + exports.version = "19.0.0-experimental-1460d67c-20241003"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.production.js index f733250e2bc49..e9d2c9216d44d 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.production.js @@ -207,4 +207,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-experimental-2d16326d-20240930"; +exports.version = "19.0.0-experimental-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.development.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.development.js index 31cacf29d728d..ca535ceef9270 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.development.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.development.js @@ -336,5 +336,5 @@ })) : Internals.d.m(href)); }; - exports.version = "19.0.0-experimental-2d16326d-20240930"; + exports.version = "19.0.0-experimental-1460d67c-20241003"; })(); diff --git a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.production.js b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.production.js index 9b81c5a938255..ab6528b9deccc 100644 --- a/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.production.js +++ b/packages/next/src/compiled/react-dom-experimental/cjs/react-dom.react-server.production.js @@ -149,4 +149,4 @@ exports.preloadModule = function (href, options) { }); } else Internals.d.m(href); }; -exports.version = "19.0.0-experimental-2d16326d-20240930"; +exports.version = "19.0.0-experimental-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom-experimental/package.json b/packages/next/src/compiled/react-dom-experimental/package.json index 522c2e0df1867..04e102022b607 100644 --- a/packages/next/src/compiled/react-dom-experimental/package.json +++ b/packages/next/src/compiled/react-dom-experimental/package.json @@ -72,10 +72,10 @@ "./package.json": "./package.json" }, "dependencies": { - "scheduler": "0.0.0-experimental-2d16326d-20240930" + "scheduler": "0.0.0-experimental-1460d67c-20241003" }, "peerDependencies": { - "react": "0.0.0-experimental-2d16326d-20240930" + "react": "0.0.0-experimental-1460d67c-20241003" }, "browser": { "./server.js": "./server.browser.js", diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-client.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-client.development.js index b46ab9153af47..d4b031af69126 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-client.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-client.development.js @@ -1097,6 +1097,13 @@ for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; } + function markRootUpdated$1(root, updateLane) { + root.pendingLanes |= updateLane; + 268435456 !== updateLane && + ((root.suspendedLanes = 0), + (root.pingedLanes = 0), + (root.warmLanes = 0)); + } function markRootFinished( root, finishedLanes, @@ -3775,7 +3782,20 @@ (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { - throwIfInfiniteUpdateLoopDetected(); + if (nestedUpdateCount > NESTED_UPDATE_LIMIT) + throw ( + ((nestedPassiveUpdateCount = nestedUpdateCount = 0), + (rootWithPassiveNestedUpdates = rootWithNestedUpdates = null), + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + )) + ); + nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT && + ((nestedPassiveUpdateCount = 0), + (rootWithPassiveNestedUpdates = null), + console.error( + "Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render." + )); null === sourceFiber.alternate && 0 !== (sourceFiber.flags & 4098) && warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); @@ -8628,32 +8648,32 @@ return current; } function updateSuspenseComponent(current, workInProgress, renderLanes) { - var JSCompiler_object_inline_digest_2298; - var JSCompiler_object_inline_stack_2299 = workInProgress.pendingProps; + var JSCompiler_object_inline_digest_2311; + var JSCompiler_object_inline_stack_2312 = workInProgress.pendingProps; shouldSuspendImpl(workInProgress) && (workInProgress.flags |= 128); - var JSCompiler_object_inline_componentStack_2300 = !1; + var JSCompiler_object_inline_componentStack_2313 = !1; var didSuspend = 0 !== (workInProgress.flags & 128); - (JSCompiler_object_inline_digest_2298 = didSuspend) || - (JSCompiler_object_inline_digest_2298 = + (JSCompiler_object_inline_digest_2311 = didSuspend) || + (JSCompiler_object_inline_digest_2311 = null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseStackCursor.current & ForceSuspenseFallback)); - JSCompiler_object_inline_digest_2298 && - ((JSCompiler_object_inline_componentStack_2300 = !0), + JSCompiler_object_inline_digest_2311 && + ((JSCompiler_object_inline_componentStack_2313 = !0), (workInProgress.flags &= -129)); - JSCompiler_object_inline_digest_2298 = 0 !== (workInProgress.flags & 32); + JSCompiler_object_inline_digest_2311 = 0 !== (workInProgress.flags & 32); workInProgress.flags &= -33; if (null === current) { if (isHydrating) { - JSCompiler_object_inline_componentStack_2300 + JSCompiler_object_inline_componentStack_2313 ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); if (isHydrating) { - var JSCompiler_object_inline_message_2297 = nextHydratableInstance; + var JSCompiler_object_inline_message_2310 = nextHydratableInstance; var JSCompiler_temp; - if (!(JSCompiler_temp = !JSCompiler_object_inline_message_2297)) { + if (!(JSCompiler_temp = !JSCompiler_object_inline_message_2310)) { c: { - var instance = JSCompiler_object_inline_message_2297; + var instance = JSCompiler_object_inline_message_2310; for ( JSCompiler_temp = rootOrSingletonContext; 8 !== instance.nodeType; @@ -8694,19 +8714,19 @@ JSCompiler_temp && (warnNonHydratedInstance( workInProgress, - JSCompiler_object_inline_message_2297 + JSCompiler_object_inline_message_2310 ), throwOnHydrationMismatch(workInProgress)); } - JSCompiler_object_inline_message_2297 = workInProgress.memoizedState; + JSCompiler_object_inline_message_2310 = workInProgress.memoizedState; if ( - null !== JSCompiler_object_inline_message_2297 && - ((JSCompiler_object_inline_message_2297 = - JSCompiler_object_inline_message_2297.dehydrated), - null !== JSCompiler_object_inline_message_2297) + null !== JSCompiler_object_inline_message_2310 && + ((JSCompiler_object_inline_message_2310 = + JSCompiler_object_inline_message_2310.dehydrated), + null !== JSCompiler_object_inline_message_2310) ) return ( - JSCompiler_object_inline_message_2297.data === + JSCompiler_object_inline_message_2310.data === SUSPENSE_FALLBACK_START_DATA ? (workInProgress.lanes = 16) : (workInProgress.lanes = 536870912), @@ -8714,58 +8734,58 @@ ); popSuspenseHandler(workInProgress); } - JSCompiler_object_inline_message_2297 = - JSCompiler_object_inline_stack_2299.children; - JSCompiler_object_inline_stack_2299 = - JSCompiler_object_inline_stack_2299.fallback; - if (JSCompiler_object_inline_componentStack_2300) + JSCompiler_object_inline_message_2310 = + JSCompiler_object_inline_stack_2312.children; + JSCompiler_object_inline_stack_2312 = + JSCompiler_object_inline_stack_2312.fallback; + if (JSCompiler_object_inline_componentStack_2313) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2300 = + (JSCompiler_object_inline_componentStack_2313 = workInProgress.mode), - (JSCompiler_object_inline_message_2297 = + (JSCompiler_object_inline_message_2310 = mountWorkInProgressOffscreenFiber( { mode: "hidden", - children: JSCompiler_object_inline_message_2297 + children: JSCompiler_object_inline_message_2310 }, - JSCompiler_object_inline_componentStack_2300 + JSCompiler_object_inline_componentStack_2313 )), - (JSCompiler_object_inline_stack_2299 = createFiberFromFragment( - JSCompiler_object_inline_stack_2299, - JSCompiler_object_inline_componentStack_2300, + (JSCompiler_object_inline_stack_2312 = createFiberFromFragment( + JSCompiler_object_inline_stack_2312, + JSCompiler_object_inline_componentStack_2313, renderLanes, null )), - (JSCompiler_object_inline_message_2297.return = workInProgress), - (JSCompiler_object_inline_stack_2299.return = workInProgress), - (JSCompiler_object_inline_message_2297.sibling = - JSCompiler_object_inline_stack_2299), - (workInProgress.child = JSCompiler_object_inline_message_2297), - (JSCompiler_object_inline_componentStack_2300 = + (JSCompiler_object_inline_message_2310.return = workInProgress), + (JSCompiler_object_inline_stack_2312.return = workInProgress), + (JSCompiler_object_inline_message_2310.sibling = + JSCompiler_object_inline_stack_2312), + (workInProgress.child = JSCompiler_object_inline_message_2310), + (JSCompiler_object_inline_componentStack_2313 = workInProgress.child), - (JSCompiler_object_inline_componentStack_2300.memoizedState = + (JSCompiler_object_inline_componentStack_2313.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_componentStack_2300.childLanes = + (JSCompiler_object_inline_componentStack_2313.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2298, + JSCompiler_object_inline_digest_2311, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2299 + JSCompiler_object_inline_stack_2312 ); pushPrimaryTreeSuspenseHandler(workInProgress); return mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_message_2297 + JSCompiler_object_inline_message_2310 ); } var prevState = current.memoizedState; if ( null !== prevState && - ((JSCompiler_object_inline_message_2297 = prevState.dehydrated), - null !== JSCompiler_object_inline_message_2297) + ((JSCompiler_object_inline_message_2310 = prevState.dehydrated), + null !== JSCompiler_object_inline_message_2310) ) { if (didSuspend) workInProgress.flags & 256 @@ -8782,94 +8802,94 @@ (workInProgress.flags |= 128), (workInProgress = null)) : (reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2300 = - JSCompiler_object_inline_stack_2299.fallback), - (JSCompiler_object_inline_message_2297 = workInProgress.mode), - (JSCompiler_object_inline_stack_2299 = + (JSCompiler_object_inline_componentStack_2313 = + JSCompiler_object_inline_stack_2312.fallback), + (JSCompiler_object_inline_message_2310 = workInProgress.mode), + (JSCompiler_object_inline_stack_2312 = mountWorkInProgressOffscreenFiber( { mode: "visible", - children: JSCompiler_object_inline_stack_2299.children + children: JSCompiler_object_inline_stack_2312.children }, - JSCompiler_object_inline_message_2297 + JSCompiler_object_inline_message_2310 )), - (JSCompiler_object_inline_componentStack_2300 = + (JSCompiler_object_inline_componentStack_2313 = createFiberFromFragment( - JSCompiler_object_inline_componentStack_2300, - JSCompiler_object_inline_message_2297, + JSCompiler_object_inline_componentStack_2313, + JSCompiler_object_inline_message_2310, renderLanes, null )), - (JSCompiler_object_inline_componentStack_2300.flags |= 2), - (JSCompiler_object_inline_stack_2299.return = workInProgress), - (JSCompiler_object_inline_componentStack_2300.return = + (JSCompiler_object_inline_componentStack_2313.flags |= 2), + (JSCompiler_object_inline_stack_2312.return = workInProgress), + (JSCompiler_object_inline_componentStack_2313.return = workInProgress), - (JSCompiler_object_inline_stack_2299.sibling = - JSCompiler_object_inline_componentStack_2300), - (workInProgress.child = JSCompiler_object_inline_stack_2299), + (JSCompiler_object_inline_stack_2312.sibling = + JSCompiler_object_inline_componentStack_2313), + (workInProgress.child = JSCompiler_object_inline_stack_2312), reconcileChildFibers( workInProgress, current.child, null, renderLanes ), - (JSCompiler_object_inline_stack_2299 = workInProgress.child), - (JSCompiler_object_inline_stack_2299.memoizedState = + (JSCompiler_object_inline_stack_2312 = workInProgress.child), + (JSCompiler_object_inline_stack_2312.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_stack_2299.childLanes = + (JSCompiler_object_inline_stack_2312.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2298, + JSCompiler_object_inline_digest_2311, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress = - JSCompiler_object_inline_componentStack_2300)); + JSCompiler_object_inline_componentStack_2313)); else if ( (pushPrimaryTreeSuspenseHandler(workInProgress), isHydrating && console.error( "We should not be hydrating here. This is a bug in React. Please file a bug." ), - JSCompiler_object_inline_message_2297.data === + JSCompiler_object_inline_message_2310.data === SUSPENSE_FALLBACK_START_DATA) ) { - JSCompiler_object_inline_digest_2298 = - JSCompiler_object_inline_message_2297.nextSibling && - JSCompiler_object_inline_message_2297.nextSibling.dataset; - if (JSCompiler_object_inline_digest_2298) { - JSCompiler_temp = JSCompiler_object_inline_digest_2298.dgst; - var message = JSCompiler_object_inline_digest_2298.msg; - instance = JSCompiler_object_inline_digest_2298.stck; - var componentStack = JSCompiler_object_inline_digest_2298.cstck; + JSCompiler_object_inline_digest_2311 = + JSCompiler_object_inline_message_2310.nextSibling && + JSCompiler_object_inline_message_2310.nextSibling.dataset; + if (JSCompiler_object_inline_digest_2311) { + JSCompiler_temp = JSCompiler_object_inline_digest_2311.dgst; + var message = JSCompiler_object_inline_digest_2311.msg; + instance = JSCompiler_object_inline_digest_2311.stck; + var componentStack = JSCompiler_object_inline_digest_2311.cstck; } - JSCompiler_object_inline_message_2297 = message; - JSCompiler_object_inline_digest_2298 = JSCompiler_temp; - JSCompiler_object_inline_stack_2299 = instance; - JSCompiler_object_inline_componentStack_2300 = componentStack; - JSCompiler_object_inline_message_2297 = - JSCompiler_object_inline_message_2297 - ? Error(JSCompiler_object_inline_message_2297) + JSCompiler_object_inline_message_2310 = message; + JSCompiler_object_inline_digest_2311 = JSCompiler_temp; + JSCompiler_object_inline_stack_2312 = instance; + JSCompiler_object_inline_componentStack_2313 = componentStack; + JSCompiler_object_inline_message_2310 = + JSCompiler_object_inline_message_2310 + ? Error(JSCompiler_object_inline_message_2310) : Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." ); - JSCompiler_object_inline_message_2297.stack = - JSCompiler_object_inline_stack_2299 || ""; - JSCompiler_object_inline_message_2297.digest = - JSCompiler_object_inline_digest_2298; - JSCompiler_object_inline_digest_2298 = - void 0 === JSCompiler_object_inline_componentStack_2300 + JSCompiler_object_inline_message_2310.stack = + JSCompiler_object_inline_stack_2312 || ""; + JSCompiler_object_inline_message_2310.digest = + JSCompiler_object_inline_digest_2311; + JSCompiler_object_inline_digest_2311 = + void 0 === JSCompiler_object_inline_componentStack_2313 ? null - : JSCompiler_object_inline_componentStack_2300; - "string" === typeof JSCompiler_object_inline_digest_2298 && + : JSCompiler_object_inline_componentStack_2313; + "string" === typeof JSCompiler_object_inline_digest_2311 && CapturedStacks.set( - JSCompiler_object_inline_message_2297, - JSCompiler_object_inline_digest_2298 + JSCompiler_object_inline_message_2310, + JSCompiler_object_inline_digest_2311 ); queueHydrationError({ - value: JSCompiler_object_inline_message_2297, + value: JSCompiler_object_inline_message_2310, source: null, - stack: JSCompiler_object_inline_digest_2298 + stack: JSCompiler_object_inline_digest_2311 }); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -8884,25 +8904,25 @@ renderLanes, !1 ), - (JSCompiler_object_inline_digest_2298 = + (JSCompiler_object_inline_digest_2311 = 0 !== (renderLanes & current.childLanes)), - didReceiveUpdate || JSCompiler_object_inline_digest_2298) + didReceiveUpdate || JSCompiler_object_inline_digest_2311) ) { - JSCompiler_object_inline_digest_2298 = workInProgressRoot; - if (null !== JSCompiler_object_inline_digest_2298) { - JSCompiler_object_inline_stack_2299 = renderLanes & -renderLanes; - if (0 !== (JSCompiler_object_inline_stack_2299 & 42)) - JSCompiler_object_inline_stack_2299 = 1; + JSCompiler_object_inline_digest_2311 = workInProgressRoot; + if (null !== JSCompiler_object_inline_digest_2311) { + JSCompiler_object_inline_stack_2312 = renderLanes & -renderLanes; + if (0 !== (JSCompiler_object_inline_stack_2312 & 42)) + JSCompiler_object_inline_stack_2312 = 1; else - switch (JSCompiler_object_inline_stack_2299) { + switch (JSCompiler_object_inline_stack_2312) { case 2: - JSCompiler_object_inline_stack_2299 = 1; + JSCompiler_object_inline_stack_2312 = 1; break; case 8: - JSCompiler_object_inline_stack_2299 = 4; + JSCompiler_object_inline_stack_2312 = 4; break; case 32: - JSCompiler_object_inline_stack_2299 = 16; + JSCompiler_object_inline_stack_2312 = 16; break; case 128: case 256: @@ -8923,40 +8943,40 @@ case 8388608: case 16777216: case 33554432: - JSCompiler_object_inline_stack_2299 = 64; + JSCompiler_object_inline_stack_2312 = 64; break; case 268435456: - JSCompiler_object_inline_stack_2299 = 134217728; + JSCompiler_object_inline_stack_2312 = 134217728; break; default: - JSCompiler_object_inline_stack_2299 = 0; + JSCompiler_object_inline_stack_2312 = 0; } - JSCompiler_object_inline_stack_2299 = + JSCompiler_object_inline_stack_2312 = 0 !== - (JSCompiler_object_inline_stack_2299 & - (JSCompiler_object_inline_digest_2298.suspendedLanes | + (JSCompiler_object_inline_stack_2312 & + (JSCompiler_object_inline_digest_2311.suspendedLanes | renderLanes)) ? 0 - : JSCompiler_object_inline_stack_2299; + : JSCompiler_object_inline_stack_2312; if ( - 0 !== JSCompiler_object_inline_stack_2299 && - JSCompiler_object_inline_stack_2299 !== prevState.retryLane + 0 !== JSCompiler_object_inline_stack_2312 && + JSCompiler_object_inline_stack_2312 !== prevState.retryLane ) throw ( - ((prevState.retryLane = JSCompiler_object_inline_stack_2299), + ((prevState.retryLane = JSCompiler_object_inline_stack_2312), enqueueConcurrentRenderForLane( current, - JSCompiler_object_inline_stack_2299 + JSCompiler_object_inline_stack_2312 ), scheduleUpdateOnFiber( - JSCompiler_object_inline_digest_2298, + JSCompiler_object_inline_digest_2311, current, - JSCompiler_object_inline_stack_2299 + JSCompiler_object_inline_stack_2312 ), SelectiveHydrationException) ); } - JSCompiler_object_inline_message_2297.data === + JSCompiler_object_inline_message_2310.data === SUSPENSE_PENDING_START_DATA || renderDidSuspendDelayIfPossible(); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -8964,7 +8984,7 @@ renderLanes ); } else - JSCompiler_object_inline_message_2297.data === + JSCompiler_object_inline_message_2310.data === SUSPENSE_PENDING_START_DATA ? ((workInProgress.flags |= 128), (workInProgress.child = current.child), @@ -8972,12 +8992,12 @@ null, current )), - (JSCompiler_object_inline_message_2297._reactRetry = + (JSCompiler_object_inline_message_2310._reactRetry = workInProgress), (workInProgress = null)) : ((current = prevState.treeContext), (nextHydratableInstance = getNextHydratable( - JSCompiler_object_inline_message_2297.nextSibling + JSCompiler_object_inline_message_2310.nextSibling )), (hydrationParentFiber = workInProgress), (isHydrating = !0), @@ -8995,57 +9015,57 @@ (treeContextProvider = workInProgress)), (workInProgress = mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_stack_2299.children + JSCompiler_object_inline_stack_2312.children )), (workInProgress.flags |= 4096)); return workInProgress; } - if (JSCompiler_object_inline_componentStack_2300) + if (JSCompiler_object_inline_componentStack_2313) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2300 = - JSCompiler_object_inline_stack_2299.fallback), - (JSCompiler_object_inline_message_2297 = workInProgress.mode), + (JSCompiler_object_inline_componentStack_2313 = + JSCompiler_object_inline_stack_2312.fallback), + (JSCompiler_object_inline_message_2310 = workInProgress.mode), (JSCompiler_temp = current.child), (instance = JSCompiler_temp.sibling), - (JSCompiler_object_inline_stack_2299 = createWorkInProgress( + (JSCompiler_object_inline_stack_2312 = createWorkInProgress( JSCompiler_temp, { mode: "hidden", - children: JSCompiler_object_inline_stack_2299.children + children: JSCompiler_object_inline_stack_2312.children } )), - (JSCompiler_object_inline_stack_2299.subtreeFlags = + (JSCompiler_object_inline_stack_2312.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280), null !== instance - ? (JSCompiler_object_inline_componentStack_2300 = + ? (JSCompiler_object_inline_componentStack_2313 = createWorkInProgress( instance, - JSCompiler_object_inline_componentStack_2300 + JSCompiler_object_inline_componentStack_2313 )) - : ((JSCompiler_object_inline_componentStack_2300 = + : ((JSCompiler_object_inline_componentStack_2313 = createFiberFromFragment( - JSCompiler_object_inline_componentStack_2300, - JSCompiler_object_inline_message_2297, + JSCompiler_object_inline_componentStack_2313, + JSCompiler_object_inline_message_2310, renderLanes, null )), - (JSCompiler_object_inline_componentStack_2300.flags |= 2)), - (JSCompiler_object_inline_componentStack_2300.return = + (JSCompiler_object_inline_componentStack_2313.flags |= 2)), + (JSCompiler_object_inline_componentStack_2313.return = workInProgress), - (JSCompiler_object_inline_stack_2299.return = workInProgress), - (JSCompiler_object_inline_stack_2299.sibling = - JSCompiler_object_inline_componentStack_2300), - (workInProgress.child = JSCompiler_object_inline_stack_2299), - (JSCompiler_object_inline_stack_2299 = - JSCompiler_object_inline_componentStack_2300), - (JSCompiler_object_inline_componentStack_2300 = workInProgress.child), - (JSCompiler_object_inline_message_2297 = current.child.memoizedState), - null === JSCompiler_object_inline_message_2297 - ? (JSCompiler_object_inline_message_2297 = + (JSCompiler_object_inline_stack_2312.return = workInProgress), + (JSCompiler_object_inline_stack_2312.sibling = + JSCompiler_object_inline_componentStack_2313), + (workInProgress.child = JSCompiler_object_inline_stack_2312), + (JSCompiler_object_inline_stack_2312 = + JSCompiler_object_inline_componentStack_2313), + (JSCompiler_object_inline_componentStack_2313 = workInProgress.child), + (JSCompiler_object_inline_message_2310 = current.child.memoizedState), + null === JSCompiler_object_inline_message_2310 + ? (JSCompiler_object_inline_message_2310 = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = - JSCompiler_object_inline_message_2297.cachePool), + JSCompiler_object_inline_message_2310.cachePool), null !== JSCompiler_temp ? ((instance = CacheContext._currentValue), (JSCompiler_temp = @@ -9053,37 +9073,37 @@ ? { parent: instance, pool: instance } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), - (JSCompiler_object_inline_message_2297 = { + (JSCompiler_object_inline_message_2310 = { baseLanes: - JSCompiler_object_inline_message_2297.baseLanes | renderLanes, + JSCompiler_object_inline_message_2310.baseLanes | renderLanes, cachePool: JSCompiler_temp })), - (JSCompiler_object_inline_componentStack_2300.memoizedState = - JSCompiler_object_inline_message_2297), - (JSCompiler_object_inline_componentStack_2300.childLanes = + (JSCompiler_object_inline_componentStack_2313.memoizedState = + JSCompiler_object_inline_message_2310), + (JSCompiler_object_inline_componentStack_2313.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2298, + JSCompiler_object_inline_digest_2311, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2299 + JSCompiler_object_inline_stack_2312 ); pushPrimaryTreeSuspenseHandler(workInProgress); renderLanes = current.child; current = renderLanes.sibling; renderLanes = createWorkInProgress(renderLanes, { mode: "visible", - children: JSCompiler_object_inline_stack_2299.children + children: JSCompiler_object_inline_stack_2312.children }); renderLanes.return = workInProgress; renderLanes.sibling = null; null !== current && - ((JSCompiler_object_inline_digest_2298 = workInProgress.deletions), - null === JSCompiler_object_inline_digest_2298 + ((JSCompiler_object_inline_digest_2311 = workInProgress.deletions), + null === JSCompiler_object_inline_digest_2311 ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) - : JSCompiler_object_inline_digest_2298.push(current)); + : JSCompiler_object_inline_digest_2311.push(current)); workInProgress.child = renderLanes; workInProgress.memoizedState = null; return renderLanes; @@ -14217,7 +14237,7 @@ workInProgressDeferredLane, workInProgressRootDidSkipSuspendedSiblings ); - markRootUpdated(root, lane); + markRootUpdated$1(root, lane); if ( 0 !== (executionContext & RenderContext) && root === workInProgressRoot @@ -14547,18 +14567,6 @@ } return !0; } - function markRootUpdated(root, updatedLanes) { - root.pendingLanes |= updatedLanes; - 268435456 !== updatedLanes && - ((root.suspendedLanes = 0), - (root.pingedLanes = 0), - (root.warmLanes = 0)); - executionContext & RenderContext - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & CommitContext && - (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); - } function markRootSuspended( root, suspendedLanes, @@ -15211,13 +15219,13 @@ ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); if ((executionContext & (RenderContext | CommitContext)) !== NoContext) throw Error("Should not already be working."); - var finishedWork = root.finishedWork, - lanes = root.finishedLanes; + var finishedWork = root.finishedWork; + didIncludeRenderPhaseUpdate = root.finishedLanes; null !== injectedProfilingHooks && "function" === typeof injectedProfilingHooks.markCommitStarted && - injectedProfilingHooks.markCommitStarted(lanes); + injectedProfilingHooks.markCommitStarted(didIncludeRenderPhaseUpdate); if (null === finishedWork) return markCommitStopped(), null; - 0 === lanes && + 0 === didIncludeRenderPhaseUpdate && console.error( "root.finishedLanes should not be empty during a commit. This is a bug in React." ); @@ -15234,13 +15242,12 @@ remainingLanes |= concurrentlyUpdatedLanes; markRootFinished( root, - lanes, + didIncludeRenderPhaseUpdate, remainingLanes, spawnedLane, updatedLanes, suspendedRetryLanes ); - didIncludeCommitPhaseUpdate = !1; root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -15264,7 +15271,11 @@ (updatedLanes = executionContext), (executionContext |= CommitContext), commitBeforeMutationEffects(root, finishedWork), - commitMutationEffects(root, finishedWork, lanes), + commitMutationEffects( + root, + finishedWork, + didIncludeRenderPhaseUpdate + ), restoreSelection(selectionInformation, root.containerInfo), (_enabled = !!eventsEnabled), (selectionInformation = eventsEnabled = null), @@ -15272,8 +15283,10 @@ null !== injectedProfilingHooks && "function" === typeof injectedProfilingHooks.markLayoutEffectsStarted && - injectedProfilingHooks.markLayoutEffectsStarted(lanes), - commitLayoutEffects(finishedWork, root, lanes), + injectedProfilingHooks.markLayoutEffectsStarted( + didIncludeRenderPhaseUpdate + ), + commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate), null !== injectedProfilingHooks && "function" === typeof injectedProfilingHooks.markLayoutEffectsStopped && @@ -15286,7 +15299,7 @@ (transitions = rootDoesHavePassiveEffects) ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = lanes)) + (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) : (releaseRootPooledCache(root, remainingLanes), (nestedPassiveUpdateCount = 0), (rootWithPassiveNestedUpdates = null)); @@ -15313,9 +15326,8 @@ ); 0 !== (pendingPassiveEffectsLanes & 3) && flushPassiveEffects(); remainingLanes = root.pendingLanes; - didIncludeRenderPhaseUpdate || - didIncludeCommitPhaseUpdate || - (0 !== (lanes & 4194218) && 0 !== (remainingLanes & 42)) + 0 !== (didIncludeRenderPhaseUpdate & 4194218) && + 0 !== (remainingLanes & 42) ? ((nestedUpdateScheduled = !0), root === rootWithNestedUpdates ? nestedUpdateCount++ @@ -15436,7 +15448,7 @@ sourceFiber = createRootErrorUpdate(rootFiber.stateNode, sourceFiber, 2); rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); null !== rootFiber && - (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); + (markRootUpdated$1(rootFiber, 2), ensureRootIsScheduled(rootFiber)); } function captureCommitPhaseError( sourceFiber, @@ -15475,7 +15487,7 @@ nearestMountedAncestor, sourceFiber ), - markRootUpdated(instance, 2), + markRootUpdated$1(instance, 2), ensureRootIsScheduled(instance)); return; } @@ -15510,11 +15522,6 @@ null !== pingCache && pingCache.delete(wakeable); root.pingedLanes |= root.suspendedLanes & pingedLanes; root.warmLanes &= ~pingedLanes; - executionContext & RenderContext - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & CommitContext && - (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); isConcurrentActEnvironment() && null === ReactSharedInternals.actQueue && console.error( @@ -15538,7 +15545,7 @@ 0 === retryLane && (retryLane = claimNextRetryLane()); boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); null !== boundaryFiber && - (markRootUpdated(boundaryFiber, retryLane), + (markRootUpdated$1(boundaryFiber, retryLane), ensureRootIsScheduled(boundaryFiber)); } function retryDehydratedSuspenseBoundary(boundaryFiber) { @@ -15569,26 +15576,6 @@ null !== retryCache && retryCache.delete(wakeable); retryTimedOutBoundary(boundaryFiber, retryLane); } - function throwIfInfiniteUpdateLoopDetected() { - if (nestedUpdateCount > NESTED_UPDATE_LIMIT) - throw ( - ((nestedPassiveUpdateCount = nestedUpdateCount = 0), - (rootWithPassiveNestedUpdates = rootWithNestedUpdates = null), - executionContext & RenderContext && - null !== workInProgressRoot && - (workInProgressRoot.errorRecoveryDisabledLanes |= - workInProgressRootRenderLanes), - Error( - "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." - )) - ); - nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT && - ((nestedPassiveUpdateCount = 0), - (rootWithPassiveNestedUpdates = null), - console.error( - "Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render." - )); - } function recursivelyTraverseAndDoubleInvokeEffectsInDEV( root$jscomp$0, parentFiber, @@ -23897,7 +23884,6 @@ workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, workInProgressRootDidIncludeRecursiveRenderUpdate = !1, - didIncludeCommitPhaseUpdate = !1, globalMostRecentFallbackTime = 0, FALLBACK_THROTTLE_MS = 300, workInProgressRootRenderTargetTime = Infinity, @@ -23909,12 +23895,12 @@ pendingPassiveEffectsLanes = 0, pendingPassiveEffectsRemainingLanes = 0, pendingPassiveTransitions = null, - NESTED_UPDATE_LIMIT = 100, + NESTED_UPDATE_LIMIT = 50, nestedUpdateCount = 0, rootWithNestedUpdates = null, isFlushingPassiveEffects = !1, didScheduleUpdateDuringPassiveEffects = !1, - NESTED_PASSIVE_UPDATE_LIMIT = 100, + NESTED_PASSIVE_UPDATE_LIMIT = 50, nestedPassiveUpdateCount = 0, rootWithPassiveNestedUpdates = null, isRunningInsertionEffect = !1, @@ -24465,11 +24451,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-2d16326d-20240930" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-1460d67c-20241003" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -24506,11 +24492,11 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-rc-2d16326d-20240930", + version: "19.0.0-rc-1460d67c-20241003", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-rc-2d16326d-20240930" + reconcilerVersion: "19.0.0-rc-1460d67c-20241003" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -24648,13 +24634,13 @@ identifierPrefix.callback = null; enqueueUpdate(options, identifierPrefix, isStrictMode); initialChildren.current.lanes = isStrictMode; - markRootUpdated(initialChildren, isStrictMode); + markRootUpdated$1(initialChildren, isStrictMode); ensureRootIsScheduled(initialChildren); container[internalContainerInstanceKey] = initialChildren.current; listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; - exports.version = "19.0.0-rc-2d16326d-20240930"; + exports.version = "19.0.0-rc-1460d67c-20241003"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-client.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-client.production.js index dfa20385a8fb0..240d545ae3497 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-client.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-client.production.js @@ -689,6 +689,11 @@ function createLaneMap(initial) { for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; } +function markRootUpdated$1(root, updateLane) { + root.pendingLanes |= updateLane; + 268435456 !== updateLane && + ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); +} function markRootFinished( root, finishedLanes, @@ -2396,7 +2401,12 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { - throwIfInfiniteUpdateLoopDetected(); + if (50 < nestedUpdateCount) + throw ( + ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))) + ); for (var parent = sourceFiber.return; null !== parent; ) (sourceFiber = parent), (parent = sourceFiber.return); return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; @@ -10177,7 +10187,6 @@ var DefaultAsyncDispatcher = { workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, workInProgressRootDidIncludeRecursiveRenderUpdate = !1, - didIncludeCommitPhaseUpdate = !1, globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, workInProgressTransitions = null, @@ -10220,7 +10229,7 @@ function scheduleUpdateOnFiber(root, fiber, lane) { workInProgressDeferredLane, workInProgressRootDidSkipSuspendedSiblings ); - markRootUpdated(root, lane); + markRootUpdated$1(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) root === workInProgressRoot && (0 === (executionContext & 2) && @@ -10499,15 +10508,6 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootUpdated(root, updatedLanes) { - root.pendingLanes |= updatedLanes; - 268435456 !== updatedLanes && - ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); - executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); -} function markRootSuspended( root, suspendedLanes, @@ -11001,8 +11001,8 @@ function commitRootImpl( do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); - var finishedWork = root.finishedWork, - lanes = root.finishedLanes; + var finishedWork = root.finishedWork; + didIncludeRenderPhaseUpdate = root.finishedLanes; if (null === finishedWork) return null; root.finishedWork = null; root.finishedLanes = 0; @@ -11014,13 +11014,12 @@ function commitRootImpl( remainingLanes |= concurrentlyUpdatedLanes; markRootFinished( root, - lanes, + didIncludeRenderPhaseUpdate, remainingLanes, spawnedLane, updatedLanes, suspendedRetryLanes ); - didIncludeCommitPhaseUpdate = !1; root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -11057,7 +11056,7 @@ function commitRootImpl( rootDoesHavePassiveEffects ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = lanes)) + (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) : releaseRootPooledCache(root, remainingLanes); remainingLanes = root.pendingLanes; 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); @@ -11075,9 +11074,7 @@ function commitRootImpl( }); 0 !== (pendingPassiveEffectsLanes & 3) && flushPassiveEffects(); remainingLanes = root.pendingLanes; - didIncludeRenderPhaseUpdate || - didIncludeCommitPhaseUpdate || - (0 !== (lanes & 4194218) && 0 !== (remainingLanes & 42)) + 0 !== (didIncludeRenderPhaseUpdate & 4194218) && 0 !== (remainingLanes & 42) ? root === rootWithNestedUpdates ? nestedUpdateCount++ : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root)) @@ -11142,7 +11139,7 @@ function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { sourceFiber = createRootErrorUpdate(rootFiber.stateNode, sourceFiber, 2); rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); null !== rootFiber && - (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); + (markRootUpdated$1(rootFiber, 2), ensureRootIsScheduled(rootFiber)); } function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { if (3 === sourceFiber.tag) @@ -11175,7 +11172,7 @@ function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { nearestMountedAncestor, sourceFiber ), - markRootUpdated(instance, 2), + markRootUpdated$1(instance, 2), ensureRootIsScheduled(instance)); break; } @@ -11204,10 +11201,6 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { null !== pingCache && pingCache.delete(wakeable); root.pingedLanes |= root.suspendedLanes & pingedLanes; root.warmLanes &= ~pingedLanes; - executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); workInProgressRoot === root && (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || @@ -11225,7 +11218,7 @@ function retryTimedOutBoundary(boundaryFiber, retryLane) { 0 === retryLane && (retryLane = claimNextRetryLane()); boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); null !== boundaryFiber && - (markRootUpdated(boundaryFiber, retryLane), + (markRootUpdated$1(boundaryFiber, retryLane), ensureRootIsScheduled(boundaryFiber)); } function retryDehydratedSuspenseBoundary(boundaryFiber) { @@ -11254,18 +11247,6 @@ function resolveRetryWakeable(boundaryFiber, wakeable) { null !== retryCache && retryCache.delete(wakeable); retryTimedOutBoundary(boundaryFiber, retryLane); } -function throwIfInfiniteUpdateLoopDetected() { - if (100 < nestedUpdateCount) - throw ( - ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - executionContext & 2 && - null !== workInProgressRoot && - (workInProgressRoot.errorRecoveryDisabledLanes |= - workInProgressRootRenderLanes), - Error(formatProdErrorMessage(185))) - ); -} function scheduleCallback$1(priorityLevel, callback) { return scheduleCallback$3(priorityLevel, callback); } @@ -11552,20 +11533,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1419 = 0; - i$jscomp$inline_1419 < simpleEventPluginEvents.length; - i$jscomp$inline_1419++ + var i$jscomp$inline_1432 = 0; + i$jscomp$inline_1432 < simpleEventPluginEvents.length; + i$jscomp$inline_1432++ ) { - var eventName$jscomp$inline_1420 = - simpleEventPluginEvents[i$jscomp$inline_1419], - domEventName$jscomp$inline_1421 = - eventName$jscomp$inline_1420.toLowerCase(), - capitalizedEvent$jscomp$inline_1422 = - eventName$jscomp$inline_1420[0].toUpperCase() + - eventName$jscomp$inline_1420.slice(1); + var eventName$jscomp$inline_1433 = + simpleEventPluginEvents[i$jscomp$inline_1432], + domEventName$jscomp$inline_1434 = + eventName$jscomp$inline_1433.toLowerCase(), + capitalizedEvent$jscomp$inline_1435 = + eventName$jscomp$inline_1433[0].toUpperCase() + + eventName$jscomp$inline_1433.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1421, - "on" + capitalizedEvent$jscomp$inline_1422 + domEventName$jscomp$inline_1434, + "on" + capitalizedEvent$jscomp$inline_1435 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -15006,16 +14987,16 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { 0 === i && attemptExplicitHydrationTarget(target); } }; -var isomorphicReactPackageVersion$jscomp$inline_1666 = React.version; +var isomorphicReactPackageVersion$jscomp$inline_1679 = React.version; if ( - "19.0.0-rc-2d16326d-20240930" !== - isomorphicReactPackageVersion$jscomp$inline_1666 + "19.0.0-rc-1460d67c-20241003" !== + isomorphicReactPackageVersion$jscomp$inline_1679 ) throw Error( formatProdErrorMessage( 527, - isomorphicReactPackageVersion$jscomp$inline_1666, - "19.0.0-rc-2d16326d-20240930" + isomorphicReactPackageVersion$jscomp$inline_1679, + "19.0.0-rc-1460d67c-20241003" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15035,25 +15016,25 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { null === componentOrElement ? null : componentOrElement.stateNode; return componentOrElement; }; -var internals$jscomp$inline_2137 = { +var internals$jscomp$inline_2150 = { bundleType: 0, - version: "19.0.0-rc-2d16326d-20240930", + version: "19.0.0-rc-1460d67c-20241003", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-rc-2d16326d-20240930" + reconcilerVersion: "19.0.0-rc-1460d67c-20241003" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2138 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2151 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2138.isDisabled && - hook$jscomp$inline_2138.supportsFiber + !hook$jscomp$inline_2151.isDisabled && + hook$jscomp$inline_2151.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2138.inject( - internals$jscomp$inline_2137 + (rendererID = hook$jscomp$inline_2151.inject( + internals$jscomp$inline_2150 )), - (injectedHook = hook$jscomp$inline_2138); + (injectedHook = hook$jscomp$inline_2151); } catch (err) {} } exports.createRoot = function (container, options) { @@ -15139,10 +15120,10 @@ exports.hydrateRoot = function (container, initialChildren, options) { identifierPrefix.callback = null; enqueueUpdate(options, identifierPrefix, isStrictMode); initialChildren.current.lanes = isStrictMode; - markRootUpdated(initialChildren, isStrictMode); + markRootUpdated$1(initialChildren, isStrictMode); ensureRootIsScheduled(initialChildren); container[internalContainerInstanceKey] = initialChildren.current; listenToAllSupportedEvents(container); return new ReactDOMHydrationRoot(initialChildren); }; -exports.version = "19.0.0-rc-2d16326d-20240930"; +exports.version = "19.0.0-rc-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.development.js index 8106f302b219a..f49070a752ded 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.development.js @@ -1105,6 +1105,13 @@ for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; } + function markRootUpdated$1(root, updateLane) { + root.pendingLanes |= updateLane; + 268435456 !== updateLane && + ((root.suspendedLanes = 0), + (root.pingedLanes = 0), + (root.warmLanes = 0)); + } function markRootFinished( root, finishedLanes, @@ -3783,7 +3790,20 @@ (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { - throwIfInfiniteUpdateLoopDetected(); + if (nestedUpdateCount > NESTED_UPDATE_LIMIT) + throw ( + ((nestedPassiveUpdateCount = nestedUpdateCount = 0), + (rootWithPassiveNestedUpdates = rootWithNestedUpdates = null), + Error( + "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." + )) + ); + nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT && + ((nestedPassiveUpdateCount = 0), + (rootWithPassiveNestedUpdates = null), + console.error( + "Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render." + )); null === sourceFiber.alternate && 0 !== (sourceFiber.flags & 4098) && warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); @@ -8636,32 +8656,32 @@ return current; } function updateSuspenseComponent(current, workInProgress, renderLanes) { - var JSCompiler_object_inline_digest_2303; - var JSCompiler_object_inline_stack_2304 = workInProgress.pendingProps; + var JSCompiler_object_inline_digest_2316; + var JSCompiler_object_inline_stack_2317 = workInProgress.pendingProps; shouldSuspendImpl(workInProgress) && (workInProgress.flags |= 128); - var JSCompiler_object_inline_componentStack_2305 = !1; + var JSCompiler_object_inline_componentStack_2318 = !1; var didSuspend = 0 !== (workInProgress.flags & 128); - (JSCompiler_object_inline_digest_2303 = didSuspend) || - (JSCompiler_object_inline_digest_2303 = + (JSCompiler_object_inline_digest_2316 = didSuspend) || + (JSCompiler_object_inline_digest_2316 = null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseStackCursor.current & ForceSuspenseFallback)); - JSCompiler_object_inline_digest_2303 && - ((JSCompiler_object_inline_componentStack_2305 = !0), + JSCompiler_object_inline_digest_2316 && + ((JSCompiler_object_inline_componentStack_2318 = !0), (workInProgress.flags &= -129)); - JSCompiler_object_inline_digest_2303 = 0 !== (workInProgress.flags & 32); + JSCompiler_object_inline_digest_2316 = 0 !== (workInProgress.flags & 32); workInProgress.flags &= -33; if (null === current) { if (isHydrating) { - JSCompiler_object_inline_componentStack_2305 + JSCompiler_object_inline_componentStack_2318 ? pushPrimaryTreeSuspenseHandler(workInProgress) : reuseSuspenseHandlerOnStack(workInProgress); if (isHydrating) { - var JSCompiler_object_inline_message_2302 = nextHydratableInstance; + var JSCompiler_object_inline_message_2315 = nextHydratableInstance; var JSCompiler_temp; - if (!(JSCompiler_temp = !JSCompiler_object_inline_message_2302)) { + if (!(JSCompiler_temp = !JSCompiler_object_inline_message_2315)) { c: { - var instance = JSCompiler_object_inline_message_2302; + var instance = JSCompiler_object_inline_message_2315; for ( JSCompiler_temp = rootOrSingletonContext; 8 !== instance.nodeType; @@ -8702,19 +8722,19 @@ JSCompiler_temp && (warnNonHydratedInstance( workInProgress, - JSCompiler_object_inline_message_2302 + JSCompiler_object_inline_message_2315 ), throwOnHydrationMismatch(workInProgress)); } - JSCompiler_object_inline_message_2302 = workInProgress.memoizedState; + JSCompiler_object_inline_message_2315 = workInProgress.memoizedState; if ( - null !== JSCompiler_object_inline_message_2302 && - ((JSCompiler_object_inline_message_2302 = - JSCompiler_object_inline_message_2302.dehydrated), - null !== JSCompiler_object_inline_message_2302) + null !== JSCompiler_object_inline_message_2315 && + ((JSCompiler_object_inline_message_2315 = + JSCompiler_object_inline_message_2315.dehydrated), + null !== JSCompiler_object_inline_message_2315) ) return ( - JSCompiler_object_inline_message_2302.data === + JSCompiler_object_inline_message_2315.data === SUSPENSE_FALLBACK_START_DATA ? (workInProgress.lanes = 16) : (workInProgress.lanes = 536870912), @@ -8722,58 +8742,58 @@ ); popSuspenseHandler(workInProgress); } - JSCompiler_object_inline_message_2302 = - JSCompiler_object_inline_stack_2304.children; - JSCompiler_object_inline_stack_2304 = - JSCompiler_object_inline_stack_2304.fallback; - if (JSCompiler_object_inline_componentStack_2305) + JSCompiler_object_inline_message_2315 = + JSCompiler_object_inline_stack_2317.children; + JSCompiler_object_inline_stack_2317 = + JSCompiler_object_inline_stack_2317.fallback; + if (JSCompiler_object_inline_componentStack_2318) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2305 = + (JSCompiler_object_inline_componentStack_2318 = workInProgress.mode), - (JSCompiler_object_inline_message_2302 = + (JSCompiler_object_inline_message_2315 = mountWorkInProgressOffscreenFiber( { mode: "hidden", - children: JSCompiler_object_inline_message_2302 + children: JSCompiler_object_inline_message_2315 }, - JSCompiler_object_inline_componentStack_2305 + JSCompiler_object_inline_componentStack_2318 )), - (JSCompiler_object_inline_stack_2304 = createFiberFromFragment( - JSCompiler_object_inline_stack_2304, - JSCompiler_object_inline_componentStack_2305, + (JSCompiler_object_inline_stack_2317 = createFiberFromFragment( + JSCompiler_object_inline_stack_2317, + JSCompiler_object_inline_componentStack_2318, renderLanes, null )), - (JSCompiler_object_inline_message_2302.return = workInProgress), - (JSCompiler_object_inline_stack_2304.return = workInProgress), - (JSCompiler_object_inline_message_2302.sibling = - JSCompiler_object_inline_stack_2304), - (workInProgress.child = JSCompiler_object_inline_message_2302), - (JSCompiler_object_inline_componentStack_2305 = + (JSCompiler_object_inline_message_2315.return = workInProgress), + (JSCompiler_object_inline_stack_2317.return = workInProgress), + (JSCompiler_object_inline_message_2315.sibling = + JSCompiler_object_inline_stack_2317), + (workInProgress.child = JSCompiler_object_inline_message_2315), + (JSCompiler_object_inline_componentStack_2318 = workInProgress.child), - (JSCompiler_object_inline_componentStack_2305.memoizedState = + (JSCompiler_object_inline_componentStack_2318.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_componentStack_2305.childLanes = + (JSCompiler_object_inline_componentStack_2318.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2303, + JSCompiler_object_inline_digest_2316, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2304 + JSCompiler_object_inline_stack_2317 ); pushPrimaryTreeSuspenseHandler(workInProgress); return mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_message_2302 + JSCompiler_object_inline_message_2315 ); } var prevState = current.memoizedState; if ( null !== prevState && - ((JSCompiler_object_inline_message_2302 = prevState.dehydrated), - null !== JSCompiler_object_inline_message_2302) + ((JSCompiler_object_inline_message_2315 = prevState.dehydrated), + null !== JSCompiler_object_inline_message_2315) ) { if (didSuspend) workInProgress.flags & 256 @@ -8790,94 +8810,94 @@ (workInProgress.flags |= 128), (workInProgress = null)) : (reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2305 = - JSCompiler_object_inline_stack_2304.fallback), - (JSCompiler_object_inline_message_2302 = workInProgress.mode), - (JSCompiler_object_inline_stack_2304 = + (JSCompiler_object_inline_componentStack_2318 = + JSCompiler_object_inline_stack_2317.fallback), + (JSCompiler_object_inline_message_2315 = workInProgress.mode), + (JSCompiler_object_inline_stack_2317 = mountWorkInProgressOffscreenFiber( { mode: "visible", - children: JSCompiler_object_inline_stack_2304.children + children: JSCompiler_object_inline_stack_2317.children }, - JSCompiler_object_inline_message_2302 + JSCompiler_object_inline_message_2315 )), - (JSCompiler_object_inline_componentStack_2305 = + (JSCompiler_object_inline_componentStack_2318 = createFiberFromFragment( - JSCompiler_object_inline_componentStack_2305, - JSCompiler_object_inline_message_2302, + JSCompiler_object_inline_componentStack_2318, + JSCompiler_object_inline_message_2315, renderLanes, null )), - (JSCompiler_object_inline_componentStack_2305.flags |= 2), - (JSCompiler_object_inline_stack_2304.return = workInProgress), - (JSCompiler_object_inline_componentStack_2305.return = + (JSCompiler_object_inline_componentStack_2318.flags |= 2), + (JSCompiler_object_inline_stack_2317.return = workInProgress), + (JSCompiler_object_inline_componentStack_2318.return = workInProgress), - (JSCompiler_object_inline_stack_2304.sibling = - JSCompiler_object_inline_componentStack_2305), - (workInProgress.child = JSCompiler_object_inline_stack_2304), + (JSCompiler_object_inline_stack_2317.sibling = + JSCompiler_object_inline_componentStack_2318), + (workInProgress.child = JSCompiler_object_inline_stack_2317), reconcileChildFibers( workInProgress, current.child, null, renderLanes ), - (JSCompiler_object_inline_stack_2304 = workInProgress.child), - (JSCompiler_object_inline_stack_2304.memoizedState = + (JSCompiler_object_inline_stack_2317 = workInProgress.child), + (JSCompiler_object_inline_stack_2317.memoizedState = mountSuspenseOffscreenState(renderLanes)), - (JSCompiler_object_inline_stack_2304.childLanes = + (JSCompiler_object_inline_stack_2317.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2303, + JSCompiler_object_inline_digest_2316, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), (workInProgress = - JSCompiler_object_inline_componentStack_2305)); + JSCompiler_object_inline_componentStack_2318)); else if ( (pushPrimaryTreeSuspenseHandler(workInProgress), isHydrating && console.error( "We should not be hydrating here. This is a bug in React. Please file a bug." ), - JSCompiler_object_inline_message_2302.data === + JSCompiler_object_inline_message_2315.data === SUSPENSE_FALLBACK_START_DATA) ) { - JSCompiler_object_inline_digest_2303 = - JSCompiler_object_inline_message_2302.nextSibling && - JSCompiler_object_inline_message_2302.nextSibling.dataset; - if (JSCompiler_object_inline_digest_2303) { - JSCompiler_temp = JSCompiler_object_inline_digest_2303.dgst; - var message = JSCompiler_object_inline_digest_2303.msg; - instance = JSCompiler_object_inline_digest_2303.stck; - var componentStack = JSCompiler_object_inline_digest_2303.cstck; + JSCompiler_object_inline_digest_2316 = + JSCompiler_object_inline_message_2315.nextSibling && + JSCompiler_object_inline_message_2315.nextSibling.dataset; + if (JSCompiler_object_inline_digest_2316) { + JSCompiler_temp = JSCompiler_object_inline_digest_2316.dgst; + var message = JSCompiler_object_inline_digest_2316.msg; + instance = JSCompiler_object_inline_digest_2316.stck; + var componentStack = JSCompiler_object_inline_digest_2316.cstck; } - JSCompiler_object_inline_message_2302 = message; - JSCompiler_object_inline_digest_2303 = JSCompiler_temp; - JSCompiler_object_inline_stack_2304 = instance; - JSCompiler_object_inline_componentStack_2305 = componentStack; - JSCompiler_object_inline_message_2302 = - JSCompiler_object_inline_message_2302 - ? Error(JSCompiler_object_inline_message_2302) + JSCompiler_object_inline_message_2315 = message; + JSCompiler_object_inline_digest_2316 = JSCompiler_temp; + JSCompiler_object_inline_stack_2317 = instance; + JSCompiler_object_inline_componentStack_2318 = componentStack; + JSCompiler_object_inline_message_2315 = + JSCompiler_object_inline_message_2315 + ? Error(JSCompiler_object_inline_message_2315) : Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." ); - JSCompiler_object_inline_message_2302.stack = - JSCompiler_object_inline_stack_2304 || ""; - JSCompiler_object_inline_message_2302.digest = - JSCompiler_object_inline_digest_2303; - JSCompiler_object_inline_digest_2303 = - void 0 === JSCompiler_object_inline_componentStack_2305 + JSCompiler_object_inline_message_2315.stack = + JSCompiler_object_inline_stack_2317 || ""; + JSCompiler_object_inline_message_2315.digest = + JSCompiler_object_inline_digest_2316; + JSCompiler_object_inline_digest_2316 = + void 0 === JSCompiler_object_inline_componentStack_2318 ? null - : JSCompiler_object_inline_componentStack_2305; - "string" === typeof JSCompiler_object_inline_digest_2303 && + : JSCompiler_object_inline_componentStack_2318; + "string" === typeof JSCompiler_object_inline_digest_2316 && CapturedStacks.set( - JSCompiler_object_inline_message_2302, - JSCompiler_object_inline_digest_2303 + JSCompiler_object_inline_message_2315, + JSCompiler_object_inline_digest_2316 ); queueHydrationError({ - value: JSCompiler_object_inline_message_2302, + value: JSCompiler_object_inline_message_2315, source: null, - stack: JSCompiler_object_inline_digest_2303 + stack: JSCompiler_object_inline_digest_2316 }); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -8892,25 +8912,25 @@ renderLanes, !1 ), - (JSCompiler_object_inline_digest_2303 = + (JSCompiler_object_inline_digest_2316 = 0 !== (renderLanes & current.childLanes)), - didReceiveUpdate || JSCompiler_object_inline_digest_2303) + didReceiveUpdate || JSCompiler_object_inline_digest_2316) ) { - JSCompiler_object_inline_digest_2303 = workInProgressRoot; - if (null !== JSCompiler_object_inline_digest_2303) { - JSCompiler_object_inline_stack_2304 = renderLanes & -renderLanes; - if (0 !== (JSCompiler_object_inline_stack_2304 & 42)) - JSCompiler_object_inline_stack_2304 = 1; + JSCompiler_object_inline_digest_2316 = workInProgressRoot; + if (null !== JSCompiler_object_inline_digest_2316) { + JSCompiler_object_inline_stack_2317 = renderLanes & -renderLanes; + if (0 !== (JSCompiler_object_inline_stack_2317 & 42)) + JSCompiler_object_inline_stack_2317 = 1; else - switch (JSCompiler_object_inline_stack_2304) { + switch (JSCompiler_object_inline_stack_2317) { case 2: - JSCompiler_object_inline_stack_2304 = 1; + JSCompiler_object_inline_stack_2317 = 1; break; case 8: - JSCompiler_object_inline_stack_2304 = 4; + JSCompiler_object_inline_stack_2317 = 4; break; case 32: - JSCompiler_object_inline_stack_2304 = 16; + JSCompiler_object_inline_stack_2317 = 16; break; case 128: case 256: @@ -8931,40 +8951,40 @@ case 8388608: case 16777216: case 33554432: - JSCompiler_object_inline_stack_2304 = 64; + JSCompiler_object_inline_stack_2317 = 64; break; case 268435456: - JSCompiler_object_inline_stack_2304 = 134217728; + JSCompiler_object_inline_stack_2317 = 134217728; break; default: - JSCompiler_object_inline_stack_2304 = 0; + JSCompiler_object_inline_stack_2317 = 0; } - JSCompiler_object_inline_stack_2304 = + JSCompiler_object_inline_stack_2317 = 0 !== - (JSCompiler_object_inline_stack_2304 & - (JSCompiler_object_inline_digest_2303.suspendedLanes | + (JSCompiler_object_inline_stack_2317 & + (JSCompiler_object_inline_digest_2316.suspendedLanes | renderLanes)) ? 0 - : JSCompiler_object_inline_stack_2304; + : JSCompiler_object_inline_stack_2317; if ( - 0 !== JSCompiler_object_inline_stack_2304 && - JSCompiler_object_inline_stack_2304 !== prevState.retryLane + 0 !== JSCompiler_object_inline_stack_2317 && + JSCompiler_object_inline_stack_2317 !== prevState.retryLane ) throw ( - ((prevState.retryLane = JSCompiler_object_inline_stack_2304), + ((prevState.retryLane = JSCompiler_object_inline_stack_2317), enqueueConcurrentRenderForLane( current, - JSCompiler_object_inline_stack_2304 + JSCompiler_object_inline_stack_2317 ), scheduleUpdateOnFiber( - JSCompiler_object_inline_digest_2303, + JSCompiler_object_inline_digest_2316, current, - JSCompiler_object_inline_stack_2304 + JSCompiler_object_inline_stack_2317 ), SelectiveHydrationException) ); } - JSCompiler_object_inline_message_2302.data === + JSCompiler_object_inline_message_2315.data === SUSPENSE_PENDING_START_DATA || renderDidSuspendDelayIfPossible(); workInProgress = retrySuspenseComponentWithoutHydrating( current, @@ -8972,7 +8992,7 @@ renderLanes ); } else - JSCompiler_object_inline_message_2302.data === + JSCompiler_object_inline_message_2315.data === SUSPENSE_PENDING_START_DATA ? ((workInProgress.flags |= 128), (workInProgress.child = current.child), @@ -8980,12 +9000,12 @@ null, current )), - (JSCompiler_object_inline_message_2302._reactRetry = + (JSCompiler_object_inline_message_2315._reactRetry = workInProgress), (workInProgress = null)) : ((current = prevState.treeContext), (nextHydratableInstance = getNextHydratable( - JSCompiler_object_inline_message_2302.nextSibling + JSCompiler_object_inline_message_2315.nextSibling )), (hydrationParentFiber = workInProgress), (isHydrating = !0), @@ -9003,57 +9023,57 @@ (treeContextProvider = workInProgress)), (workInProgress = mountSuspensePrimaryChildren( workInProgress, - JSCompiler_object_inline_stack_2304.children + JSCompiler_object_inline_stack_2317.children )), (workInProgress.flags |= 4096)); return workInProgress; } - if (JSCompiler_object_inline_componentStack_2305) + if (JSCompiler_object_inline_componentStack_2318) return ( reuseSuspenseHandlerOnStack(workInProgress), - (JSCompiler_object_inline_componentStack_2305 = - JSCompiler_object_inline_stack_2304.fallback), - (JSCompiler_object_inline_message_2302 = workInProgress.mode), + (JSCompiler_object_inline_componentStack_2318 = + JSCompiler_object_inline_stack_2317.fallback), + (JSCompiler_object_inline_message_2315 = workInProgress.mode), (JSCompiler_temp = current.child), (instance = JSCompiler_temp.sibling), - (JSCompiler_object_inline_stack_2304 = createWorkInProgress( + (JSCompiler_object_inline_stack_2317 = createWorkInProgress( JSCompiler_temp, { mode: "hidden", - children: JSCompiler_object_inline_stack_2304.children + children: JSCompiler_object_inline_stack_2317.children } )), - (JSCompiler_object_inline_stack_2304.subtreeFlags = + (JSCompiler_object_inline_stack_2317.subtreeFlags = JSCompiler_temp.subtreeFlags & 31457280), null !== instance - ? (JSCompiler_object_inline_componentStack_2305 = + ? (JSCompiler_object_inline_componentStack_2318 = createWorkInProgress( instance, - JSCompiler_object_inline_componentStack_2305 + JSCompiler_object_inline_componentStack_2318 )) - : ((JSCompiler_object_inline_componentStack_2305 = + : ((JSCompiler_object_inline_componentStack_2318 = createFiberFromFragment( - JSCompiler_object_inline_componentStack_2305, - JSCompiler_object_inline_message_2302, + JSCompiler_object_inline_componentStack_2318, + JSCompiler_object_inline_message_2315, renderLanes, null )), - (JSCompiler_object_inline_componentStack_2305.flags |= 2)), - (JSCompiler_object_inline_componentStack_2305.return = + (JSCompiler_object_inline_componentStack_2318.flags |= 2)), + (JSCompiler_object_inline_componentStack_2318.return = workInProgress), - (JSCompiler_object_inline_stack_2304.return = workInProgress), - (JSCompiler_object_inline_stack_2304.sibling = - JSCompiler_object_inline_componentStack_2305), - (workInProgress.child = JSCompiler_object_inline_stack_2304), - (JSCompiler_object_inline_stack_2304 = - JSCompiler_object_inline_componentStack_2305), - (JSCompiler_object_inline_componentStack_2305 = workInProgress.child), - (JSCompiler_object_inline_message_2302 = current.child.memoizedState), - null === JSCompiler_object_inline_message_2302 - ? (JSCompiler_object_inline_message_2302 = + (JSCompiler_object_inline_stack_2317.return = workInProgress), + (JSCompiler_object_inline_stack_2317.sibling = + JSCompiler_object_inline_componentStack_2318), + (workInProgress.child = JSCompiler_object_inline_stack_2317), + (JSCompiler_object_inline_stack_2317 = + JSCompiler_object_inline_componentStack_2318), + (JSCompiler_object_inline_componentStack_2318 = workInProgress.child), + (JSCompiler_object_inline_message_2315 = current.child.memoizedState), + null === JSCompiler_object_inline_message_2315 + ? (JSCompiler_object_inline_message_2315 = mountSuspenseOffscreenState(renderLanes)) : ((JSCompiler_temp = - JSCompiler_object_inline_message_2302.cachePool), + JSCompiler_object_inline_message_2315.cachePool), null !== JSCompiler_temp ? ((instance = CacheContext._currentValue), (JSCompiler_temp = @@ -9061,37 +9081,37 @@ ? { parent: instance, pool: instance } : JSCompiler_temp)) : (JSCompiler_temp = getSuspendedCache()), - (JSCompiler_object_inline_message_2302 = { + (JSCompiler_object_inline_message_2315 = { baseLanes: - JSCompiler_object_inline_message_2302.baseLanes | renderLanes, + JSCompiler_object_inline_message_2315.baseLanes | renderLanes, cachePool: JSCompiler_temp })), - (JSCompiler_object_inline_componentStack_2305.memoizedState = - JSCompiler_object_inline_message_2302), - (JSCompiler_object_inline_componentStack_2305.childLanes = + (JSCompiler_object_inline_componentStack_2318.memoizedState = + JSCompiler_object_inline_message_2315), + (JSCompiler_object_inline_componentStack_2318.childLanes = getRemainingWorkInPrimaryTree( current, - JSCompiler_object_inline_digest_2303, + JSCompiler_object_inline_digest_2316, renderLanes )), (workInProgress.memoizedState = SUSPENDED_MARKER), - JSCompiler_object_inline_stack_2304 + JSCompiler_object_inline_stack_2317 ); pushPrimaryTreeSuspenseHandler(workInProgress); renderLanes = current.child; current = renderLanes.sibling; renderLanes = createWorkInProgress(renderLanes, { mode: "visible", - children: JSCompiler_object_inline_stack_2304.children + children: JSCompiler_object_inline_stack_2317.children }); renderLanes.return = workInProgress; renderLanes.sibling = null; null !== current && - ((JSCompiler_object_inline_digest_2303 = workInProgress.deletions), - null === JSCompiler_object_inline_digest_2303 + ((JSCompiler_object_inline_digest_2316 = workInProgress.deletions), + null === JSCompiler_object_inline_digest_2316 ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16)) - : JSCompiler_object_inline_digest_2303.push(current)); + : JSCompiler_object_inline_digest_2316.push(current)); workInProgress.child = renderLanes; workInProgress.memoizedState = null; return renderLanes; @@ -14225,7 +14245,7 @@ workInProgressDeferredLane, workInProgressRootDidSkipSuspendedSiblings ); - markRootUpdated(root, lane); + markRootUpdated$1(root, lane); if ( 0 !== (executionContext & RenderContext) && root === workInProgressRoot @@ -14559,18 +14579,6 @@ } return !0; } - function markRootUpdated(root, updatedLanes) { - root.pendingLanes |= updatedLanes; - 268435456 !== updatedLanes && - ((root.suspendedLanes = 0), - (root.pingedLanes = 0), - (root.warmLanes = 0)); - executionContext & RenderContext - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & CommitContext && - (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); - } function markRootSuspended( root, suspendedLanes, @@ -15223,13 +15231,13 @@ ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); if ((executionContext & (RenderContext | CommitContext)) !== NoContext) throw Error("Should not already be working."); - var finishedWork = root.finishedWork, - lanes = root.finishedLanes; + var finishedWork = root.finishedWork; + didIncludeRenderPhaseUpdate = root.finishedLanes; null !== injectedProfilingHooks && "function" === typeof injectedProfilingHooks.markCommitStarted && - injectedProfilingHooks.markCommitStarted(lanes); + injectedProfilingHooks.markCommitStarted(didIncludeRenderPhaseUpdate); if (null === finishedWork) return markCommitStopped(), null; - 0 === lanes && + 0 === didIncludeRenderPhaseUpdate && console.error( "root.finishedLanes should not be empty during a commit. This is a bug in React." ); @@ -15246,13 +15254,12 @@ remainingLanes |= concurrentlyUpdatedLanes; markRootFinished( root, - lanes, + didIncludeRenderPhaseUpdate, remainingLanes, spawnedLane, updatedLanes, suspendedRetryLanes ); - didIncludeCommitPhaseUpdate = !1; root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -15276,7 +15283,11 @@ (updatedLanes = executionContext), (executionContext |= CommitContext), commitBeforeMutationEffects(root, finishedWork), - commitMutationEffects(root, finishedWork, lanes), + commitMutationEffects( + root, + finishedWork, + didIncludeRenderPhaseUpdate + ), restoreSelection(selectionInformation, root.containerInfo), (_enabled = !!eventsEnabled), (selectionInformation = eventsEnabled = null), @@ -15284,8 +15295,10 @@ null !== injectedProfilingHooks && "function" === typeof injectedProfilingHooks.markLayoutEffectsStarted && - injectedProfilingHooks.markLayoutEffectsStarted(lanes), - commitLayoutEffects(finishedWork, root, lanes), + injectedProfilingHooks.markLayoutEffectsStarted( + didIncludeRenderPhaseUpdate + ), + commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate), null !== injectedProfilingHooks && "function" === typeof injectedProfilingHooks.markLayoutEffectsStopped && @@ -15298,7 +15311,7 @@ (transitions = rootDoesHavePassiveEffects) ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = lanes)) + (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) : (releaseRootPooledCache(root, remainingLanes), (nestedPassiveUpdateCount = 0), (rootWithPassiveNestedUpdates = null)); @@ -15325,9 +15338,8 @@ ); 0 !== (pendingPassiveEffectsLanes & 3) && flushPassiveEffects(); remainingLanes = root.pendingLanes; - didIncludeRenderPhaseUpdate || - didIncludeCommitPhaseUpdate || - (0 !== (lanes & 4194218) && 0 !== (remainingLanes & 42)) + 0 !== (didIncludeRenderPhaseUpdate & 4194218) && + 0 !== (remainingLanes & 42) ? ((nestedUpdateScheduled = !0), root === rootWithNestedUpdates ? nestedUpdateCount++ @@ -15448,7 +15460,7 @@ sourceFiber = createRootErrorUpdate(rootFiber.stateNode, sourceFiber, 2); rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); null !== rootFiber && - (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); + (markRootUpdated$1(rootFiber, 2), ensureRootIsScheduled(rootFiber)); } function captureCommitPhaseError( sourceFiber, @@ -15487,7 +15499,7 @@ nearestMountedAncestor, sourceFiber ), - markRootUpdated(instance, 2), + markRootUpdated$1(instance, 2), ensureRootIsScheduled(instance)); return; } @@ -15522,11 +15534,6 @@ null !== pingCache && pingCache.delete(wakeable); root.pingedLanes |= root.suspendedLanes & pingedLanes; root.warmLanes &= ~pingedLanes; - executionContext & RenderContext - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & CommitContext && - (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); isConcurrentActEnvironment() && null === ReactSharedInternals.actQueue && console.error( @@ -15550,7 +15557,7 @@ 0 === retryLane && (retryLane = claimNextRetryLane()); boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); null !== boundaryFiber && - (markRootUpdated(boundaryFiber, retryLane), + (markRootUpdated$1(boundaryFiber, retryLane), ensureRootIsScheduled(boundaryFiber)); } function retryDehydratedSuspenseBoundary(boundaryFiber) { @@ -15581,26 +15588,6 @@ null !== retryCache && retryCache.delete(wakeable); retryTimedOutBoundary(boundaryFiber, retryLane); } - function throwIfInfiniteUpdateLoopDetected() { - if (nestedUpdateCount > NESTED_UPDATE_LIMIT) - throw ( - ((nestedPassiveUpdateCount = nestedUpdateCount = 0), - (rootWithPassiveNestedUpdates = rootWithNestedUpdates = null), - executionContext & RenderContext && - null !== workInProgressRoot && - (workInProgressRoot.errorRecoveryDisabledLanes |= - workInProgressRootRenderLanes), - Error( - "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." - )) - ); - nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT && - ((nestedPassiveUpdateCount = 0), - (rootWithPassiveNestedUpdates = null), - console.error( - "Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render." - )); - } function recursivelyTraverseAndDoubleInvokeEffectsInDEV( root$jscomp$0, parentFiber, @@ -23954,7 +23941,6 @@ workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, workInProgressRootDidIncludeRecursiveRenderUpdate = !1, - didIncludeCommitPhaseUpdate = !1, globalMostRecentFallbackTime = 0, FALLBACK_THROTTLE_MS = 300, workInProgressRootRenderTargetTime = Infinity, @@ -23966,12 +23952,12 @@ pendingPassiveEffectsLanes = 0, pendingPassiveEffectsRemainingLanes = 0, pendingPassiveTransitions = null, - NESTED_UPDATE_LIMIT = 100, + NESTED_UPDATE_LIMIT = 50, nestedUpdateCount = 0, rootWithNestedUpdates = null, isFlushingPassiveEffects = !1, didScheduleUpdateDuringPassiveEffects = !1, - NESTED_PASSIVE_UPDATE_LIMIT = 100, + NESTED_PASSIVE_UPDATE_LIMIT = 50, nestedPassiveUpdateCount = 0, rootWithPassiveNestedUpdates = null, isRunningInsertionEffect = !1, @@ -24522,11 +24508,11 @@ }; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-2d16326d-20240930" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-1460d67c-20241003" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); ("function" === typeof Map && @@ -24563,11 +24549,11 @@ !(function () { var internals = { bundleType: 1, - version: "19.0.0-rc-2d16326d-20240930", + version: "19.0.0-rc-1460d67c-20241003", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-rc-2d16326d-20240930" + reconcilerVersion: "19.0.0-rc-1460d67c-20241003" }; internals.overrideHookState = overrideHookState; internals.overrideHookStateDeletePath = overrideHookStateDeletePath; @@ -24762,7 +24748,7 @@ identifierPrefix.callback = null; enqueueUpdate(options, identifierPrefix, isStrictMode); initialChildren.current.lanes = isStrictMode; - markRootUpdated(initialChildren, isStrictMode); + markRootUpdated$1(initialChildren, isStrictMode); ensureRootIsScheduled(initialChildren); container[internalContainerInstanceKey] = initialChildren.current; listenToAllSupportedEvents(container); @@ -25041,7 +25027,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-rc-2d16326d-20240930"; + exports.version = "19.0.0-rc-1460d67c-20241003"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.profiling.js b/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.profiling.js index 514d63ba58746..a10203978b3e3 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.profiling.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-profiling.profiling.js @@ -758,6 +758,11 @@ function createLaneMap(initial) { for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; } +function markRootUpdated$1(root, updateLane) { + root.pendingLanes |= updateLane; + 268435456 !== updateLane && + ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); +} function markRootFinished( root, finishedLanes, @@ -2495,7 +2500,12 @@ function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { (update.lane = lane | 536870912)); } function getRootForUpdatedFiber(sourceFiber) { - throwIfInfiniteUpdateLoopDetected(); + if (50 < nestedUpdateCount) + throw ( + ((nestedUpdateCount = 0), + (rootWithNestedUpdates = null), + Error(formatProdErrorMessage(185))) + ); for (var parent = sourceFiber.return; null !== parent; ) (sourceFiber = parent), (parent = sourceFiber.return); return 3 === sourceFiber.tag ? sourceFiber.stateNode : null; @@ -10698,7 +10708,6 @@ var DefaultAsyncDispatcher = { workInProgressRootConcurrentErrors = null, workInProgressRootRecoverableErrors = null, workInProgressRootDidIncludeRecursiveRenderUpdate = !1, - didIncludeCommitPhaseUpdate = !1, globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, workInProgressTransitions = null, @@ -10741,7 +10750,7 @@ function scheduleUpdateOnFiber(root, fiber, lane) { workInProgressDeferredLane, workInProgressRootDidSkipSuspendedSiblings ); - markRootUpdated(root, lane); + markRootUpdated$1(root, lane); if (0 === (executionContext & 2) || root !== workInProgressRoot) isDevToolsPresent && addFiberToLanesMap(root, fiber, lane), root === workInProgressRoot && @@ -11021,15 +11030,6 @@ function isRenderConsistentWithExternalStores(finishedWork) { } return !0; } -function markRootUpdated(root, updatedLanes) { - root.pendingLanes |= updatedLanes; - 268435456 !== updatedLanes && - ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); - executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); -} function markRootSuspended( root, suspendedLanes, @@ -11598,11 +11598,11 @@ function commitRootImpl( do flushPassiveEffects(); while (null !== rootWithPendingPassiveEffects); if (0 !== (executionContext & 6)) throw Error(formatProdErrorMessage(327)); - var finishedWork = root.finishedWork, - lanes = root.finishedLanes; + var finishedWork = root.finishedWork; + didIncludeRenderPhaseUpdate = root.finishedLanes; null !== injectedProfilingHooks && "function" === typeof injectedProfilingHooks.markCommitStarted && - injectedProfilingHooks.markCommitStarted(lanes); + injectedProfilingHooks.markCommitStarted(didIncludeRenderPhaseUpdate); if (null === finishedWork) return markCommitStopped(), null; root.finishedWork = null; root.finishedLanes = 0; @@ -11614,13 +11614,12 @@ function commitRootImpl( remainingLanes |= concurrentlyUpdatedLanes; markRootFinished( root, - lanes, + didIncludeRenderPhaseUpdate, remainingLanes, spawnedLane, updatedLanes, suspendedRetryLanes ); - didIncludeCommitPhaseUpdate = !1; root === workInProgressRoot && ((workInProgress = workInProgressRoot = null), (workInProgressRootRenderLanes = 0)); @@ -11644,15 +11643,17 @@ function commitRootImpl( (updatedLanes = executionContext), (executionContext |= 4), commitBeforeMutationEffects(root, finishedWork), - commitMutationEffects(root, finishedWork, lanes), + commitMutationEffects(root, finishedWork, didIncludeRenderPhaseUpdate), restoreSelection(selectionInformation, root.containerInfo), (_enabled = !!eventsEnabled), (selectionInformation = eventsEnabled = null), (root.current = finishedWork), null !== injectedProfilingHooks && "function" === typeof injectedProfilingHooks.markLayoutEffectsStarted && - injectedProfilingHooks.markLayoutEffectsStarted(lanes), - commitLayoutEffects(finishedWork, root, lanes), + injectedProfilingHooks.markLayoutEffectsStarted( + didIncludeRenderPhaseUpdate + ), + commitLayoutEffects(finishedWork, root, didIncludeRenderPhaseUpdate), null !== injectedProfilingHooks && "function" === typeof injectedProfilingHooks.markLayoutEffectsStopped && injectedProfilingHooks.markLayoutEffectsStopped(), @@ -11664,7 +11665,7 @@ function commitRootImpl( rootDoesHavePassiveEffects ? ((rootDoesHavePassiveEffects = !1), (rootWithPendingPassiveEffects = root), - (pendingPassiveEffectsLanes = lanes)) + (pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate)) : releaseRootPooledCache(root, remainingLanes); remainingLanes = root.pendingLanes; 0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null); @@ -11683,9 +11684,7 @@ function commitRootImpl( }); 0 !== (pendingPassiveEffectsLanes & 3) && flushPassiveEffects(); remainingLanes = root.pendingLanes; - didIncludeRenderPhaseUpdate || - didIncludeCommitPhaseUpdate || - (0 !== (lanes & 4194218) && 0 !== (remainingLanes & 42)) + 0 !== (didIncludeRenderPhaseUpdate & 4194218) && 0 !== (remainingLanes & 42) ? ((nestedUpdateScheduled = !0), root === rootWithNestedUpdates ? nestedUpdateCount++ @@ -11763,7 +11762,7 @@ function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { sourceFiber = createRootErrorUpdate(rootFiber.stateNode, sourceFiber, 2); rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2); null !== rootFiber && - (markRootUpdated(rootFiber, 2), ensureRootIsScheduled(rootFiber)); + (markRootUpdated$1(rootFiber, 2), ensureRootIsScheduled(rootFiber)); } function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { if (3 === sourceFiber.tag) @@ -11796,7 +11795,7 @@ function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) { nearestMountedAncestor, sourceFiber ), - markRootUpdated(instance, 2), + markRootUpdated$1(instance, 2), ensureRootIsScheduled(instance)); break; } @@ -11826,10 +11825,6 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { null !== pingCache && pingCache.delete(wakeable); root.pingedLanes |= root.suspendedLanes & pingedLanes; root.warmLanes &= ~pingedLanes; - executionContext & 2 - ? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0) - : executionContext & 4 && (didIncludeCommitPhaseUpdate = !0); - throwIfInfiniteUpdateLoopDetected(); workInProgressRoot === root && (workInProgressRootRenderLanes & pingedLanes) === pingedLanes && (4 === workInProgressRootExitStatus || @@ -11847,7 +11842,7 @@ function retryTimedOutBoundary(boundaryFiber, retryLane) { 0 === retryLane && (retryLane = claimNextRetryLane()); boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); null !== boundaryFiber && - (markRootUpdated(boundaryFiber, retryLane), + (markRootUpdated$1(boundaryFiber, retryLane), ensureRootIsScheduled(boundaryFiber)); } function retryDehydratedSuspenseBoundary(boundaryFiber) { @@ -11876,18 +11871,6 @@ function resolveRetryWakeable(boundaryFiber, wakeable) { null !== retryCache && retryCache.delete(wakeable); retryTimedOutBoundary(boundaryFiber, retryLane); } -function throwIfInfiniteUpdateLoopDetected() { - if (100 < nestedUpdateCount) - throw ( - ((nestedUpdateCount = 0), - (rootWithNestedUpdates = null), - executionContext & 2 && - null !== workInProgressRoot && - (workInProgressRoot.errorRecoveryDisabledLanes |= - workInProgressRootRenderLanes), - Error(formatProdErrorMessage(185))) - ); -} function restorePendingUpdaters(root, lanes) { isDevToolsPresent && root.memoizedUpdaters.forEach(function (schedulingFiber) { @@ -12183,20 +12166,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1508 = 0; - i$jscomp$inline_1508 < simpleEventPluginEvents.length; - i$jscomp$inline_1508++ + var i$jscomp$inline_1521 = 0; + i$jscomp$inline_1521 < simpleEventPluginEvents.length; + i$jscomp$inline_1521++ ) { - var eventName$jscomp$inline_1509 = - simpleEventPluginEvents[i$jscomp$inline_1508], - domEventName$jscomp$inline_1510 = - eventName$jscomp$inline_1509.toLowerCase(), - capitalizedEvent$jscomp$inline_1511 = - eventName$jscomp$inline_1509[0].toUpperCase() + - eventName$jscomp$inline_1509.slice(1); + var eventName$jscomp$inline_1522 = + simpleEventPluginEvents[i$jscomp$inline_1521], + domEventName$jscomp$inline_1523 = + eventName$jscomp$inline_1522.toLowerCase(), + capitalizedEvent$jscomp$inline_1524 = + eventName$jscomp$inline_1522[0].toUpperCase() + + eventName$jscomp$inline_1522.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1510, - "on" + capitalizedEvent$jscomp$inline_1511 + domEventName$jscomp$inline_1523, + "on" + capitalizedEvent$jscomp$inline_1524 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -15656,16 +15639,16 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) { 0 === i && attemptExplicitHydrationTarget(target); } }; -var isomorphicReactPackageVersion$jscomp$inline_1757 = React.version; +var isomorphicReactPackageVersion$jscomp$inline_1770 = React.version; if ( - "19.0.0-rc-2d16326d-20240930" !== - isomorphicReactPackageVersion$jscomp$inline_1757 + "19.0.0-rc-1460d67c-20241003" !== + isomorphicReactPackageVersion$jscomp$inline_1770 ) throw Error( formatProdErrorMessage( 527, - isomorphicReactPackageVersion$jscomp$inline_1757, - "19.0.0-rc-2d16326d-20240930" + isomorphicReactPackageVersion$jscomp$inline_1770, + "19.0.0-rc-1460d67c-20241003" ) ); ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { @@ -15685,13 +15668,13 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) { null === componentOrElement ? null : componentOrElement.stateNode; return componentOrElement; }; -var internals$jscomp$inline_1764 = { +var internals$jscomp$inline_1777 = { bundleType: 0, - version: "19.0.0-rc-2d16326d-20240930", + version: "19.0.0-rc-1460d67c-20241003", rendererPackageName: "react-dom", currentDispatcherRef: ReactSharedInternals, findFiberByHostInstance: getClosestInstanceFromNode, - reconcilerVersion: "19.0.0-rc-2d16326d-20240930", + reconcilerVersion: "19.0.0-rc-1460d67c-20241003", getLaneLabelMap: function () { for ( var map = new Map(), lane = 1, index$275 = 0; @@ -15709,16 +15692,16 @@ var internals$jscomp$inline_1764 = { } }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2193 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2206 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2193.isDisabled && - hook$jscomp$inline_2193.supportsFiber + !hook$jscomp$inline_2206.isDisabled && + hook$jscomp$inline_2206.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2193.inject( - internals$jscomp$inline_1764 + (rendererID = hook$jscomp$inline_2206.inject( + internals$jscomp$inline_1777 )), - (injectedHook = hook$jscomp$inline_2193); + (injectedHook = hook$jscomp$inline_2206); } catch (err) {} } function noop() {} @@ -15845,7 +15828,7 @@ exports.hydrateRoot = function (container, initialChildren, options) { identifierPrefix.callback = null; enqueueUpdate(options, identifierPrefix, isStrictMode); initialChildren.current.lanes = isStrictMode; - markRootUpdated(initialChildren, isStrictMode); + markRootUpdated$1(initialChildren, isStrictMode); ensureRootIsScheduled(initialChildren); container[internalContainerInstanceKey] = initialChildren.current; listenToAllSupportedEvents(container); @@ -15971,7 +15954,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-rc-2d16326d-20240930"; +exports.version = "19.0.0-rc-1460d67c-20241003"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js index b4b22de24837d..a82e0f09b9188 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.development.js @@ -8566,5 +8566,5 @@ 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; - exports.version = "19.0.0-rc-2d16326d-20240930"; + exports.version = "19.0.0-rc-1460d67c-20241003"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.js index 332ca5229c82d..8f470ca34e632 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.browser.production.js @@ -5621,4 +5621,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server' ); }; -exports.version = "19.0.0-rc-2d16326d-20240930"; +exports.version = "19.0.0-rc-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.development.js index 413c6e7e16ba7..0cf84a6bbe27b 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.development.js @@ -8566,5 +8566,5 @@ 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToPipeableStream" which supports Suspense on the server' ); }; - exports.version = "19.0.0-rc-2d16326d-20240930"; + exports.version = "19.0.0-rc-1460d67c-20241003"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.production.js index 35b6137391907..4d3f13382dd03 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server-legacy.node.production.js @@ -5699,4 +5699,4 @@ exports.renderToString = function (children, options) { 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToPipeableStream" which supports Suspense on the server' ); }; -exports.version = "19.0.0-rc-2d16326d-20240930"; +exports.version = "19.0.0-rc-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.development.js index aaa45c9242668..630e2bb962b41 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.development.js @@ -8751,11 +8751,11 @@ didWarnAboutMaps = !1; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-2d16326d-20240930" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-1460d67c-20241003" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); exports.renderToReadableStream = function (children, options) { @@ -8848,5 +8848,5 @@ startWork(request$jscomp$0); }); }; - exports.version = "19.0.0-rc-2d16326d-20240930"; + exports.version = "19.0.0-rc-1460d67c-20241003"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.production.js index 749f4d89cd80b..2849c81a3c7fc 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.browser.production.js @@ -5908,14 +5908,14 @@ function abort(request, reason) { } var isomorphicReactPackageVersion$jscomp$inline_729 = React.version; if ( - "19.0.0-rc-2d16326d-20240930" !== + "19.0.0-rc-1460d67c-20241003" !== isomorphicReactPackageVersion$jscomp$inline_729 ) throw Error( formatProdErrorMessage( 527, isomorphicReactPackageVersion$jscomp$inline_729, - "19.0.0-rc-2d16326d-20240930" + "19.0.0-rc-1460d67c-20241003" ) ); exports.renderToReadableStream = function (children, options) { @@ -6007,4 +6007,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.0.0-rc-2d16326d-20240930"; +exports.version = "19.0.0-rc-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.bun.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.bun.production.js index 745cff7e59244..daaa8b1a7f3fd 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.bun.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.bun.production.js @@ -5592,13 +5592,13 @@ function abort(request, reason) { } var isomorphicReactPackageVersion$jscomp$inline_731 = React.version; if ( - "19.0.0-rc-2d16326d-20240930" !== + "19.0.0-rc-1460d67c-20241003" !== isomorphicReactPackageVersion$jscomp$inline_731 ) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion$jscomp$inline_731 + - "\n - react-dom: 19.0.0-rc-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); exports.renderToReadableStream = function (children, options) { return new Promise(function (resolve, reject) { @@ -5689,4 +5689,4 @@ exports.renderToReadableStream = function (children, options) { startWork(request); }); }; -exports.version = "19.0.0-rc-2d16326d-20240930"; +exports.version = "19.0.0-rc-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.development.js index 69a54eb929ad1..11d0e1b095e25 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.development.js @@ -8764,11 +8764,11 @@ didWarnAboutMaps = !1; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-2d16326d-20240930" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-1460d67c-20241003" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); exports.renderToReadableStream = function (children, options) { @@ -8872,5 +8872,5 @@ const setTimeoutOrImmediate = ? globalThis['set' + 'Immediate'] : setTimeout; - exports.version = "19.0.0-rc-2d16326d-20240930"; + exports.version = "19.0.0-rc-1460d67c-20241003"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.production.js index a643c2037e4ac..c920dcbf701ff 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.edge.production.js @@ -5996,13 +5996,13 @@ function abort(request, reason) { } var isomorphicReactPackageVersion$jscomp$inline_732 = React.version; if ( - "19.0.0-rc-2d16326d-20240930" !== + "19.0.0-rc-1460d67c-20241003" !== isomorphicReactPackageVersion$jscomp$inline_732 ) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion$jscomp$inline_732 + - "\n - react-dom: 19.0.0-rc-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); exports.renderToReadableStream = function (children, options) { return new Promise(function (resolve, reject) { @@ -6104,4 +6104,4 @@ const setTimeoutOrImmediate = ? globalThis['set' + 'Immediate'] : setTimeout; -exports.version = "19.0.0-rc-2d16326d-20240930"; +exports.version = "19.0.0-rc-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.development.js index ac92cb8a8f958..7f0c6e374a87b 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.development.js @@ -8621,11 +8621,11 @@ didWarnAboutMaps = !1; (function () { var isomorphicReactPackageVersion = React.version; - if ("19.0.0-rc-2d16326d-20240930" !== isomorphicReactPackageVersion) + if ("19.0.0-rc-1460d67c-20241003" !== isomorphicReactPackageVersion) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + - "\n - react-dom: 19.0.0-rc-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); })(); exports.renderToPipeableStream = function (children, options) { @@ -8667,5 +8667,5 @@ } }; }; - exports.version = "19.0.0-rc-2d16326d-20240930"; + exports.version = "19.0.0-rc-1460d67c-20241003"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.production.js index e22717f0c5d87..17f3407417ec2 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom-server.node.production.js @@ -5624,13 +5624,13 @@ function abort(request, reason) { } var isomorphicReactPackageVersion$jscomp$inline_759 = React.version; if ( - "19.0.0-rc-2d16326d-20240930" !== + "19.0.0-rc-1460d67c-20241003" !== isomorphicReactPackageVersion$jscomp$inline_759 ) throw Error( 'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion$jscomp$inline_759 + - "\n - react-dom: 19.0.0-rc-2d16326d-20240930\nLearn more: https://react.dev/warnings/version-mismatch") + "\n - react-dom: 19.0.0-rc-1460d67c-20241003\nLearn more: https://react.dev/warnings/version-mismatch") ); function createDrainHandler(destination, request) { return function () { @@ -5932,4 +5932,4 @@ exports.renderToPipeableStream = function (children, options) { } }; }; -exports.version = "19.0.0-rc-2d16326d-20240930"; +exports.version = "19.0.0-rc-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom.development.js index 72c60599d9bae..aa175b0995a8e 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom.development.js @@ -416,7 +416,7 @@ exports.useFormStatus = function () { return resolveDispatcher().useHostTransitionStatus(); }; - exports.version = "19.0.0-rc-2d16326d-20240930"; + exports.version = "19.0.0-rc-1460d67c-20241003"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom.production.js index 9dc23312c5333..ddb7a62218cc0 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom.production.js @@ -207,4 +207,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-rc-2d16326d-20240930"; +exports.version = "19.0.0-rc-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.development.js b/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.development.js index 85e764f7f0c2d..ee915014df289 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.development.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.development.js @@ -336,5 +336,5 @@ })) : Internals.d.m(href)); }; - exports.version = "19.0.0-rc-2d16326d-20240930"; + exports.version = "19.0.0-rc-1460d67c-20241003"; })(); diff --git a/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.production.js b/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.production.js index eda85fed0cbf7..16cafdb41995c 100644 --- a/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.production.js +++ b/packages/next/src/compiled/react-dom/cjs/react-dom.react-server.production.js @@ -149,4 +149,4 @@ exports.preloadModule = function (href, options) { }); } else Internals.d.m(href); }; -exports.version = "19.0.0-rc-2d16326d-20240930"; +exports.version = "19.0.0-rc-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-dom/package.json b/packages/next/src/compiled/react-dom/package.json index 212e84213ac29..67356b757d6d2 100644 --- a/packages/next/src/compiled/react-dom/package.json +++ b/packages/next/src/compiled/react-dom/package.json @@ -67,10 +67,10 @@ "./package.json": "./package.json" }, "dependencies": { - "scheduler": "0.25.0-rc-2d16326d-20240930" + "scheduler": "0.25.0-rc-1460d67c-20241003" }, "peerDependencies": { - "react": "19.0.0-rc-2d16326d-20240930" + "react": "19.0.0-rc-1460d67c-20241003" }, "browser": { "./server.js": "./server.browser.js", diff --git a/packages/next/src/compiled/react-experimental/cjs/react.development.js b/packages/next/src/compiled/react-experimental/cjs/react.development.js index 2e815bb15773a..c98ab8a891879 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.development.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.development.js @@ -1232,7 +1232,7 @@ exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.0.0-experimental-2d16326d-20240930"; + exports.version = "19.0.0-experimental-1460d67c-20241003"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react-experimental/cjs/react.production.js b/packages/next/src/compiled/react-experimental/cjs/react.production.js index 4efb1d261fd16..1bb7e9aedffa5 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.production.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.production.js @@ -562,4 +562,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-experimental-2d16326d-20240930"; +exports.version = "19.0.0-experimental-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-experimental/cjs/react.react-server.development.js b/packages/next/src/compiled/react-experimental/cjs/react.react-server.development.js index 558b958f4587e..9afd49aa6cc55 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.react-server.development.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.react-server.development.js @@ -978,5 +978,5 @@ exports.useMemo = function (create, deps) { return resolveDispatcher().useMemo(create, deps); }; - exports.version = "19.0.0-experimental-2d16326d-20240930"; + exports.version = "19.0.0-experimental-1460d67c-20241003"; })(); diff --git a/packages/next/src/compiled/react-experimental/cjs/react.react-server.production.js b/packages/next/src/compiled/react-experimental/cjs/react.react-server.production.js index 43840352a0715..b4d91bf0499c2 100644 --- a/packages/next/src/compiled/react-experimental/cjs/react.react-server.production.js +++ b/packages/next/src/compiled/react-experimental/cjs/react.react-server.production.js @@ -567,4 +567,4 @@ exports.useId = function () { exports.useMemo = function (create, deps) { return ReactSharedInternals.H.useMemo(create, deps); }; -exports.version = "19.0.0-experimental-2d16326d-20240930"; +exports.version = "19.0.0-experimental-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react-is/package.json b/packages/next/src/compiled/react-is/package.json index 2dc37470144b3..32a96847ab4a0 100644 --- a/packages/next/src/compiled/react-is/package.json +++ b/packages/next/src/compiled/react-is/package.json @@ -1,6 +1,6 @@ { "name": "react-is", - "version": "19.0.0-rc-2d16326d-20240930", + "version": "19.0.0-rc-1460d67c-20241003", "description": "Brand checking of React Elements.", "main": "index.js", "sideEffects": false, diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.development.js index b1db236ca6cb8..cf18c15e9e849 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.development.js @@ -692,12 +692,17 @@ pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function createFakeServerFunction( name, @@ -1332,6 +1337,17 @@ createFormData ) ); + case "Z": + return ( + (value = value.slice(2)), + getOutlinedModel( + response, + value, + parentObject, + key, + resolveErrorDev + ) + ); case "i": return ( (value = value.slice(2)), @@ -1426,6 +1442,23 @@ this._rootEnvironmentName = environmentName; this._fromJSON = createFromJSONCallback(this); } + function resolveModel(response, id, model) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? resolveModelChunk(chunk, model) + : chunks.set( + id, + new ReactPromise("resolved_model", model, null, response) + ); + } + function resolveText(response, id, text) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk && "pending" !== chunk.status + ? chunk.reason.enqueueValue(text) + : chunks.set(id, new ReactPromise("fulfilled", text, null, response)); + } function resolveBuffer(response, id, buffer) { var chunks = response._chunks, chunk = chunks.get(id); @@ -1660,6 +1693,87 @@ } ); } + function stopStream(response, id, row) { + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === row ? '"$undefined"' : row); + } + function resolveErrorDev(response, errorInfo) { + var env = errorInfo.env; + errorInfo = buildFakeCallStack( + response, + errorInfo.stack, + env, + Error.bind( + null, + errorInfo.message || + "An error occurred in the Server Components render but no message was provided" + ) + ); + response = getRootTask(response, env); + response = null != response ? response.run(errorInfo) : errorInfo(); + response.environmentName = env; + return response; + } + function resolvePostponeDev(response, id, reason, stack, env) { + reason = buildFakeCallStack( + response, + stack, + env, + Error.bind(null, reason || "") + ); + stack = response._debugRootTask; + reason = null != stack ? stack.run(reason) : reason(); + reason.$$typeof = REACT_POSTPONE_TYPE; + stack = response._chunks; + (env = stack.get(id)) + ? triggerErrorOnChunk(env, reason) + : stack.set(id, new ReactPromise("rejected", null, reason, response)); + } + function resolveHint(response, code, model) { + response = JSON.parse(model, response._fromJSON); + model = ReactDOMSharedInternals.d; + switch (code) { + case "D": + model.D(response); + break; + case "C": + "string" === typeof response + ? model.C(response) + : model.C(response[0], response[1]); + break; + case "L": + code = response[0]; + var as = response[1]; + 3 === response.length + ? model.L(code, as, response[2]) + : model.L(code, as); + break; + case "m": + "string" === typeof response + ? model.m(response) + : model.m(response[0], response[1]); + break; + case "X": + "string" === typeof response + ? model.X(response) + : model.X(response[0], response[1]); + break; + case "S": + "string" === typeof response + ? model.S(response) + : model.S( + response[0], + 0 === response[1] ? void 0 : response[1], + 3 === response.length ? response[2] : void 0 + ); + break; + case "M": + "string" === typeof response + ? model.M(response) + : model.M(response[0], response[1]); + } + } function createFakeFunction( name, filename, @@ -1801,6 +1915,19 @@ null != debugInfo.owner && initializeFakeStack(response, debugInfo.owner)); } + function resolveDebugInfo(response, id, debugInfo) { + initializeFakeTask( + response, + debugInfo, + void 0 === debugInfo.env ? response._rootEnvironmentName : debugInfo.env + ); + null === debugInfo.owner && null != response._debugRootOwner + ? ((debugInfo.owner = response._debugRootOwner), + (debugInfo.debugStack = response._debugRootStack)) + : initializeFakeStack(response, debugInfo); + response = getChunk(response, id); + (response._debugInfo || (response._debugInfo = [])).push(debugInfo); + } function getCurrentStackInDEV() { var owner = currentOwnerInDEV; if (null === owner) return ""; @@ -1856,6 +1983,24 @@ } return JSCompiler_inline_result$jscomp$0; } + function resolveConsoleEntry(response, value) { + if (response._replayConsole) { + var payload = JSON.parse(value, response._fromJSON); + value = payload[0]; + var stackTrace = payload[1], + owner = payload[2], + env = payload[3]; + payload = payload.slice(4); + replayConsoleWithCallStackInDEV( + response, + value, + stackTrace, + owner, + env, + payload + ); + } + } function mergeBuffer(buffer, lastChunk) { for ( var l = buffer.length, byteLength = lastChunk.length, i = 0; @@ -1943,122 +2088,44 @@ i++ ) row += stringDecoder.decode(buffer[i], decoderOptions); - buffer = row += stringDecoder.decode(chunk); + row += stringDecoder.decode(chunk); + processFullStringRow(response, id, tag, row); + } + function processFullStringRow(response, id, tag, row) { switch (tag) { case 73: - resolveModule(response, id, buffer); + resolveModule(response, id, row); break; case 72: - id = buffer[0]; - buffer = buffer.slice(1); - response = JSON.parse(buffer, response._fromJSON); - buffer = ReactDOMSharedInternals.d; - switch (id) { - case "D": - buffer.D(response); - break; - case "C": - "string" === typeof response - ? buffer.C(response) - : buffer.C(response[0], response[1]); - break; - case "L": - id = response[0]; - tag = response[1]; - 3 === response.length - ? buffer.L(id, tag, response[2]) - : buffer.L(id, tag); - break; - case "m": - "string" === typeof response - ? buffer.m(response) - : buffer.m(response[0], response[1]); - break; - case "X": - "string" === typeof response - ? buffer.X(response) - : buffer.X(response[0], response[1]); - break; - case "S": - "string" === typeof response - ? buffer.S(response) - : buffer.S( - response[0], - 0 === response[1] ? void 0 : response[1], - 3 === response.length ? response[2] : void 0 - ); - break; - case "M": - "string" === typeof response - ? buffer.M(response) - : buffer.M(response[0], response[1]); - } + resolveHint(response, row[0], row.slice(1)); break; case 69: - chunk = JSON.parse(buffer); - buffer = chunk.digest; - tag = chunk.env; - chunk = buildFakeCallStack( - response, - chunk.stack, - tag, - Error.bind( - null, - chunk.message || - "An error occurred in the Server Components render but no message was provided" - ) - ); - stringDecoder = getRootTask(response, tag); - chunk = null != stringDecoder ? stringDecoder.run(chunk) : chunk(); - chunk.digest = buffer; - chunk.environmentName = tag; - buffer = response._chunks; - (tag = buffer.get(id)) - ? triggerErrorOnChunk(tag, chunk) - : buffer.set( - id, - new ReactPromise("rejected", null, chunk, response) - ); + row = JSON.parse(row); + tag = resolveErrorDev(response, row); + tag.digest = row.digest; + row = response._chunks; + var chunk = row.get(id); + chunk + ? triggerErrorOnChunk(chunk, tag) + : row.set(id, new ReactPromise("rejected", null, tag, response)); break; case 84: - tag = response._chunks; - (chunk = tag.get(id)) && "pending" !== chunk.status - ? chunk.reason.enqueueValue(buffer) - : tag.set( - id, - new ReactPromise("fulfilled", buffer, null, response) - ); + resolveText(response, id, row); break; case 68: - buffer = JSON.parse(buffer, response._fromJSON); - initializeFakeTask( - response, - buffer, - void 0 === buffer.env ? response._rootEnvironmentName : buffer.env - ); - null === buffer.owner && null != response._debugRootOwner - ? ((buffer.owner = response._debugRootOwner), - (buffer.debugStack = response._debugRootStack)) - : initializeFakeStack(response, buffer); - response = getChunk(response, id); - (response._debugInfo || (response._debugInfo = [])).push(buffer); + tag = new ReactPromise("resolved_model", row, null, response); + initializeModelChunk(tag); + "fulfilled" === tag.status + ? resolveDebugInfo(response, id, tag.value) + : tag.then( + function (v) { + return resolveDebugInfo(response, id, v); + }, + function () {} + ); break; case 87: - response._replayConsole && - ((stringDecoder = JSON.parse(buffer, response._fromJSON)), - (id = stringDecoder[0]), - (buffer = stringDecoder[1]), - (tag = stringDecoder[2]), - (chunk = stringDecoder[3]), - (stringDecoder = stringDecoder.slice(4)), - replayConsoleWithCallStackInDEV( - response, - id, - buffer, - tag, - chunk, - stringDecoder - )); + resolveConsoleEntry(response, row); break; case 82: startReadableStream(response, id, void 0); @@ -2073,34 +2140,14 @@ startAsyncIterable(response, id, !0); break; case 67: - (response = response._chunks.get(id)) && - "fulfilled" === response.status && - response.reason.close("" === buffer ? '"$undefined"' : buffer); + stopStream(response, id, row); break; case 80: - buffer = JSON.parse(buffer); - buffer = buildFakeCallStack( - response, - buffer.stack, - buffer.env, - Error.bind(null, buffer.reason || "") - ); - tag = response._debugRootTask; - buffer = null != tag ? tag.run(buffer) : buffer(); - buffer.$$typeof = REACT_POSTPONE_TYPE; - tag = response._chunks; - (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) - : tag.set(id, new ReactPromise("rejected", null, buffer, response)); + tag = JSON.parse(row); + resolvePostponeDev(response, id, tag.reason, tag.stack, tag.env); break; default: - (tag = response._chunks), - (chunk = tag.get(id)) - ? resolveModelChunk(chunk, buffer) - : tag.set( - id, - new ReactPromise("resolved_model", buffer, null, response) - ); + resolveModel(response, id, row); } } function createFromJSONCallback(response) { @@ -2499,10 +2546,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.0.0-experimental-2d16326d-20240930", + version: "19.0.0-experimental-1460d67c-20241003", rendererPackageName: "react-server-dom-turbopack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.0.0-experimental-2d16326d-20240930", + reconcilerVersion: "19.0.0-experimental-1460d67c-20241003", getCurrentComponentInfo: function () { return currentOwnerInDEV; } @@ -2562,7 +2609,7 @@ }; exports.encodeReply = function (value, options) { return new Promise(function (resolve, reject) { - processReply( + var abort = processReply( value, "", options && options.temporaryReferences @@ -2571,6 +2618,17 @@ resolve, reject ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(signal.reason); + else { + var listener = function () { + abort(signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } }); }; })(); diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.production.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.production.js index f0ff41e81568c..17ccde76041ec 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.production.js @@ -448,12 +448,17 @@ function processReply( pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function registerServerReference(proxy, reference) { knownServerReferences.set(proxy, reference); @@ -877,6 +882,8 @@ function parseModelString(response, parentObject, key, value) { (value = value.slice(2)), getOutlinedModel(response, value, parentObject, key, createFormData) ); + case "Z": + return resolveErrorProd(); case "i": return ( (value = value.slice(2)), @@ -1150,6 +1157,13 @@ function startAsyncIterable(response, id, iterator) { } ); } +function resolveErrorProd() { + var error = Error( + "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." + ); + error.stack = "Error: " + error.message; + return error; +} function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; @@ -1285,12 +1299,9 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { } break; case 69: - tag = JSON.parse(buffer).digest; - buffer = Error( - "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." - ); - buffer.stack = "Error: " + buffer.message; - buffer.digest = tag; + tag = JSON.parse(buffer); + buffer = resolveErrorProd(); + buffer.digest = tag.digest; tag = response._chunks; (chunk = tag.get(id)) ? triggerErrorOnChunk(chunk, buffer) @@ -1518,7 +1529,7 @@ exports.createTemporaryReferenceSet = function () { }; exports.encodeReply = function (value, options) { return new Promise(function (resolve, reject) { - processReply( + var abort = processReply( value, "", options && options.temporaryReferences @@ -1527,5 +1538,16 @@ exports.encodeReply = function (value, options) { resolve, reject ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(signal.reason); + else { + var listener = function () { + abort(signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } }); }; diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.edge.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.edge.development.js index 6ff93eafd9324..7c57c114d72c0 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.edge.development.js @@ -717,12 +717,17 @@ pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function encodeFormData(reference) { var resolve, @@ -1540,6 +1545,17 @@ createFormData ) ); + case "Z": + return ( + (value = value.slice(2)), + getOutlinedModel( + response, + value, + parentObject, + key, + resolveErrorDev + ) + ); case "i": return ( (value = value.slice(2)), @@ -1634,6 +1650,23 @@ this._rootEnvironmentName = environmentName; this._fromJSON = createFromJSONCallback(this); } + function resolveModel(response, id, model) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? resolveModelChunk(chunk, model) + : chunks.set( + id, + new ReactPromise("resolved_model", model, null, response) + ); + } + function resolveText(response, id, text) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk && "pending" !== chunk.status + ? chunk.reason.enqueueValue(text) + : chunks.set(id, new ReactPromise("fulfilled", text, null, response)); + } function resolveBuffer(response, id, buffer) { var chunks = response._chunks, chunk = chunks.get(id); @@ -1873,6 +1906,87 @@ } ); } + function stopStream(response, id, row) { + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === row ? '"$undefined"' : row); + } + function resolveErrorDev(response, errorInfo) { + var env = errorInfo.env; + errorInfo = buildFakeCallStack( + response, + errorInfo.stack, + env, + Error.bind( + null, + errorInfo.message || + "An error occurred in the Server Components render but no message was provided" + ) + ); + response = getRootTask(response, env); + response = null != response ? response.run(errorInfo) : errorInfo(); + response.environmentName = env; + return response; + } + function resolvePostponeDev(response, id, reason, stack, env) { + reason = buildFakeCallStack( + response, + stack, + env, + Error.bind(null, reason || "") + ); + stack = response._debugRootTask; + reason = null != stack ? stack.run(reason) : reason(); + reason.$$typeof = REACT_POSTPONE_TYPE; + stack = response._chunks; + (env = stack.get(id)) + ? triggerErrorOnChunk(env, reason) + : stack.set(id, new ReactPromise("rejected", null, reason, response)); + } + function resolveHint(response, code, model) { + response = JSON.parse(model, response._fromJSON); + model = ReactDOMSharedInternals.d; + switch (code) { + case "D": + model.D(response); + break; + case "C": + "string" === typeof response + ? model.C(response) + : model.C(response[0], response[1]); + break; + case "L": + code = response[0]; + var as = response[1]; + 3 === response.length + ? model.L(code, as, response[2]) + : model.L(code, as); + break; + case "m": + "string" === typeof response + ? model.m(response) + : model.m(response[0], response[1]); + break; + case "X": + "string" === typeof response + ? model.X(response) + : model.X(response[0], response[1]); + break; + case "S": + "string" === typeof response + ? model.S(response) + : model.S( + response[0], + 0 === response[1] ? void 0 : response[1], + 3 === response.length ? response[2] : void 0 + ); + break; + case "M": + "string" === typeof response + ? model.M(response) + : model.M(response[0], response[1]); + } + } function createFakeFunction( name, filename, @@ -2014,6 +2128,19 @@ null != debugInfo.owner && initializeFakeStack(response, debugInfo.owner)); } + function resolveDebugInfo(response, id, debugInfo) { + initializeFakeTask( + response, + debugInfo, + void 0 === debugInfo.env ? response._rootEnvironmentName : debugInfo.env + ); + null === debugInfo.owner && null != response._debugRootOwner + ? ((debugInfo.owner = response._debugRootOwner), + (debugInfo.debugStack = response._debugRootStack)) + : initializeFakeStack(response, debugInfo); + response = getChunk(response, id); + (response._debugInfo || (response._debugInfo = [])).push(debugInfo); + } function getCurrentStackInDEV() { var owner = currentOwnerInDEV; if (null === owner) return ""; @@ -2069,6 +2196,24 @@ } return JSCompiler_inline_result$jscomp$0; } + function resolveConsoleEntry(response, value) { + if (response._replayConsole) { + var payload = JSON.parse(value, response._fromJSON); + value = payload[0]; + var stackTrace = payload[1], + owner = payload[2], + env = payload[3]; + payload = payload.slice(4); + replayConsoleWithCallStackInDEV( + response, + value, + stackTrace, + owner, + env, + payload + ); + } + } function mergeBuffer(buffer, lastChunk) { for ( var l = buffer.length, byteLength = lastChunk.length, i = 0; @@ -2156,122 +2301,44 @@ i++ ) row += stringDecoder.decode(buffer[i], decoderOptions); - buffer = row += stringDecoder.decode(chunk); + row += stringDecoder.decode(chunk); + processFullStringRow(response, id, tag, row); + } + function processFullStringRow(response, id, tag, row) { switch (tag) { case 73: - resolveModule(response, id, buffer); + resolveModule(response, id, row); break; case 72: - id = buffer[0]; - buffer = buffer.slice(1); - response = JSON.parse(buffer, response._fromJSON); - buffer = ReactDOMSharedInternals.d; - switch (id) { - case "D": - buffer.D(response); - break; - case "C": - "string" === typeof response - ? buffer.C(response) - : buffer.C(response[0], response[1]); - break; - case "L": - id = response[0]; - tag = response[1]; - 3 === response.length - ? buffer.L(id, tag, response[2]) - : buffer.L(id, tag); - break; - case "m": - "string" === typeof response - ? buffer.m(response) - : buffer.m(response[0], response[1]); - break; - case "X": - "string" === typeof response - ? buffer.X(response) - : buffer.X(response[0], response[1]); - break; - case "S": - "string" === typeof response - ? buffer.S(response) - : buffer.S( - response[0], - 0 === response[1] ? void 0 : response[1], - 3 === response.length ? response[2] : void 0 - ); - break; - case "M": - "string" === typeof response - ? buffer.M(response) - : buffer.M(response[0], response[1]); - } + resolveHint(response, row[0], row.slice(1)); break; case 69: - chunk = JSON.parse(buffer); - buffer = chunk.digest; - tag = chunk.env; - chunk = buildFakeCallStack( - response, - chunk.stack, - tag, - Error.bind( - null, - chunk.message || - "An error occurred in the Server Components render but no message was provided" - ) - ); - stringDecoder = getRootTask(response, tag); - chunk = null != stringDecoder ? stringDecoder.run(chunk) : chunk(); - chunk.digest = buffer; - chunk.environmentName = tag; - buffer = response._chunks; - (tag = buffer.get(id)) - ? triggerErrorOnChunk(tag, chunk) - : buffer.set( - id, - new ReactPromise("rejected", null, chunk, response) - ); + row = JSON.parse(row); + tag = resolveErrorDev(response, row); + tag.digest = row.digest; + row = response._chunks; + var chunk = row.get(id); + chunk + ? triggerErrorOnChunk(chunk, tag) + : row.set(id, new ReactPromise("rejected", null, tag, response)); break; case 84: - tag = response._chunks; - (chunk = tag.get(id)) && "pending" !== chunk.status - ? chunk.reason.enqueueValue(buffer) - : tag.set( - id, - new ReactPromise("fulfilled", buffer, null, response) - ); + resolveText(response, id, row); break; case 68: - buffer = JSON.parse(buffer, response._fromJSON); - initializeFakeTask( - response, - buffer, - void 0 === buffer.env ? response._rootEnvironmentName : buffer.env - ); - null === buffer.owner && null != response._debugRootOwner - ? ((buffer.owner = response._debugRootOwner), - (buffer.debugStack = response._debugRootStack)) - : initializeFakeStack(response, buffer); - response = getChunk(response, id); - (response._debugInfo || (response._debugInfo = [])).push(buffer); + tag = new ReactPromise("resolved_model", row, null, response); + initializeModelChunk(tag); + "fulfilled" === tag.status + ? resolveDebugInfo(response, id, tag.value) + : tag.then( + function (v) { + return resolveDebugInfo(response, id, v); + }, + function () {} + ); break; case 87: - response._replayConsole && - ((stringDecoder = JSON.parse(buffer, response._fromJSON)), - (id = stringDecoder[0]), - (buffer = stringDecoder[1]), - (tag = stringDecoder[2]), - (chunk = stringDecoder[3]), - (stringDecoder = stringDecoder.slice(4)), - replayConsoleWithCallStackInDEV( - response, - id, - buffer, - tag, - chunk, - stringDecoder - )); + resolveConsoleEntry(response, row); break; case 82: startReadableStream(response, id, void 0); @@ -2286,34 +2353,14 @@ startAsyncIterable(response, id, !0); break; case 67: - (response = response._chunks.get(id)) && - "fulfilled" === response.status && - response.reason.close("" === buffer ? '"$undefined"' : buffer); + stopStream(response, id, row); break; case 80: - buffer = JSON.parse(buffer); - buffer = buildFakeCallStack( - response, - buffer.stack, - buffer.env, - Error.bind(null, buffer.reason || "") - ); - tag = response._debugRootTask; - buffer = null != tag ? tag.run(buffer) : buffer(); - buffer.$$typeof = REACT_POSTPONE_TYPE; - tag = response._chunks; - (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) - : tag.set(id, new ReactPromise("rejected", null, buffer, response)); + tag = JSON.parse(row); + resolvePostponeDev(response, id, tag.reason, tag.stack, tag.env); break; default: - (tag = response._chunks), - (chunk = tag.get(id)) - ? resolveModelChunk(chunk, buffer) - : tag.set( - id, - new ReactPromise("resolved_model", buffer, null, response) - ); + resolveModel(response, id, row); } } function createFromJSONCallback(response) { @@ -2733,7 +2780,7 @@ }; exports.encodeReply = function (value, options) { return new Promise(function (resolve, reject) { - processReply( + var abort = processReply( value, "", options && options.temporaryReferences @@ -2742,6 +2789,17 @@ resolve, reject ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(signal.reason); + else { + var listener = function () { + abort(signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } }); }; })(); diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.edge.production.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.edge.production.js index 27beef6e83cdc..bf9444b2588d8 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.edge.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.edge.production.js @@ -469,12 +469,17 @@ function processReply( pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } var boundCache = new WeakMap(); function encodeFormData(reference) { @@ -1044,6 +1049,8 @@ function parseModelString(response, parentObject, key, value) { (value = value.slice(2)), getOutlinedModel(response, value, parentObject, key, createFormData) ); + case "Z": + return resolveErrorProd(); case "i": return ( (value = value.slice(2)), @@ -1322,6 +1329,13 @@ function startAsyncIterable(response, id, iterator) { } ); } +function resolveErrorProd() { + var error = Error( + "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." + ); + error.stack = "Error: " + error.message; + return error; +} function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; @@ -1457,12 +1471,9 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { } break; case 69: - tag = JSON.parse(buffer).digest; - buffer = Error( - "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." - ); - buffer.stack = "Error: " + buffer.message; - buffer.digest = tag; + tag = JSON.parse(buffer); + buffer = resolveErrorProd(); + buffer.digest = tag.digest; tag = response._chunks; (chunk = tag.get(id)) ? triggerErrorOnChunk(chunk, buffer) @@ -1690,7 +1701,7 @@ exports.createTemporaryReferenceSet = function () { }; exports.encodeReply = function (value, options) { return new Promise(function (resolve, reject) { - processReply( + var abort = processReply( value, "", options && options.temporaryReferences @@ -1699,5 +1710,16 @@ exports.encodeReply = function (value, options) { resolve, reject ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(signal.reason); + else { + var listener = function () { + abort(signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } }); }; diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.development.js index 4fd90c5b15325..1fa214f67f820 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.development.js @@ -717,12 +717,17 @@ pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function encodeFormData(reference) { var resolve, @@ -1540,6 +1545,17 @@ createFormData ) ); + case "Z": + return ( + (value = value.slice(2)), + getOutlinedModel( + response, + value, + parentObject, + key, + resolveErrorDev + ) + ); case "i": return ( (value = value.slice(2)), @@ -1634,6 +1650,23 @@ this._rootEnvironmentName = environmentName; this._fromJSON = createFromJSONCallback(this); } + function resolveModel(response, id, model) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? resolveModelChunk(chunk, model) + : chunks.set( + id, + new ReactPromise("resolved_model", model, null, response) + ); + } + function resolveText(response, id, text) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk && "pending" !== chunk.status + ? chunk.reason.enqueueValue(text) + : chunks.set(id, new ReactPromise("fulfilled", text, null, response)); + } function resolveBuffer(response, id, buffer) { var chunks = response._chunks, chunk = chunks.get(id); @@ -1873,6 +1906,87 @@ } ); } + function stopStream(response, id, row) { + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === row ? '"$undefined"' : row); + } + function resolveErrorDev(response, errorInfo) { + var env = errorInfo.env; + errorInfo = buildFakeCallStack( + response, + errorInfo.stack, + env, + Error.bind( + null, + errorInfo.message || + "An error occurred in the Server Components render but no message was provided" + ) + ); + response = getRootTask(response, env); + response = null != response ? response.run(errorInfo) : errorInfo(); + response.environmentName = env; + return response; + } + function resolvePostponeDev(response, id, reason, stack, env) { + reason = buildFakeCallStack( + response, + stack, + env, + Error.bind(null, reason || "") + ); + stack = response._debugRootTask; + reason = null != stack ? stack.run(reason) : reason(); + reason.$$typeof = REACT_POSTPONE_TYPE; + stack = response._chunks; + (env = stack.get(id)) + ? triggerErrorOnChunk(env, reason) + : stack.set(id, new ReactPromise("rejected", null, reason, response)); + } + function resolveHint(response, code, model) { + response = JSON.parse(model, response._fromJSON); + model = ReactDOMSharedInternals.d; + switch (code) { + case "D": + model.D(response); + break; + case "C": + "string" === typeof response + ? model.C(response) + : model.C(response[0], response[1]); + break; + case "L": + code = response[0]; + var as = response[1]; + 3 === response.length + ? model.L(code, as, response[2]) + : model.L(code, as); + break; + case "m": + "string" === typeof response + ? model.m(response) + : model.m(response[0], response[1]); + break; + case "X": + "string" === typeof response + ? model.X(response) + : model.X(response[0], response[1]); + break; + case "S": + "string" === typeof response + ? model.S(response) + : model.S( + response[0], + 0 === response[1] ? void 0 : response[1], + 3 === response.length ? response[2] : void 0 + ); + break; + case "M": + "string" === typeof response + ? model.M(response) + : model.M(response[0], response[1]); + } + } function createFakeFunction( name, filename, @@ -2014,6 +2128,19 @@ null != debugInfo.owner && initializeFakeStack(response, debugInfo.owner)); } + function resolveDebugInfo(response, id, debugInfo) { + initializeFakeTask( + response, + debugInfo, + void 0 === debugInfo.env ? response._rootEnvironmentName : debugInfo.env + ); + null === debugInfo.owner && null != response._debugRootOwner + ? ((debugInfo.owner = response._debugRootOwner), + (debugInfo.debugStack = response._debugRootStack)) + : initializeFakeStack(response, debugInfo); + response = getChunk(response, id); + (response._debugInfo || (response._debugInfo = [])).push(debugInfo); + } function getCurrentStackInDEV() { var owner = currentOwnerInDEV; if (null === owner) return ""; @@ -2069,6 +2196,24 @@ } return JSCompiler_inline_result$jscomp$0; } + function resolveConsoleEntry(response, value) { + if (response._replayConsole) { + var payload = JSON.parse(value, response._fromJSON); + value = payload[0]; + var stackTrace = payload[1], + owner = payload[2], + env = payload[3]; + payload = payload.slice(4); + replayConsoleWithCallStackInDEV( + response, + value, + stackTrace, + owner, + env, + payload + ); + } + } function mergeBuffer(buffer, lastChunk) { for ( var l = buffer.length, byteLength = lastChunk.length, i = 0; @@ -2156,122 +2301,44 @@ i++ ) row += stringDecoder.decode(buffer[i], decoderOptions); - buffer = row += stringDecoder.decode(chunk); + row += stringDecoder.decode(chunk); + processFullStringRow(response, id, tag, row); + } + function processFullStringRow(response, id, tag, row) { switch (tag) { case 73: - resolveModule(response, id, buffer); + resolveModule(response, id, row); break; case 72: - id = buffer[0]; - buffer = buffer.slice(1); - response = JSON.parse(buffer, response._fromJSON); - buffer = ReactDOMSharedInternals.d; - switch (id) { - case "D": - buffer.D(response); - break; - case "C": - "string" === typeof response - ? buffer.C(response) - : buffer.C(response[0], response[1]); - break; - case "L": - id = response[0]; - tag = response[1]; - 3 === response.length - ? buffer.L(id, tag, response[2]) - : buffer.L(id, tag); - break; - case "m": - "string" === typeof response - ? buffer.m(response) - : buffer.m(response[0], response[1]); - break; - case "X": - "string" === typeof response - ? buffer.X(response) - : buffer.X(response[0], response[1]); - break; - case "S": - "string" === typeof response - ? buffer.S(response) - : buffer.S( - response[0], - 0 === response[1] ? void 0 : response[1], - 3 === response.length ? response[2] : void 0 - ); - break; - case "M": - "string" === typeof response - ? buffer.M(response) - : buffer.M(response[0], response[1]); - } + resolveHint(response, row[0], row.slice(1)); break; case 69: - chunk = JSON.parse(buffer); - buffer = chunk.digest; - tag = chunk.env; - chunk = buildFakeCallStack( - response, - chunk.stack, - tag, - Error.bind( - null, - chunk.message || - "An error occurred in the Server Components render but no message was provided" - ) - ); - stringDecoder = getRootTask(response, tag); - chunk = null != stringDecoder ? stringDecoder.run(chunk) : chunk(); - chunk.digest = buffer; - chunk.environmentName = tag; - buffer = response._chunks; - (tag = buffer.get(id)) - ? triggerErrorOnChunk(tag, chunk) - : buffer.set( - id, - new ReactPromise("rejected", null, chunk, response) - ); + row = JSON.parse(row); + tag = resolveErrorDev(response, row); + tag.digest = row.digest; + row = response._chunks; + var chunk = row.get(id); + chunk + ? triggerErrorOnChunk(chunk, tag) + : row.set(id, new ReactPromise("rejected", null, tag, response)); break; case 84: - tag = response._chunks; - (chunk = tag.get(id)) && "pending" !== chunk.status - ? chunk.reason.enqueueValue(buffer) - : tag.set( - id, - new ReactPromise("fulfilled", buffer, null, response) - ); + resolveText(response, id, row); break; case 68: - buffer = JSON.parse(buffer, response._fromJSON); - initializeFakeTask( - response, - buffer, - void 0 === buffer.env ? response._rootEnvironmentName : buffer.env - ); - null === buffer.owner && null != response._debugRootOwner - ? ((buffer.owner = response._debugRootOwner), - (buffer.debugStack = response._debugRootStack)) - : initializeFakeStack(response, buffer); - response = getChunk(response, id); - (response._debugInfo || (response._debugInfo = [])).push(buffer); + tag = new ReactPromise("resolved_model", row, null, response); + initializeModelChunk(tag); + "fulfilled" === tag.status + ? resolveDebugInfo(response, id, tag.value) + : tag.then( + function (v) { + return resolveDebugInfo(response, id, v); + }, + function () {} + ); break; case 87: - response._replayConsole && - ((stringDecoder = JSON.parse(buffer, response._fromJSON)), - (id = stringDecoder[0]), - (buffer = stringDecoder[1]), - (tag = stringDecoder[2]), - (chunk = stringDecoder[3]), - (stringDecoder = stringDecoder.slice(4)), - replayConsoleWithCallStackInDEV( - response, - id, - buffer, - tag, - chunk, - stringDecoder - )); + resolveConsoleEntry(response, row); break; case 82: startReadableStream(response, id, void 0); @@ -2286,34 +2353,14 @@ startAsyncIterable(response, id, !0); break; case 67: - (response = response._chunks.get(id)) && - "fulfilled" === response.status && - response.reason.close("" === buffer ? '"$undefined"' : buffer); + stopStream(response, id, row); break; case 80: - buffer = JSON.parse(buffer); - buffer = buildFakeCallStack( - response, - buffer.stack, - buffer.env, - Error.bind(null, buffer.reason || "") - ); - tag = response._debugRootTask; - buffer = null != tag ? tag.run(buffer) : buffer(); - buffer.$$typeof = REACT_POSTPONE_TYPE; - tag = response._chunks; - (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) - : tag.set(id, new ReactPromise("rejected", null, buffer, response)); + tag = JSON.parse(row); + resolvePostponeDev(response, id, tag.reason, tag.stack, tag.env); break; default: - (tag = response._chunks), - (chunk = tag.get(id)) - ? resolveModelChunk(chunk, buffer) - : tag.set( - id, - new ReactPromise("resolved_model", buffer, null, response) - ); + resolveModel(response, id, row); } } function createFromJSONCallback(response) { diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.production.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.production.js index 966be4694ea1e..04e42ce6bb950 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.node.production.js @@ -470,12 +470,17 @@ function processReply( pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } var boundCache = new WeakMap(); function encodeFormData(reference) { @@ -1045,6 +1050,8 @@ function parseModelString(response, parentObject, key, value) { (value = value.slice(2)), getOutlinedModel(response, value, parentObject, key, createFormData) ); + case "Z": + return resolveErrorProd(); case "i": return ( (value = value.slice(2)), @@ -1323,6 +1330,13 @@ function startAsyncIterable(response, id, iterator) { } ); } +function resolveErrorProd() { + var error = Error( + "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." + ); + error.stack = "Error: " + error.message; + return error; +} function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; @@ -1458,12 +1472,9 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { } break; case 69: - tag = JSON.parse(buffer).digest; - buffer = Error( - "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." - ); - buffer.stack = "Error: " + buffer.message; - buffer.digest = tag; + tag = JSON.parse(buffer); + buffer = resolveErrorProd(); + buffer.digest = tag.digest; tag = response._chunks; (chunk = tag.get(id)) ? triggerErrorOnChunk(chunk, buffer) diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.development.js index e191eddf26cab..8f6ca7c8e6f01 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.development.js @@ -1069,9 +1069,10 @@ null === task.debugStack ? null : filterStackTrace(request, task.debugStack, 1); + componentDebugInfo.props = props; componentDebugInfo.debugStack = task.debugStack; componentDebugInfo.debugTask = task.debugTask; - outlineModel(request, componentDebugInfo); + outlineComponentInfo(request, componentDebugInfo); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; 2 === validated && @@ -1271,6 +1272,7 @@ null === task.debugStack ? null : filterStackTrace(request, task.debugStack, 1), + props: props, debugStack: task.debugStack, debugTask: task.debugTask }), @@ -1338,6 +1340,8 @@ ); ref = task.keyPath; null === key ? (key = ref) : null !== ref && (key = ref + "," + key); + null !== task.debugOwner && + outlineComponentInfo(request, task.debugOwner); request = [ REACT_ELEMENT_TYPE, type, @@ -1644,18 +1648,6 @@ reader.read().then(progress).catch(error); return "$B" + newTask.id.toString(16); } - function isReactComponentInfo(value) { - return ( - (("object" === typeof value.debugTask && - null !== value.debugTask && - "function" === typeof value.debugTask.run) || - value.debugStack instanceof Error) && - (isArrayImpl(value.stack) || null === value.stack) && - "string" === typeof value.name && - "string" === typeof value.env && - void 0 !== value.owner - ); - } function renderModel(request, task, parent, key, value) { var prevKeyPath = task.keyPath, prevImplicitSlot = task.implicitSlot; @@ -1864,6 +1856,7 @@ if (value instanceof Set) return serializeSet(request, value); if ("function" === typeof FormData && value instanceof FormData) return serializeFormData(request, value); + if (value instanceof Error) return serializeErrorValue(request, value); if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -1918,17 +1911,6 @@ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." + describeObjectForErrorMessage(parent, parentPropertyName) ); - if (isReactComponentInfo(value)) - return ( - (request = { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }), - (request.stack = value.stack), - request - ); if ("Object" !== objectName(value)) callWithDebugContextInDEV(request, task, function () { console.error( @@ -2109,6 +2091,27 @@ id = stringToChunk(id); request.completedErrorChunks.push(id); } + function serializeErrorValue(request, error) { + var env = (0, request.environmentName)(); + try { + var message = String(error.message); + var stack = filterStackTrace(request, error, 0); + var errorEnv = error.environmentName; + "string" === typeof errorEnv && (env = errorEnv); + } catch (x) { + (message = + "An error occurred but serializing the error message failed."), + (stack = []); + } + return ( + "$Z" + + outlineModel(request, { + message: message, + stack: stack, + env: env + }).toString(16) + ); + } function emitErrorChunk(request, id, digest, error) { var env = (0, request.environmentName)(); try { @@ -2143,7 +2146,7 @@ request.completedRegularChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var counter = { objectCount: 0 }; + var counter = { objectLimit: 500 }; debugInfo = stringify(debugInfo, function (parentPropertyName, value) { return renderConsoleValue( request, @@ -2157,6 +2160,33 @@ id = stringToChunk(id); request.completedRegularChunks.push(id); } + function outlineComponentInfo(request, componentInfo) { + if (!request.writtenObjects.has(componentInfo)) { + null != componentInfo.owner && + outlineComponentInfo(request, componentInfo.owner); + var objectLimit = 10; + null != componentInfo.stack && + (objectLimit += componentInfo.stack.length); + objectLimit = { objectLimit: objectLimit }; + var componentDebugInfo = { + name: componentInfo.name, + env: componentInfo.env, + key: componentInfo.key, + owner: componentInfo.owner + }; + componentDebugInfo.stack = componentInfo.stack; + componentDebugInfo.props = componentInfo.props; + objectLimit = outlineConsoleValue( + request, + objectLimit, + componentDebugInfo + ); + request.writtenObjects.set( + componentInfo, + serializeByValueID(objectLimit) + ); + } + } function emitTypedArrayChunk(request, id, tag, typedArray) { if (TaintRegistryByteLengths.has(typedArray.byteLength)) { var tainted = TaintRegistryValues.get( @@ -2217,11 +2247,39 @@ ((parent = request.temporaryReferences.get(value)), void 0 !== parent) ) return "$T" + parent; - if (500 < counter.objectCount) return "$Y"; - counter.objectCount++; parent = request.writtenObjects.get(value); + if (void 0 !== parent) return parent; + if (0 >= counter.objectLimit) return "$Y"; + counter.objectLimit--; + switch (value.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + null != value._owner && + outlineComponentInfo(request, value._owner), + (counter = null), + null != value._debugStack && + ((counter = filterStackTrace(request, value._debugStack, 1)), + (parent = outlineConsoleValue( + request, + { objectLimit: counter.length + 2 }, + counter + )), + request.writtenObjects.set( + counter, + serializeByValueID(parent) + )), + [ + REACT_ELEMENT_TYPE, + value.type, + value.key, + value.props, + value._owner, + counter, + value._store.validated + ] + ); + } if ("function" === typeof value.then) { - if (void 0 !== parent) return parent; switch (value.status) { case "fulfilled": return ( @@ -2243,20 +2301,19 @@ } return "$@"; } - return void 0 !== parent - ? parent - : isArrayImpl(value) - ? value - : value instanceof Map + return isArrayImpl(value) + ? value + : value instanceof Map + ? ((value = Array.from(value)), + "$Q" + outlineConsoleValue(request, counter, value).toString(16)) + : value instanceof Set ? ((value = Array.from(value)), - "$Q" + + "$W" + outlineConsoleValue(request, counter, value).toString(16)) - : value instanceof Set - ? ((value = Array.from(value)), - "$W" + - outlineConsoleValue(request, counter, value).toString(16)) - : "function" === typeof FormData && value instanceof FormData - ? serializeFormData(request, value) + : "function" === typeof FormData && value instanceof FormData + ? serializeFormData(request, value) + : value instanceof Error + ? serializeErrorValue(request, value) : value instanceof ArrayBuffer ? serializeTypedArray(request, "A", new Uint8Array(value)) : value instanceof Int8Array @@ -2300,17 +2357,7 @@ ? serializeBlob(request, value) : getIteratorFn(value) ? Array.from(value) - : isReactComponentInfo(value) - ? ((request = { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }), - (request.stack = - value.stack), - request) - : value; + : value; } if ("string" === typeof value) return "Z" === value[value.length - 1] && originalValue instanceof Date @@ -2355,7 +2402,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); request.pendingChunks++; @@ -2373,8 +2423,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }, - env = (0, request.environmentName)(); + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(); methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { @@ -2387,7 +2438,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); id = serializeRowHeader("W", id) + args + "\n"; @@ -2398,7 +2452,7 @@ for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, "string" === typeof debugInfo[i].name && - outlineModel(request, debugInfo[i]), + outlineComponentInfo(request, debugInfo[i]), emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.production.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.production.js index d35aaca564e0b..8a446221de88c 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.browser.production.js @@ -1545,6 +1545,7 @@ function renderModelDestructive( (value = Array.from(value.entries())), "$K" + outlineModel(request, value).toString(16) ); + if (value instanceof Error) return "$Z"; if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.development.js index 10d7b52135a3c..18d842762b7d1 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.development.js @@ -1078,9 +1078,10 @@ null === task.debugStack ? null : filterStackTrace(request, task.debugStack, 1); + componentDebugInfo.props = props; componentDebugInfo.debugStack = task.debugStack; componentDebugInfo.debugTask = task.debugTask; - outlineModel(request, componentDebugInfo); + outlineComponentInfo(request, componentDebugInfo); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; 2 === validated && @@ -1328,6 +1329,7 @@ null === task.debugStack ? null : filterStackTrace(request, task.debugStack, 1), + props: props, debugStack: task.debugStack, debugTask: task.debugTask }), @@ -1395,6 +1397,8 @@ ); ref = task.keyPath; null === key ? (key = ref) : null !== ref && (key = ref + "," + key); + null !== task.debugOwner && + outlineComponentInfo(request, task.debugOwner); request = [ REACT_ELEMENT_TYPE, type, @@ -1701,18 +1705,6 @@ reader.read().then(progress).catch(error); return "$B" + newTask.id.toString(16); } - function isReactComponentInfo(value) { - return ( - (("object" === typeof value.debugTask && - null !== value.debugTask && - "function" === typeof value.debugTask.run) || - value.debugStack instanceof Error) && - (isArrayImpl(value.stack) || null === value.stack) && - "string" === typeof value.name && - "string" === typeof value.env && - void 0 !== value.owner - ); - } function renderModel(request, task, parent, key, value) { var prevKeyPath = task.keyPath, prevImplicitSlot = task.implicitSlot; @@ -1921,6 +1913,7 @@ if (value instanceof Set) return serializeSet(request, value); if ("function" === typeof FormData && value instanceof FormData) return serializeFormData(request, value); + if (value instanceof Error) return serializeErrorValue(request, value); if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -1975,17 +1968,6 @@ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." + describeObjectForErrorMessage(parent, parentPropertyName) ); - if (isReactComponentInfo(value)) - return ( - (request = { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }), - (request.stack = value.stack), - request - ); if ("Object" !== objectName(value)) callWithDebugContextInDEV(request, task, function () { console.error( @@ -2188,6 +2170,27 @@ id = stringToChunk(id); request.completedErrorChunks.push(id); } + function serializeErrorValue(request, error) { + var env = (0, request.environmentName)(); + try { + var message = String(error.message); + var stack = filterStackTrace(request, error, 0); + var errorEnv = error.environmentName; + "string" === typeof errorEnv && (env = errorEnv); + } catch (x) { + (message = + "An error occurred but serializing the error message failed."), + (stack = []); + } + return ( + "$Z" + + outlineModel(request, { + message: message, + stack: stack, + env: env + }).toString(16) + ); + } function emitErrorChunk(request, id, digest, error) { var env = (0, request.environmentName)(); try { @@ -2222,7 +2225,7 @@ request.completedRegularChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var counter = { objectCount: 0 }; + var counter = { objectLimit: 500 }; debugInfo = stringify(debugInfo, function (parentPropertyName, value) { return renderConsoleValue( request, @@ -2236,6 +2239,33 @@ id = stringToChunk(id); request.completedRegularChunks.push(id); } + function outlineComponentInfo(request, componentInfo) { + if (!request.writtenObjects.has(componentInfo)) { + null != componentInfo.owner && + outlineComponentInfo(request, componentInfo.owner); + var objectLimit = 10; + null != componentInfo.stack && + (objectLimit += componentInfo.stack.length); + objectLimit = { objectLimit: objectLimit }; + var componentDebugInfo = { + name: componentInfo.name, + env: componentInfo.env, + key: componentInfo.key, + owner: componentInfo.owner + }; + componentDebugInfo.stack = componentInfo.stack; + componentDebugInfo.props = componentInfo.props; + objectLimit = outlineConsoleValue( + request, + objectLimit, + componentDebugInfo + ); + request.writtenObjects.set( + componentInfo, + serializeByValueID(objectLimit) + ); + } + } function emitTypedArrayChunk(request, id, tag, typedArray) { if (TaintRegistryByteLengths.has(typedArray.byteLength)) { var tainted = TaintRegistryValues.get( @@ -2296,11 +2326,39 @@ ((parent = request.temporaryReferences.get(value)), void 0 !== parent) ) return "$T" + parent; - if (500 < counter.objectCount) return "$Y"; - counter.objectCount++; parent = request.writtenObjects.get(value); + if (void 0 !== parent) return parent; + if (0 >= counter.objectLimit) return "$Y"; + counter.objectLimit--; + switch (value.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + null != value._owner && + outlineComponentInfo(request, value._owner), + (counter = null), + null != value._debugStack && + ((counter = filterStackTrace(request, value._debugStack, 1)), + (parent = outlineConsoleValue( + request, + { objectLimit: counter.length + 2 }, + counter + )), + request.writtenObjects.set( + counter, + serializeByValueID(parent) + )), + [ + REACT_ELEMENT_TYPE, + value.type, + value.key, + value.props, + value._owner, + counter, + value._store.validated + ] + ); + } if ("function" === typeof value.then) { - if (void 0 !== parent) return parent; switch (value.status) { case "fulfilled": return ( @@ -2322,20 +2380,19 @@ } return "$@"; } - return void 0 !== parent - ? parent - : isArrayImpl(value) - ? value - : value instanceof Map + return isArrayImpl(value) + ? value + : value instanceof Map + ? ((value = Array.from(value)), + "$Q" + outlineConsoleValue(request, counter, value).toString(16)) + : value instanceof Set ? ((value = Array.from(value)), - "$Q" + + "$W" + outlineConsoleValue(request, counter, value).toString(16)) - : value instanceof Set - ? ((value = Array.from(value)), - "$W" + - outlineConsoleValue(request, counter, value).toString(16)) - : "function" === typeof FormData && value instanceof FormData - ? serializeFormData(request, value) + : "function" === typeof FormData && value instanceof FormData + ? serializeFormData(request, value) + : value instanceof Error + ? serializeErrorValue(request, value) : value instanceof ArrayBuffer ? serializeTypedArray(request, "A", new Uint8Array(value)) : value instanceof Int8Array @@ -2379,17 +2436,7 @@ ? serializeBlob(request, value) : getIteratorFn(value) ? Array.from(value) - : isReactComponentInfo(value) - ? ((request = { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }), - (request.stack = - value.stack), - request) - : value; + : value; } if ("string" === typeof value) return "Z" === value[value.length - 1] && originalValue instanceof Date @@ -2434,7 +2481,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); request.pendingChunks++; @@ -2452,8 +2502,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }, - env = (0, request.environmentName)(); + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(); methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { @@ -2466,7 +2517,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); id = serializeRowHeader("W", id) + args + "\n"; @@ -2477,7 +2531,7 @@ for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, "string" === typeof debugInfo[i].name && - outlineModel(request, debugInfo[i]), + outlineComponentInfo(request, debugInfo[i]), emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.production.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.production.js index bafb4e460b56a..506c80f048b1b 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.edge.production.js @@ -1550,6 +1550,7 @@ function renderModelDestructive( (value = Array.from(value.entries())), "$K" + outlineModel(request, value).toString(16) ); + if (value instanceof Error) return "$Z"; if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.development.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.development.js index f00c6945e615f..98001675d7af0 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.development.js @@ -1098,9 +1098,10 @@ null === task.debugStack ? null : filterStackTrace(request, task.debugStack, 1); + componentDebugInfo.props = props; componentDebugInfo.debugStack = task.debugStack; componentDebugInfo.debugTask = task.debugTask; - outlineModel(request, componentDebugInfo); + outlineComponentInfo(request, componentDebugInfo); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; 2 === validated && @@ -1326,6 +1327,7 @@ null === task.debugStack ? null : filterStackTrace(request, task.debugStack, 1), + props: props, debugStack: task.debugStack, debugTask: task.debugTask }), @@ -1393,6 +1395,8 @@ ); ref = task.keyPath; null === key ? (key = ref) : null !== ref && (key = ref + "," + key); + null !== task.debugOwner && + outlineComponentInfo(request, task.debugOwner); request = [ REACT_ELEMENT_TYPE, type, @@ -1697,18 +1701,6 @@ reader.read().then(progress).catch(error); return "$B" + newTask.id.toString(16); } - function isReactComponentInfo(value) { - return ( - (("object" === typeof value.debugTask && - null !== value.debugTask && - "function" === typeof value.debugTask.run) || - value.debugStack instanceof Error) && - (isArrayImpl(value.stack) || null === value.stack) && - "string" === typeof value.name && - "string" === typeof value.env && - void 0 !== value.owner - ); - } function renderModel(request, task, parent, key, value) { var prevKeyPath = task.keyPath, prevImplicitSlot = task.implicitSlot; @@ -1917,6 +1909,7 @@ if (value instanceof Set) return serializeSet(request, value); if ("function" === typeof FormData && value instanceof FormData) return serializeFormData(request, value); + if (value instanceof Error) return serializeErrorValue(request, value); if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -1971,17 +1964,6 @@ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." + describeObjectForErrorMessage(parent, parentPropertyName) ); - if (isReactComponentInfo(value)) - return ( - (request = { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }), - (request.stack = value.stack), - request - ); if ("Object" !== objectName(value)) callWithDebugContextInDEV(request, task, function () { console.error( @@ -2174,6 +2156,27 @@ "\n"; request.completedErrorChunks.push(id); } + function serializeErrorValue(request, error) { + var env = (0, request.environmentName)(); + try { + var message = String(error.message); + var stack = filterStackTrace(request, error, 0); + var errorEnv = error.environmentName; + "string" === typeof errorEnv && (env = errorEnv); + } catch (x) { + (message = + "An error occurred but serializing the error message failed."), + (stack = []); + } + return ( + "$Z" + + outlineModel(request, { + message: message, + stack: stack, + env: env + }).toString(16) + ); + } function emitErrorChunk(request, id, digest, error) { var env = (0, request.environmentName)(); try { @@ -2206,7 +2209,7 @@ request.completedRegularChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var counter = { objectCount: 0 }; + var counter = { objectLimit: 500 }; debugInfo = stringify(debugInfo, function (parentPropertyName, value) { return renderConsoleValue( request, @@ -2219,6 +2222,33 @@ id = serializeRowHeader("D", id) + debugInfo + "\n"; request.completedRegularChunks.push(id); } + function outlineComponentInfo(request, componentInfo) { + if (!request.writtenObjects.has(componentInfo)) { + null != componentInfo.owner && + outlineComponentInfo(request, componentInfo.owner); + var objectLimit = 10; + null != componentInfo.stack && + (objectLimit += componentInfo.stack.length); + objectLimit = { objectLimit: objectLimit }; + var componentDebugInfo = { + name: componentInfo.name, + env: componentInfo.env, + key: componentInfo.key, + owner: componentInfo.owner + }; + componentDebugInfo.stack = componentInfo.stack; + componentDebugInfo.props = componentInfo.props; + objectLimit = outlineConsoleValue( + request, + objectLimit, + componentDebugInfo + ); + request.writtenObjects.set( + componentInfo, + serializeByValueID(objectLimit) + ); + } + } function emitTypedArrayChunk(request, id, tag, typedArray) { if (TaintRegistryByteLengths.has(typedArray.byteLength)) { var tainted = TaintRegistryValues.get( @@ -2275,11 +2305,39 @@ ((parent = request.temporaryReferences.get(value)), void 0 !== parent) ) return "$T" + parent; - if (500 < counter.objectCount) return "$Y"; - counter.objectCount++; parent = request.writtenObjects.get(value); + if (void 0 !== parent) return parent; + if (0 >= counter.objectLimit) return "$Y"; + counter.objectLimit--; + switch (value.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + null != value._owner && + outlineComponentInfo(request, value._owner), + (counter = null), + null != value._debugStack && + ((counter = filterStackTrace(request, value._debugStack, 1)), + (parent = outlineConsoleValue( + request, + { objectLimit: counter.length + 2 }, + counter + )), + request.writtenObjects.set( + counter, + serializeByValueID(parent) + )), + [ + REACT_ELEMENT_TYPE, + value.type, + value.key, + value.props, + value._owner, + counter, + value._store.validated + ] + ); + } if ("function" === typeof value.then) { - if (void 0 !== parent) return parent; switch (value.status) { case "fulfilled": return ( @@ -2301,20 +2359,19 @@ } return "$@"; } - return void 0 !== parent - ? parent - : isArrayImpl(value) - ? value - : value instanceof Map + return isArrayImpl(value) + ? value + : value instanceof Map + ? ((value = Array.from(value)), + "$Q" + outlineConsoleValue(request, counter, value).toString(16)) + : value instanceof Set ? ((value = Array.from(value)), - "$Q" + + "$W" + outlineConsoleValue(request, counter, value).toString(16)) - : value instanceof Set - ? ((value = Array.from(value)), - "$W" + - outlineConsoleValue(request, counter, value).toString(16)) - : "function" === typeof FormData && value instanceof FormData - ? serializeFormData(request, value) + : "function" === typeof FormData && value instanceof FormData + ? serializeFormData(request, value) + : value instanceof Error + ? serializeErrorValue(request, value) : value instanceof ArrayBuffer ? serializeTypedArray(request, "A", new Uint8Array(value)) : value instanceof Int8Array @@ -2358,17 +2415,7 @@ ? serializeBlob(request, value) : getIteratorFn(value) ? Array.from(value) - : isReactComponentInfo(value) - ? ((request = { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }), - (request.stack = - value.stack), - request) - : value; + : value; } if ("string" === typeof value) return "Z" === value[value.length - 1] && originalValue instanceof Date @@ -2413,7 +2460,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); request.pendingChunks++; @@ -2430,8 +2480,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }, - env = (0, request.environmentName)(); + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(); methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { @@ -2444,7 +2495,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); id = serializeRowHeader("W", id) + args + "\n"; @@ -2454,7 +2508,7 @@ for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, "string" === typeof debugInfo[i].name && - outlineModel(request, debugInfo[i]), + outlineComponentInfo(request, debugInfo[i]), emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.production.js b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.production.js index b5d45794c3b49..dda3414cc4ee9 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-server.node.production.js @@ -1564,6 +1564,7 @@ function renderModelDestructive( (value = Array.from(value.entries())), "$K" + outlineModel(request, value).toString(16) ); + if (value instanceof Error) return "$Z"; if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -2957,12 +2958,12 @@ exports.decodeReplyFromBusboy = function (busboyStream, turbopackMap, options) { "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_229 = []; + var JSCompiler_object_inline_chunks_233 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_229.push(chunk); + JSCompiler_object_inline_chunks_233.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_229, { + var blob = new Blob(JSCompiler_object_inline_chunks_233, { type: mimeType }); response._formData.append(name, blob, filename); diff --git a/packages/next/src/compiled/react-server-dom-turbopack-experimental/package.json b/packages/next/src/compiled/react-server-dom-turbopack-experimental/package.json index 075fde27d4bbf..e8f9841e1c04e 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack-experimental/package.json +++ b/packages/next/src/compiled/react-server-dom-turbopack-experimental/package.json @@ -48,7 +48,7 @@ "neo-async": "^2.6.1" }, "peerDependencies": { - "react": "0.0.0-experimental-2d16326d-20240930", - "react-dom": "0.0.0-experimental-2d16326d-20240930" + "react": "0.0.0-experimental-1460d67c-20241003", + "react-dom": "0.0.0-experimental-1460d67c-20241003" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js index 0f577cf18c7db..f4b9fcbf7b17c 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js @@ -724,12 +724,17 @@ pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function createFakeServerFunction( name, @@ -1340,6 +1345,17 @@ createFormData ) ); + case "Z": + return ( + (value = value.slice(2)), + getOutlinedModel( + response, + value, + parentObject, + key, + resolveErrorDev + ) + ); case "i": return ( (value = value.slice(2)), @@ -1430,6 +1446,23 @@ void 0 === environmentName ? "Server" : environmentName; this._fromJSON = createFromJSONCallback(this); } + function resolveModel(response, id, model) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? resolveModelChunk(chunk, model) + : chunks.set( + id, + new ReactPromise("resolved_model", model, null, response) + ); + } + function resolveText(response, id, text) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk && "pending" !== chunk.status + ? chunk.reason.enqueueValue(text) + : chunks.set(id, new ReactPromise("fulfilled", text, null, response)); + } function resolveBuffer(response, id, buffer) { var chunks = response._chunks, chunk = chunks.get(id); @@ -1664,6 +1697,88 @@ } ); } + function stopStream(response, id, row) { + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === row ? '"$undefined"' : row); + } + function resolveErrorDev(response, errorInfo) { + response = errorInfo.stack; + var env = errorInfo.env; + errorInfo = Error( + errorInfo.message || + "An error occurred in the Server Components render but no message was provided" + ); + var v8StyleStack = errorInfo.name + ": " + errorInfo.message; + if (response) + for (var i = 0; i < response.length; i++) { + var frame = response[i], + name = frame[0], + filename = frame[1], + line = frame[2]; + frame = frame[3]; + v8StyleStack = name + ? v8StyleStack + + ("\n at " + + name + + " (" + + filename + + ":" + + line + + ":" + + frame + + ")") + : v8StyleStack + + ("\n at " + filename + ":" + line + ":" + frame); + } + errorInfo.stack = v8StyleStack; + errorInfo.environmentName = env; + return errorInfo; + } + function resolveHint(response, code, model) { + response = JSON.parse(model, response._fromJSON); + model = ReactDOMSharedInternals.d; + switch (code) { + case "D": + model.D(response); + break; + case "C": + "string" === typeof response + ? model.C(response) + : model.C(response[0], response[1]); + break; + case "L": + code = response[0]; + var as = response[1]; + 3 === response.length + ? model.L(code, as, response[2]) + : model.L(code, as); + break; + case "m": + "string" === typeof response + ? model.m(response) + : model.m(response[0], response[1]); + break; + case "X": + "string" === typeof response + ? model.X(response) + : model.X(response[0], response[1]); + break; + case "S": + "string" === typeof response + ? model.S(response) + : model.S( + response[0], + 0 === response[1] ? void 0 : response[1], + 3 === response.length ? response[2] : void 0 + ); + break; + case "M": + "string" === typeof response + ? model.M(response) + : model.M(response[0], response[1]); + } + } function createFakeFunction( name, filename, @@ -1752,9 +1867,26 @@ null != debugInfo.owner && initializeFakeStack(response, debugInfo.owner)); } + function resolveDebugInfo(response, id, debugInfo) { + null === debugInfo.owner && null != response._debugRootOwner + ? ((debugInfo.owner = response._debugRootOwner), + (debugInfo.debugStack = response._debugRootStack)) + : initializeFakeStack(response, debugInfo); + response = getChunk(response, id); + (response._debugInfo || (response._debugInfo = [])).push(debugInfo); + } function getCurrentStackInDEV() { return ""; } + function resolveConsoleEntry(response, value) { + if (response._replayConsole) { + var payload = JSON.parse(value, response._fromJSON); + response = payload[0]; + value = payload[3]; + payload = payload.slice(4); + bindToConsole(response, payload, value)(); + } + } function mergeBuffer(buffer, lastChunk) { for ( var l = buffer.length, byteLength = lastChunk.length, i = 0; @@ -1842,120 +1974,44 @@ i++ ) row += stringDecoder.decode(buffer[i], decoderOptions); - buffer = row += stringDecoder.decode(chunk); + row += stringDecoder.decode(chunk); + processFullStringRow(response, id, tag, row); + } + function processFullStringRow(response, id, tag, row) { switch (tag) { case 73: - resolveModule(response, id, buffer); + resolveModule(response, id, row); break; case 72: - id = buffer[0]; - buffer = buffer.slice(1); - response = JSON.parse(buffer, response._fromJSON); - buffer = ReactDOMSharedInternals.d; - switch (id) { - case "D": - buffer.D(response); - break; - case "C": - "string" === typeof response - ? buffer.C(response) - : buffer.C(response[0], response[1]); - break; - case "L": - id = response[0]; - tag = response[1]; - 3 === response.length - ? buffer.L(id, tag, response[2]) - : buffer.L(id, tag); - break; - case "m": - "string" === typeof response - ? buffer.m(response) - : buffer.m(response[0], response[1]); - break; - case "X": - "string" === typeof response - ? buffer.X(response) - : buffer.X(response[0], response[1]); - break; - case "S": - "string" === typeof response - ? buffer.S(response) - : buffer.S( - response[0], - 0 === response[1] ? void 0 : response[1], - 3 === response.length ? response[2] : void 0 - ); - break; - case "M": - "string" === typeof response - ? buffer.M(response) - : buffer.M(response[0], response[1]); - } + resolveHint(response, row[0], row.slice(1)); break; case 69: - stringDecoder = JSON.parse(buffer); - tag = stringDecoder.digest; - chunk = stringDecoder.env; - buffer = Error( - stringDecoder.message || - "An error occurred in the Server Components render but no message was provided" - ); - stringDecoder = stringDecoder.stack; - row = buffer.name + ": " + buffer.message; - if (stringDecoder) - for (i = 0; i < stringDecoder.length; i++) { - var frame = stringDecoder[i], - name = frame[0], - filename = frame[1], - line = frame[2]; - frame = frame[3]; - row = name - ? row + - ("\n at " + - name + - " (" + - filename + - ":" + - line + - ":" + - frame + - ")") - : row + ("\n at " + filename + ":" + line + ":" + frame); - } - buffer.stack = row; - buffer.digest = tag; - buffer.environmentName = chunk; - tag = response._chunks; - (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) - : tag.set(id, new ReactPromise("rejected", null, buffer, response)); + row = JSON.parse(row); + tag = resolveErrorDev(response, row); + tag.digest = row.digest; + row = response._chunks; + var chunk = row.get(id); + chunk + ? triggerErrorOnChunk(chunk, tag) + : row.set(id, new ReactPromise("rejected", null, tag, response)); break; case 84: - tag = response._chunks; - (chunk = tag.get(id)) && "pending" !== chunk.status - ? chunk.reason.enqueueValue(buffer) - : tag.set( - id, - new ReactPromise("fulfilled", buffer, null, response) - ); + resolveText(response, id, row); break; case 68: - buffer = JSON.parse(buffer, response._fromJSON); - null === buffer.owner && null != response._debugRootOwner - ? ((buffer.owner = response._debugRootOwner), - (buffer.debugStack = response._debugRootStack)) - : initializeFakeStack(response, buffer); - response = getChunk(response, id); - (response._debugInfo || (response._debugInfo = [])).push(buffer); + tag = new ReactPromise("resolved_model", row, null, response); + initializeModelChunk(tag); + "fulfilled" === tag.status + ? resolveDebugInfo(response, id, tag.value) + : tag.then( + function (v) { + return resolveDebugInfo(response, id, v); + }, + function () {} + ); break; case 87: - response._replayConsole && - ((buffer = JSON.parse(buffer, response._fromJSON)), - (response = buffer[0]), - (id = buffer[3]), - (buffer = buffer.slice(4)), - bindToConsole(response, buffer, id)()); + resolveConsoleEntry(response, row); break; case 82: startReadableStream(response, id, void 0); @@ -1970,18 +2026,10 @@ startAsyncIterable(response, id, !0); break; case 67: - (response = response._chunks.get(id)) && - "fulfilled" === response.status && - response.reason.close("" === buffer ? '"$undefined"' : buffer); + stopStream(response, id, row); break; default: - (tag = response._chunks), - (chunk = tag.get(id)) - ? resolveModelChunk(chunk, buffer) - : tag.set( - id, - new ReactPromise("resolved_model", buffer, null, response) - ); + resolveModel(response, id, row); } } function createFromJSONCallback(response) { @@ -2299,10 +2347,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.0.0-rc-2d16326d-20240930", + version: "19.0.0-rc-1460d67c-20241003", rendererPackageName: "react-server-dom-turbopack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.0.0-rc-2d16326d-20240930", + reconcilerVersion: "19.0.0-rc-1460d67c-20241003", getCurrentComponentInfo: function () { return currentOwnerInDEV; } @@ -2362,7 +2410,7 @@ }; exports.encodeReply = function (value, options) { return new Promise(function (resolve, reject) { - processReply( + var abort = processReply( value, "", options && options.temporaryReferences @@ -2371,6 +2419,17 @@ resolve, reject ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(signal.reason); + else { + var listener = function () { + abort(signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } }); }; })(); diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.production.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.production.js index a2cab896a7f1b..96a461e4887a2 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.production.js @@ -447,12 +447,17 @@ function processReply( pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function registerServerReference(proxy, reference) { knownServerReferences.set(proxy, reference); @@ -876,6 +881,8 @@ function parseModelString(response, parentObject, key, value) { (value = value.slice(2)), getOutlinedModel(response, value, parentObject, key, createFormData) ); + case "Z": + return resolveErrorProd(); case "i": return ( (value = value.slice(2)), @@ -1149,6 +1156,13 @@ function startAsyncIterable(response, id, iterator) { } ); } +function resolveErrorProd() { + var error = Error( + "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." + ); + error.stack = "Error: " + error.message; + return error; +} function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; @@ -1284,12 +1298,9 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { } break; case 69: - tag = JSON.parse(buffer).digest; - buffer = Error( - "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." - ); - buffer.stack = "Error: " + buffer.message; - buffer.digest = tag; + tag = JSON.parse(buffer); + buffer = resolveErrorProd(); + buffer.digest = tag.digest; tag = response._chunks; (chunk = tag.get(id)) ? triggerErrorOnChunk(chunk, buffer) @@ -1506,7 +1517,7 @@ exports.createTemporaryReferenceSet = function () { }; exports.encodeReply = function (value, options) { return new Promise(function (resolve, reject) { - processReply( + var abort = processReply( value, "", options && options.temporaryReferences @@ -1515,5 +1526,16 @@ exports.encodeReply = function (value, options) { resolve, reject ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(signal.reason); + else { + var listener = function () { + abort(signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } }); }; diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.development.js index 73103e5411e38..22cb8949d4a06 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.development.js @@ -749,12 +749,17 @@ pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function encodeFormData(reference) { var resolve, @@ -1548,6 +1553,17 @@ createFormData ) ); + case "Z": + return ( + (value = value.slice(2)), + getOutlinedModel( + response, + value, + parentObject, + key, + resolveErrorDev + ) + ); case "i": return ( (value = value.slice(2)), @@ -1638,6 +1654,23 @@ void 0 === environmentName ? "Server" : environmentName; this._fromJSON = createFromJSONCallback(this); } + function resolveModel(response, id, model) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? resolveModelChunk(chunk, model) + : chunks.set( + id, + new ReactPromise("resolved_model", model, null, response) + ); + } + function resolveText(response, id, text) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk && "pending" !== chunk.status + ? chunk.reason.enqueueValue(text) + : chunks.set(id, new ReactPromise("fulfilled", text, null, response)); + } function resolveBuffer(response, id, buffer) { var chunks = response._chunks, chunk = chunks.get(id); @@ -1877,6 +1910,88 @@ } ); } + function stopStream(response, id, row) { + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === row ? '"$undefined"' : row); + } + function resolveErrorDev(response, errorInfo) { + response = errorInfo.stack; + var env = errorInfo.env; + errorInfo = Error( + errorInfo.message || + "An error occurred in the Server Components render but no message was provided" + ); + var v8StyleStack = errorInfo.name + ": " + errorInfo.message; + if (response) + for (var i = 0; i < response.length; i++) { + var frame = response[i], + name = frame[0], + filename = frame[1], + line = frame[2]; + frame = frame[3]; + v8StyleStack = name + ? v8StyleStack + + ("\n at " + + name + + " (" + + filename + + ":" + + line + + ":" + + frame + + ")") + : v8StyleStack + + ("\n at " + filename + ":" + line + ":" + frame); + } + errorInfo.stack = v8StyleStack; + errorInfo.environmentName = env; + return errorInfo; + } + function resolveHint(response, code, model) { + response = JSON.parse(model, response._fromJSON); + model = ReactDOMSharedInternals.d; + switch (code) { + case "D": + model.D(response); + break; + case "C": + "string" === typeof response + ? model.C(response) + : model.C(response[0], response[1]); + break; + case "L": + code = response[0]; + var as = response[1]; + 3 === response.length + ? model.L(code, as, response[2]) + : model.L(code, as); + break; + case "m": + "string" === typeof response + ? model.m(response) + : model.m(response[0], response[1]); + break; + case "X": + "string" === typeof response + ? model.X(response) + : model.X(response[0], response[1]); + break; + case "S": + "string" === typeof response + ? model.S(response) + : model.S( + response[0], + 0 === response[1] ? void 0 : response[1], + 3 === response.length ? response[2] : void 0 + ); + break; + case "M": + "string" === typeof response + ? model.M(response) + : model.M(response[0], response[1]); + } + } function createFakeFunction( name, filename, @@ -1965,9 +2080,26 @@ null != debugInfo.owner && initializeFakeStack(response, debugInfo.owner)); } + function resolveDebugInfo(response, id, debugInfo) { + null === debugInfo.owner && null != response._debugRootOwner + ? ((debugInfo.owner = response._debugRootOwner), + (debugInfo.debugStack = response._debugRootStack)) + : initializeFakeStack(response, debugInfo); + response = getChunk(response, id); + (response._debugInfo || (response._debugInfo = [])).push(debugInfo); + } function getCurrentStackInDEV() { return ""; } + function resolveConsoleEntry(response, value) { + if (response._replayConsole) { + var payload = JSON.parse(value, response._fromJSON); + response = payload[0]; + value = payload[3]; + payload = payload.slice(4); + bindToConsole(response, payload, value)(); + } + } function mergeBuffer(buffer, lastChunk) { for ( var l = buffer.length, byteLength = lastChunk.length, i = 0; @@ -2055,120 +2187,44 @@ i++ ) row += stringDecoder.decode(buffer[i], decoderOptions); - buffer = row += stringDecoder.decode(chunk); + row += stringDecoder.decode(chunk); + processFullStringRow(response, id, tag, row); + } + function processFullStringRow(response, id, tag, row) { switch (tag) { case 73: - resolveModule(response, id, buffer); + resolveModule(response, id, row); break; case 72: - id = buffer[0]; - buffer = buffer.slice(1); - response = JSON.parse(buffer, response._fromJSON); - buffer = ReactDOMSharedInternals.d; - switch (id) { - case "D": - buffer.D(response); - break; - case "C": - "string" === typeof response - ? buffer.C(response) - : buffer.C(response[0], response[1]); - break; - case "L": - id = response[0]; - tag = response[1]; - 3 === response.length - ? buffer.L(id, tag, response[2]) - : buffer.L(id, tag); - break; - case "m": - "string" === typeof response - ? buffer.m(response) - : buffer.m(response[0], response[1]); - break; - case "X": - "string" === typeof response - ? buffer.X(response) - : buffer.X(response[0], response[1]); - break; - case "S": - "string" === typeof response - ? buffer.S(response) - : buffer.S( - response[0], - 0 === response[1] ? void 0 : response[1], - 3 === response.length ? response[2] : void 0 - ); - break; - case "M": - "string" === typeof response - ? buffer.M(response) - : buffer.M(response[0], response[1]); - } + resolveHint(response, row[0], row.slice(1)); break; case 69: - stringDecoder = JSON.parse(buffer); - tag = stringDecoder.digest; - chunk = stringDecoder.env; - buffer = Error( - stringDecoder.message || - "An error occurred in the Server Components render but no message was provided" - ); - stringDecoder = stringDecoder.stack; - row = buffer.name + ": " + buffer.message; - if (stringDecoder) - for (i = 0; i < stringDecoder.length; i++) { - var frame = stringDecoder[i], - name = frame[0], - filename = frame[1], - line = frame[2]; - frame = frame[3]; - row = name - ? row + - ("\n at " + - name + - " (" + - filename + - ":" + - line + - ":" + - frame + - ")") - : row + ("\n at " + filename + ":" + line + ":" + frame); - } - buffer.stack = row; - buffer.digest = tag; - buffer.environmentName = chunk; - tag = response._chunks; - (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) - : tag.set(id, new ReactPromise("rejected", null, buffer, response)); + row = JSON.parse(row); + tag = resolveErrorDev(response, row); + tag.digest = row.digest; + row = response._chunks; + var chunk = row.get(id); + chunk + ? triggerErrorOnChunk(chunk, tag) + : row.set(id, new ReactPromise("rejected", null, tag, response)); break; case 84: - tag = response._chunks; - (chunk = tag.get(id)) && "pending" !== chunk.status - ? chunk.reason.enqueueValue(buffer) - : tag.set( - id, - new ReactPromise("fulfilled", buffer, null, response) - ); + resolveText(response, id, row); break; case 68: - buffer = JSON.parse(buffer, response._fromJSON); - null === buffer.owner && null != response._debugRootOwner - ? ((buffer.owner = response._debugRootOwner), - (buffer.debugStack = response._debugRootStack)) - : initializeFakeStack(response, buffer); - response = getChunk(response, id); - (response._debugInfo || (response._debugInfo = [])).push(buffer); + tag = new ReactPromise("resolved_model", row, null, response); + initializeModelChunk(tag); + "fulfilled" === tag.status + ? resolveDebugInfo(response, id, tag.value) + : tag.then( + function (v) { + return resolveDebugInfo(response, id, v); + }, + function () {} + ); break; case 87: - response._replayConsole && - ((buffer = JSON.parse(buffer, response._fromJSON)), - (response = buffer[0]), - (id = buffer[3]), - (buffer = buffer.slice(4)), - bindToConsole(response, buffer, id)()); + resolveConsoleEntry(response, row); break; case 82: startReadableStream(response, id, void 0); @@ -2183,18 +2239,10 @@ startAsyncIterable(response, id, !0); break; case 67: - (response = response._chunks.get(id)) && - "fulfilled" === response.status && - response.reason.close("" === buffer ? '"$undefined"' : buffer); + stopStream(response, id, row); break; default: - (tag = response._chunks), - (chunk = tag.get(id)) - ? resolveModelChunk(chunk, buffer) - : tag.set( - id, - new ReactPromise("resolved_model", buffer, null, response) - ); + resolveModel(response, id, row); } } function createFromJSONCallback(response) { @@ -2530,7 +2578,7 @@ }; exports.encodeReply = function (value, options) { return new Promise(function (resolve, reject) { - processReply( + var abort = processReply( value, "", options && options.temporaryReferences @@ -2539,6 +2587,17 @@ resolve, reject ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(signal.reason); + else { + var listener = function () { + abort(signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } }); }; })(); diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.production.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.production.js index 435913724c14f..a9598f248777a 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.edge.production.js @@ -468,12 +468,17 @@ function processReply( pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } var boundCache = new WeakMap(); function encodeFormData(reference) { @@ -1043,6 +1048,8 @@ function parseModelString(response, parentObject, key, value) { (value = value.slice(2)), getOutlinedModel(response, value, parentObject, key, createFormData) ); + case "Z": + return resolveErrorProd(); case "i": return ( (value = value.slice(2)), @@ -1321,6 +1328,13 @@ function startAsyncIterable(response, id, iterator) { } ); } +function resolveErrorProd() { + var error = Error( + "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." + ); + error.stack = "Error: " + error.message; + return error; +} function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; @@ -1456,12 +1470,9 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { } break; case 69: - tag = JSON.parse(buffer).digest; - buffer = Error( - "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." - ); - buffer.stack = "Error: " + buffer.message; - buffer.digest = tag; + tag = JSON.parse(buffer); + buffer = resolveErrorProd(); + buffer.digest = tag.digest; tag = response._chunks; (chunk = tag.get(id)) ? triggerErrorOnChunk(chunk, buffer) @@ -1678,7 +1689,7 @@ exports.createTemporaryReferenceSet = function () { }; exports.encodeReply = function (value, options) { return new Promise(function (resolve, reject) { - processReply( + var abort = processReply( value, "", options && options.temporaryReferences @@ -1687,5 +1698,16 @@ exports.encodeReply = function (value, options) { resolve, reject ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(signal.reason); + else { + var listener = function () { + abort(signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } }); }; diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.development.js index 0d03e46523530..fb7e4230f8039 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.development.js @@ -749,12 +749,17 @@ pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function encodeFormData(reference) { var resolve, @@ -1548,6 +1553,17 @@ createFormData ) ); + case "Z": + return ( + (value = value.slice(2)), + getOutlinedModel( + response, + value, + parentObject, + key, + resolveErrorDev + ) + ); case "i": return ( (value = value.slice(2)), @@ -1638,6 +1654,23 @@ void 0 === environmentName ? "Server" : environmentName; this._fromJSON = createFromJSONCallback(this); } + function resolveModel(response, id, model) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? resolveModelChunk(chunk, model) + : chunks.set( + id, + new ReactPromise("resolved_model", model, null, response) + ); + } + function resolveText(response, id, text) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk && "pending" !== chunk.status + ? chunk.reason.enqueueValue(text) + : chunks.set(id, new ReactPromise("fulfilled", text, null, response)); + } function resolveBuffer(response, id, buffer) { var chunks = response._chunks, chunk = chunks.get(id); @@ -1877,6 +1910,88 @@ } ); } + function stopStream(response, id, row) { + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === row ? '"$undefined"' : row); + } + function resolveErrorDev(response, errorInfo) { + response = errorInfo.stack; + var env = errorInfo.env; + errorInfo = Error( + errorInfo.message || + "An error occurred in the Server Components render but no message was provided" + ); + var v8StyleStack = errorInfo.name + ": " + errorInfo.message; + if (response) + for (var i = 0; i < response.length; i++) { + var frame = response[i], + name = frame[0], + filename = frame[1], + line = frame[2]; + frame = frame[3]; + v8StyleStack = name + ? v8StyleStack + + ("\n at " + + name + + " (" + + filename + + ":" + + line + + ":" + + frame + + ")") + : v8StyleStack + + ("\n at " + filename + ":" + line + ":" + frame); + } + errorInfo.stack = v8StyleStack; + errorInfo.environmentName = env; + return errorInfo; + } + function resolveHint(response, code, model) { + response = JSON.parse(model, response._fromJSON); + model = ReactDOMSharedInternals.d; + switch (code) { + case "D": + model.D(response); + break; + case "C": + "string" === typeof response + ? model.C(response) + : model.C(response[0], response[1]); + break; + case "L": + code = response[0]; + var as = response[1]; + 3 === response.length + ? model.L(code, as, response[2]) + : model.L(code, as); + break; + case "m": + "string" === typeof response + ? model.m(response) + : model.m(response[0], response[1]); + break; + case "X": + "string" === typeof response + ? model.X(response) + : model.X(response[0], response[1]); + break; + case "S": + "string" === typeof response + ? model.S(response) + : model.S( + response[0], + 0 === response[1] ? void 0 : response[1], + 3 === response.length ? response[2] : void 0 + ); + break; + case "M": + "string" === typeof response + ? model.M(response) + : model.M(response[0], response[1]); + } + } function createFakeFunction( name, filename, @@ -1965,9 +2080,26 @@ null != debugInfo.owner && initializeFakeStack(response, debugInfo.owner)); } + function resolveDebugInfo(response, id, debugInfo) { + null === debugInfo.owner && null != response._debugRootOwner + ? ((debugInfo.owner = response._debugRootOwner), + (debugInfo.debugStack = response._debugRootStack)) + : initializeFakeStack(response, debugInfo); + response = getChunk(response, id); + (response._debugInfo || (response._debugInfo = [])).push(debugInfo); + } function getCurrentStackInDEV() { return ""; } + function resolveConsoleEntry(response, value) { + if (response._replayConsole) { + var payload = JSON.parse(value, response._fromJSON); + response = payload[0]; + value = payload[3]; + payload = payload.slice(4); + bindToConsole(response, payload, value)(); + } + } function mergeBuffer(buffer, lastChunk) { for ( var l = buffer.length, byteLength = lastChunk.length, i = 0; @@ -2055,120 +2187,44 @@ i++ ) row += stringDecoder.decode(buffer[i], decoderOptions); - buffer = row += stringDecoder.decode(chunk); + row += stringDecoder.decode(chunk); + processFullStringRow(response, id, tag, row); + } + function processFullStringRow(response, id, tag, row) { switch (tag) { case 73: - resolveModule(response, id, buffer); + resolveModule(response, id, row); break; case 72: - id = buffer[0]; - buffer = buffer.slice(1); - response = JSON.parse(buffer, response._fromJSON); - buffer = ReactDOMSharedInternals.d; - switch (id) { - case "D": - buffer.D(response); - break; - case "C": - "string" === typeof response - ? buffer.C(response) - : buffer.C(response[0], response[1]); - break; - case "L": - id = response[0]; - tag = response[1]; - 3 === response.length - ? buffer.L(id, tag, response[2]) - : buffer.L(id, tag); - break; - case "m": - "string" === typeof response - ? buffer.m(response) - : buffer.m(response[0], response[1]); - break; - case "X": - "string" === typeof response - ? buffer.X(response) - : buffer.X(response[0], response[1]); - break; - case "S": - "string" === typeof response - ? buffer.S(response) - : buffer.S( - response[0], - 0 === response[1] ? void 0 : response[1], - 3 === response.length ? response[2] : void 0 - ); - break; - case "M": - "string" === typeof response - ? buffer.M(response) - : buffer.M(response[0], response[1]); - } + resolveHint(response, row[0], row.slice(1)); break; case 69: - stringDecoder = JSON.parse(buffer); - tag = stringDecoder.digest; - chunk = stringDecoder.env; - buffer = Error( - stringDecoder.message || - "An error occurred in the Server Components render but no message was provided" - ); - stringDecoder = stringDecoder.stack; - row = buffer.name + ": " + buffer.message; - if (stringDecoder) - for (i = 0; i < stringDecoder.length; i++) { - var frame = stringDecoder[i], - name = frame[0], - filename = frame[1], - line = frame[2]; - frame = frame[3]; - row = name - ? row + - ("\n at " + - name + - " (" + - filename + - ":" + - line + - ":" + - frame + - ")") - : row + ("\n at " + filename + ":" + line + ":" + frame); - } - buffer.stack = row; - buffer.digest = tag; - buffer.environmentName = chunk; - tag = response._chunks; - (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) - : tag.set(id, new ReactPromise("rejected", null, buffer, response)); + row = JSON.parse(row); + tag = resolveErrorDev(response, row); + tag.digest = row.digest; + row = response._chunks; + var chunk = row.get(id); + chunk + ? triggerErrorOnChunk(chunk, tag) + : row.set(id, new ReactPromise("rejected", null, tag, response)); break; case 84: - tag = response._chunks; - (chunk = tag.get(id)) && "pending" !== chunk.status - ? chunk.reason.enqueueValue(buffer) - : tag.set( - id, - new ReactPromise("fulfilled", buffer, null, response) - ); + resolveText(response, id, row); break; case 68: - buffer = JSON.parse(buffer, response._fromJSON); - null === buffer.owner && null != response._debugRootOwner - ? ((buffer.owner = response._debugRootOwner), - (buffer.debugStack = response._debugRootStack)) - : initializeFakeStack(response, buffer); - response = getChunk(response, id); - (response._debugInfo || (response._debugInfo = [])).push(buffer); + tag = new ReactPromise("resolved_model", row, null, response); + initializeModelChunk(tag); + "fulfilled" === tag.status + ? resolveDebugInfo(response, id, tag.value) + : tag.then( + function (v) { + return resolveDebugInfo(response, id, v); + }, + function () {} + ); break; case 87: - response._replayConsole && - ((buffer = JSON.parse(buffer, response._fromJSON)), - (response = buffer[0]), - (id = buffer[3]), - (buffer = buffer.slice(4)), - bindToConsole(response, buffer, id)()); + resolveConsoleEntry(response, row); break; case 82: startReadableStream(response, id, void 0); @@ -2183,18 +2239,10 @@ startAsyncIterable(response, id, !0); break; case 67: - (response = response._chunks.get(id)) && - "fulfilled" === response.status && - response.reason.close("" === buffer ? '"$undefined"' : buffer); + stopStream(response, id, row); break; default: - (tag = response._chunks), - (chunk = tag.get(id)) - ? resolveModelChunk(chunk, buffer) - : tag.set( - id, - new ReactPromise("resolved_model", buffer, null, response) - ); + resolveModel(response, id, row); } } function createFromJSONCallback(response) { diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.production.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.production.js index ebfb140491e98..4d58eebd51dd3 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.node.production.js @@ -469,12 +469,17 @@ function processReply( pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } var boundCache = new WeakMap(); function encodeFormData(reference) { @@ -1044,6 +1049,8 @@ function parseModelString(response, parentObject, key, value) { (value = value.slice(2)), getOutlinedModel(response, value, parentObject, key, createFormData) ); + case "Z": + return resolveErrorProd(); case "i": return ( (value = value.slice(2)), @@ -1322,6 +1329,13 @@ function startAsyncIterable(response, id, iterator) { } ); } +function resolveErrorProd() { + var error = Error( + "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." + ); + error.stack = "Error: " + error.message; + return error; +} function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; @@ -1457,12 +1471,9 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { } break; case 69: - tag = JSON.parse(buffer).digest; - buffer = Error( - "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." - ); - buffer.stack = "Error: " + buffer.message; - buffer.digest = tag; + tag = JSON.parse(buffer); + buffer = resolveErrorProd(); + buffer.digest = tag.digest; tag = response._chunks; (chunk = tag.get(id)) ? triggerErrorOnChunk(chunk, buffer) diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js index 9412fc82a4908..6d30c883032b7 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js @@ -927,7 +927,8 @@ key: key, owner: task.debugOwner }; - outlineModel(request, componentDebugInfo); + componentDebugInfo.props = props; + outlineComponentInfo(request, componentDebugInfo); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; } @@ -1088,7 +1089,7 @@ return ( (type = task.implicitSlot), null === task.keyPath && (task.implicitSlot = !0), - (props = renderModelDestructive( + (request = renderModelDestructive( request, task, emptyRoot, @@ -1096,7 +1097,7 @@ props.children )), (task.implicitSlot = type), - props + request ); if ( null != type && @@ -1122,13 +1123,12 @@ type._store.validated = 1; } } else return renderFunctionComponent(request, task, key, type, props); - request = key; - key = task.keyPath; - null === request - ? (request = key) - : null !== key && (request = key + "," + request); - props = [REACT_ELEMENT_TYPE, type, request, props, task.debugOwner]; - task = task.implicitSlot && null !== request ? [props] : props; + ref = task.keyPath; + null === key ? (key = ref) : null !== ref && (key = ref + "," + key); + null !== task.debugOwner && + outlineComponentInfo(request, task.debugOwner); + request = [REACT_ELEMENT_TYPE, type, key, props, task.debugOwner]; + task = task.implicitSlot && null !== key ? [request] : request; return task; } function pingTask(request, task) { @@ -1398,18 +1398,6 @@ reader.read().then(progress).catch(error); return "$B" + newTask.id.toString(16); } - function isReactComponentInfo(value) { - return ( - (("object" === typeof value.debugTask && - null !== value.debugTask && - "function" === typeof value.debugTask.run) || - value.debugStack instanceof Error) && - "undefined" === typeof value.stack && - "string" === typeof value.name && - "string" === typeof value.env && - void 0 !== value.owner - ); - } function renderModel(request, task, parent, key, value) { var prevKeyPath = task.keyPath, prevImplicitSlot = task.implicitSlot; @@ -1596,6 +1584,7 @@ if (value instanceof Set) return serializeSet(request, value); if ("function" === typeof FormData && value instanceof FormData) return serializeFormData(request, value); + if (value instanceof Error) return serializeErrorValue(request, value); if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -1650,13 +1639,6 @@ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." + describeObjectForErrorMessage(parent, parentPropertyName) ); - if (isReactComponentInfo(value)) - return { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }; if ("Object" !== objectName(value)) callWithDebugContextInDEV(request, task, function () { console.error( @@ -1797,6 +1779,27 @@ closeWithError(request.destination, error)) : ((request.status = CLOSING), (request.fatalError = error)); } + function serializeErrorValue(request, error) { + var env = (0, request.environmentName)(); + try { + var message = String(error.message); + var stack = filterStackTrace(request, error, 0); + var errorEnv = error.environmentName; + "string" === typeof errorEnv && (env = errorEnv); + } catch (x) { + (message = + "An error occurred but serializing the error message failed."), + (stack = []); + } + return ( + "$Z" + + outlineModel(request, { + message: message, + stack: stack, + env: env + }).toString(16) + ); + } function emitErrorChunk(request, id, digest, error) { var env = (0, request.environmentName)(); try { @@ -1831,7 +1834,7 @@ request.completedRegularChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var counter = { objectCount: 0 }; + var counter = { objectLimit: 500 }; debugInfo = stringify(debugInfo, function (parentPropertyName, value) { return renderConsoleValue( request, @@ -1845,6 +1848,32 @@ id = stringToChunk(id); request.completedRegularChunks.push(id); } + function outlineComponentInfo(request, componentInfo) { + if (!request.writtenObjects.has(componentInfo)) { + null != componentInfo.owner && + outlineComponentInfo(request, componentInfo.owner); + var objectLimit = 10; + null != componentInfo.stack && + (objectLimit += componentInfo.stack.length); + objectLimit = { objectLimit: objectLimit }; + var componentDebugInfo = { + name: componentInfo.name, + env: componentInfo.env, + key: componentInfo.key, + owner: componentInfo.owner + }; + componentDebugInfo.props = componentInfo.props; + objectLimit = outlineConsoleValue( + request, + objectLimit, + componentDebugInfo + ); + request.writtenObjects.set( + componentInfo, + serializeByValueID(objectLimit) + ); + } + } function emitTypedArrayChunk(request, id, tag, typedArray) { request.pendingChunks++; var buffer = new Uint8Array( @@ -1892,11 +1921,25 @@ ((parent = request.temporaryReferences.get(value)), void 0 !== parent) ) return "$T" + parent; - if (500 < counter.objectCount) return "$Y"; - counter.objectCount++; parent = request.writtenObjects.get(value); + if (void 0 !== parent) return parent; + if (0 >= counter.objectLimit) return "$Y"; + counter.objectLimit--; + switch (value.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + null != value._owner && + outlineComponentInfo(request, value._owner), + [ + REACT_ELEMENT_TYPE, + value.type, + value.key, + value.props, + value._owner + ] + ); + } if ("function" === typeof value.then) { - if (void 0 !== parent) return parent; switch (value.status) { case "fulfilled": return ( @@ -1914,20 +1957,19 @@ } return "$@"; } - return void 0 !== parent - ? parent - : isArrayImpl(value) - ? value - : value instanceof Map + return isArrayImpl(value) + ? value + : value instanceof Map + ? ((value = Array.from(value)), + "$Q" + outlineConsoleValue(request, counter, value).toString(16)) + : value instanceof Set ? ((value = Array.from(value)), - "$Q" + + "$W" + outlineConsoleValue(request, counter, value).toString(16)) - : value instanceof Set - ? ((value = Array.from(value)), - "$W" + - outlineConsoleValue(request, counter, value).toString(16)) - : "function" === typeof FormData && value instanceof FormData - ? serializeFormData(request, value) + : "function" === typeof FormData && value instanceof FormData + ? serializeFormData(request, value) + : value instanceof Error + ? serializeErrorValue(request, value) : value instanceof ArrayBuffer ? serializeTypedArray(request, "A", new Uint8Array(value)) : value instanceof Int8Array @@ -1971,14 +2013,7 @@ ? serializeBlob(request, value) : getIteratorFn(value) ? Array.from(value) - : isReactComponentInfo(value) - ? { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - } - : value; + : value; } if ("string" === typeof value) return "Z" === value[value.length - 1] && originalValue instanceof Date @@ -2023,7 +2058,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); request.pendingChunks++; @@ -2041,8 +2079,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }, - env = (0, request.environmentName)(); + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(); methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { @@ -2055,7 +2094,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); id = serializeRowHeader("W", id) + args + "\n"; @@ -2066,7 +2108,7 @@ for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, "string" === typeof debugInfo[i].name && - outlineModel(request, debugInfo[i]), + outlineComponentInfo(request, debugInfo[i]), emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js index c8f8dcf3f6dd3..0c6445054c7e5 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.js @@ -1459,6 +1459,7 @@ function renderModelDestructive( (value = Array.from(value.entries())), "$K" + outlineModel(request, value).toString(16) ); + if (value instanceof Error) return "$Z"; if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js index 2de6917697524..675a9901dbf20 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js @@ -936,7 +936,8 @@ key: key, owner: task.debugOwner }; - outlineModel(request, componentDebugInfo); + componentDebugInfo.props = props; + outlineComponentInfo(request, componentDebugInfo); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; } @@ -1105,7 +1106,7 @@ return ( (type = task.implicitSlot), null === task.keyPath && (task.implicitSlot = !0), - (props = renderModelDestructive( + (request = renderModelDestructive( request, task, emptyRoot, @@ -1113,7 +1114,7 @@ props.children )), (task.implicitSlot = type), - props + request ); if ( null != type && @@ -1139,13 +1140,12 @@ type._store.validated = 1; } } else return renderFunctionComponent(request, task, key, type, props); - request = key; - key = task.keyPath; - null === request - ? (request = key) - : null !== key && (request = key + "," + request); - props = [REACT_ELEMENT_TYPE, type, request, props, task.debugOwner]; - task = task.implicitSlot && null !== request ? [props] : props; + ref = task.keyPath; + null === key ? (key = ref) : null !== ref && (key = ref + "," + key); + null !== task.debugOwner && + outlineComponentInfo(request, task.debugOwner); + request = [REACT_ELEMENT_TYPE, type, key, props, task.debugOwner]; + task = task.implicitSlot && null !== key ? [request] : request; return task; } function pingTask(request, task) { @@ -1415,18 +1415,6 @@ reader.read().then(progress).catch(error); return "$B" + newTask.id.toString(16); } - function isReactComponentInfo(value) { - return ( - (("object" === typeof value.debugTask && - null !== value.debugTask && - "function" === typeof value.debugTask.run) || - value.debugStack instanceof Error) && - "undefined" === typeof value.stack && - "string" === typeof value.name && - "string" === typeof value.env && - void 0 !== value.owner - ); - } function renderModel(request, task, parent, key, value) { var prevKeyPath = task.keyPath, prevImplicitSlot = task.implicitSlot; @@ -1613,6 +1601,7 @@ if (value instanceof Set) return serializeSet(request, value); if ("function" === typeof FormData && value instanceof FormData) return serializeFormData(request, value); + if (value instanceof Error) return serializeErrorValue(request, value); if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -1667,13 +1656,6 @@ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." + describeObjectForErrorMessage(parent, parentPropertyName) ); - if (isReactComponentInfo(value)) - return { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }; if ("Object" !== objectName(value)) callWithDebugContextInDEV(request, task, function () { console.error( @@ -1825,6 +1807,27 @@ closeWithError(request.destination, error)) : ((request.status = CLOSING), (request.fatalError = error)); } + function serializeErrorValue(request, error) { + var env = (0, request.environmentName)(); + try { + var message = String(error.message); + var stack = filterStackTrace(request, error, 0); + var errorEnv = error.environmentName; + "string" === typeof errorEnv && (env = errorEnv); + } catch (x) { + (message = + "An error occurred but serializing the error message failed."), + (stack = []); + } + return ( + "$Z" + + outlineModel(request, { + message: message, + stack: stack, + env: env + }).toString(16) + ); + } function emitErrorChunk(request, id, digest, error) { var env = (0, request.environmentName)(); try { @@ -1859,7 +1862,7 @@ request.completedRegularChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var counter = { objectCount: 0 }; + var counter = { objectLimit: 500 }; debugInfo = stringify(debugInfo, function (parentPropertyName, value) { return renderConsoleValue( request, @@ -1873,6 +1876,32 @@ id = stringToChunk(id); request.completedRegularChunks.push(id); } + function outlineComponentInfo(request, componentInfo) { + if (!request.writtenObjects.has(componentInfo)) { + null != componentInfo.owner && + outlineComponentInfo(request, componentInfo.owner); + var objectLimit = 10; + null != componentInfo.stack && + (objectLimit += componentInfo.stack.length); + objectLimit = { objectLimit: objectLimit }; + var componentDebugInfo = { + name: componentInfo.name, + env: componentInfo.env, + key: componentInfo.key, + owner: componentInfo.owner + }; + componentDebugInfo.props = componentInfo.props; + objectLimit = outlineConsoleValue( + request, + objectLimit, + componentDebugInfo + ); + request.writtenObjects.set( + componentInfo, + serializeByValueID(objectLimit) + ); + } + } function emitTypedArrayChunk(request, id, tag, typedArray) { request.pendingChunks++; var buffer = new Uint8Array( @@ -1920,11 +1949,25 @@ ((parent = request.temporaryReferences.get(value)), void 0 !== parent) ) return "$T" + parent; - if (500 < counter.objectCount) return "$Y"; - counter.objectCount++; parent = request.writtenObjects.get(value); + if (void 0 !== parent) return parent; + if (0 >= counter.objectLimit) return "$Y"; + counter.objectLimit--; + switch (value.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + null != value._owner && + outlineComponentInfo(request, value._owner), + [ + REACT_ELEMENT_TYPE, + value.type, + value.key, + value.props, + value._owner + ] + ); + } if ("function" === typeof value.then) { - if (void 0 !== parent) return parent; switch (value.status) { case "fulfilled": return ( @@ -1942,20 +1985,19 @@ } return "$@"; } - return void 0 !== parent - ? parent - : isArrayImpl(value) - ? value - : value instanceof Map + return isArrayImpl(value) + ? value + : value instanceof Map + ? ((value = Array.from(value)), + "$Q" + outlineConsoleValue(request, counter, value).toString(16)) + : value instanceof Set ? ((value = Array.from(value)), - "$Q" + + "$W" + outlineConsoleValue(request, counter, value).toString(16)) - : value instanceof Set - ? ((value = Array.from(value)), - "$W" + - outlineConsoleValue(request, counter, value).toString(16)) - : "function" === typeof FormData && value instanceof FormData - ? serializeFormData(request, value) + : "function" === typeof FormData && value instanceof FormData + ? serializeFormData(request, value) + : value instanceof Error + ? serializeErrorValue(request, value) : value instanceof ArrayBuffer ? serializeTypedArray(request, "A", new Uint8Array(value)) : value instanceof Int8Array @@ -1999,14 +2041,7 @@ ? serializeBlob(request, value) : getIteratorFn(value) ? Array.from(value) - : isReactComponentInfo(value) - ? { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - } - : value; + : value; } if ("string" === typeof value) return "Z" === value[value.length - 1] && originalValue instanceof Date @@ -2051,7 +2086,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); request.pendingChunks++; @@ -2069,8 +2107,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }, - env = (0, request.environmentName)(); + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(); methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { @@ -2083,7 +2122,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); id = serializeRowHeader("W", id) + args + "\n"; @@ -2094,7 +2136,7 @@ for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, "string" === typeof debugInfo[i].name && - outlineModel(request, debugInfo[i]), + outlineComponentInfo(request, debugInfo[i]), emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js index c51b670753fc1..b1551003813c1 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.js @@ -1464,6 +1464,7 @@ function renderModelDestructive( (value = Array.from(value.entries())), "$K" + outlineModel(request, value).toString(16) ); + if (value instanceof Error) return "$Z"; if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js index feaa02910e419..1c534c9341d7d 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js @@ -956,7 +956,8 @@ key: key, owner: task.debugOwner }; - outlineModel(request, componentDebugInfo); + componentDebugInfo.props = props; + outlineComponentInfo(request, componentDebugInfo); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; } @@ -1123,7 +1124,7 @@ return ( (type = task.implicitSlot), null === task.keyPath && (task.implicitSlot = !0), - (props = renderModelDestructive( + (request = renderModelDestructive( request, task, emptyRoot, @@ -1131,7 +1132,7 @@ props.children )), (task.implicitSlot = type), - props + request ); if ( null != type && @@ -1157,13 +1158,12 @@ type._store.validated = 1; } } else return renderFunctionComponent(request, task, key, type, props); - request = key; - key = task.keyPath; - null === request - ? (request = key) - : null !== key && (request = key + "," + request); - props = [REACT_ELEMENT_TYPE, type, request, props, task.debugOwner]; - task = task.implicitSlot && null !== request ? [props] : props; + ref = task.keyPath; + null === key ? (key = ref) : null !== ref && (key = ref + "," + key); + null !== task.debugOwner && + outlineComponentInfo(request, task.debugOwner); + request = [REACT_ELEMENT_TYPE, type, key, props, task.debugOwner]; + task = task.implicitSlot && null !== key ? [request] : request; return task; } function pingTask(request, task) { @@ -1431,18 +1431,6 @@ reader.read().then(progress).catch(error); return "$B" + newTask.id.toString(16); } - function isReactComponentInfo(value) { - return ( - (("object" === typeof value.debugTask && - null !== value.debugTask && - "function" === typeof value.debugTask.run) || - value.debugStack instanceof Error) && - "undefined" === typeof value.stack && - "string" === typeof value.name && - "string" === typeof value.env && - void 0 !== value.owner - ); - } function renderModel(request, task, parent, key, value) { var prevKeyPath = task.keyPath, prevImplicitSlot = task.implicitSlot; @@ -1629,6 +1617,7 @@ if (value instanceof Set) return serializeSet(request, value); if ("function" === typeof FormData && value instanceof FormData) return serializeFormData(request, value); + if (value instanceof Error) return serializeErrorValue(request, value); if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -1683,13 +1672,6 @@ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." + describeObjectForErrorMessage(parent, parentPropertyName) ); - if (isReactComponentInfo(value)) - return { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }; if ("Object" !== objectName(value)) callWithDebugContextInDEV(request, task, function () { console.error( @@ -1836,6 +1818,27 @@ ? ((request.status = CLOSED), request.destination.destroy(error)) : ((request.status = CLOSING), (request.fatalError = error)); } + function serializeErrorValue(request, error) { + var env = (0, request.environmentName)(); + try { + var message = String(error.message); + var stack = filterStackTrace(request, error, 0); + var errorEnv = error.environmentName; + "string" === typeof errorEnv && (env = errorEnv); + } catch (x) { + (message = + "An error occurred but serializing the error message failed."), + (stack = []); + } + return ( + "$Z" + + outlineModel(request, { + message: message, + stack: stack, + env: env + }).toString(16) + ); + } function emitErrorChunk(request, id, digest, error) { var env = (0, request.environmentName)(); try { @@ -1868,7 +1871,7 @@ request.completedRegularChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var counter = { objectCount: 0 }; + var counter = { objectLimit: 500 }; debugInfo = stringify(debugInfo, function (parentPropertyName, value) { return renderConsoleValue( request, @@ -1881,6 +1884,32 @@ id = serializeRowHeader("D", id) + debugInfo + "\n"; request.completedRegularChunks.push(id); } + function outlineComponentInfo(request, componentInfo) { + if (!request.writtenObjects.has(componentInfo)) { + null != componentInfo.owner && + outlineComponentInfo(request, componentInfo.owner); + var objectLimit = 10; + null != componentInfo.stack && + (objectLimit += componentInfo.stack.length); + objectLimit = { objectLimit: objectLimit }; + var componentDebugInfo = { + name: componentInfo.name, + env: componentInfo.env, + key: componentInfo.key, + owner: componentInfo.owner + }; + componentDebugInfo.props = componentInfo.props; + objectLimit = outlineConsoleValue( + request, + objectLimit, + componentDebugInfo + ); + request.writtenObjects.set( + componentInfo, + serializeByValueID(objectLimit) + ); + } + } function emitTypedArrayChunk(request, id, tag, typedArray) { request.pendingChunks++; typedArray = new Uint8Array( @@ -1924,11 +1953,25 @@ ((parent = request.temporaryReferences.get(value)), void 0 !== parent) ) return "$T" + parent; - if (500 < counter.objectCount) return "$Y"; - counter.objectCount++; parent = request.writtenObjects.get(value); + if (void 0 !== parent) return parent; + if (0 >= counter.objectLimit) return "$Y"; + counter.objectLimit--; + switch (value.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + null != value._owner && + outlineComponentInfo(request, value._owner), + [ + REACT_ELEMENT_TYPE, + value.type, + value.key, + value.props, + value._owner + ] + ); + } if ("function" === typeof value.then) { - if (void 0 !== parent) return parent; switch (value.status) { case "fulfilled": return ( @@ -1946,20 +1989,19 @@ } return "$@"; } - return void 0 !== parent - ? parent - : isArrayImpl(value) - ? value - : value instanceof Map + return isArrayImpl(value) + ? value + : value instanceof Map + ? ((value = Array.from(value)), + "$Q" + outlineConsoleValue(request, counter, value).toString(16)) + : value instanceof Set ? ((value = Array.from(value)), - "$Q" + + "$W" + outlineConsoleValue(request, counter, value).toString(16)) - : value instanceof Set - ? ((value = Array.from(value)), - "$W" + - outlineConsoleValue(request, counter, value).toString(16)) - : "function" === typeof FormData && value instanceof FormData - ? serializeFormData(request, value) + : "function" === typeof FormData && value instanceof FormData + ? serializeFormData(request, value) + : value instanceof Error + ? serializeErrorValue(request, value) : value instanceof ArrayBuffer ? serializeTypedArray(request, "A", new Uint8Array(value)) : value instanceof Int8Array @@ -2003,14 +2045,7 @@ ? serializeBlob(request, value) : getIteratorFn(value) ? Array.from(value) - : isReactComponentInfo(value) - ? { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - } - : value; + : value; } if ("string" === typeof value) return "Z" === value[value.length - 1] && originalValue instanceof Date @@ -2055,7 +2090,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); request.pendingChunks++; @@ -2072,8 +2110,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }, - env = (0, request.environmentName)(); + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(); methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { @@ -2086,7 +2125,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); id = serializeRowHeader("W", id) + args + "\n"; @@ -2096,7 +2138,7 @@ for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, "string" === typeof debugInfo[i].name && - outlineModel(request, debugInfo[i]), + outlineComponentInfo(request, debugInfo[i]), emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { diff --git a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js index 451412483fb86..b2c2ec1b430ab 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js +++ b/packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.js @@ -1477,6 +1477,7 @@ function renderModelDestructive( (value = Array.from(value.entries())), "$K" + outlineModel(request, value).toString(16) ); + if (value instanceof Error) return "$Z"; if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -2773,12 +2774,12 @@ exports.decodeReplyFromBusboy = function (busboyStream, turbopackMap, options) { "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_212 = []; + var JSCompiler_object_inline_chunks_216 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_212.push(chunk); + JSCompiler_object_inline_chunks_216.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_212, { + var blob = new Blob(JSCompiler_object_inline_chunks_216, { type: mimeType }); response._formData.append(name, blob, filename); diff --git a/packages/next/src/compiled/react-server-dom-turbopack/package.json b/packages/next/src/compiled/react-server-dom-turbopack/package.json index d741006371ee1..d6b633f57918a 100644 --- a/packages/next/src/compiled/react-server-dom-turbopack/package.json +++ b/packages/next/src/compiled/react-server-dom-turbopack/package.json @@ -48,7 +48,7 @@ "neo-async": "^2.6.1" }, "peerDependencies": { - "react": "19.0.0-rc-2d16326d-20240930", - "react-dom": "19.0.0-rc-2d16326d-20240930" + "react": "19.0.0-rc-1460d67c-20241003", + "react-dom": "19.0.0-rc-1460d67c-20241003" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js index 03dec13b5ab89..f00cae6984dd0 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js @@ -697,12 +697,17 @@ pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function createFakeServerFunction( name, @@ -1337,6 +1342,17 @@ createFormData ) ); + case "Z": + return ( + (value = value.slice(2)), + getOutlinedModel( + response, + value, + parentObject, + key, + resolveErrorDev + ) + ); case "i": return ( (value = value.slice(2)), @@ -1431,6 +1447,23 @@ this._rootEnvironmentName = environmentName; this._fromJSON = createFromJSONCallback(this); } + function resolveModel(response, id, model) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? resolveModelChunk(chunk, model) + : chunks.set( + id, + new ReactPromise("resolved_model", model, null, response) + ); + } + function resolveText(response, id, text) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk && "pending" !== chunk.status + ? chunk.reason.enqueueValue(text) + : chunks.set(id, new ReactPromise("fulfilled", text, null, response)); + } function resolveBuffer(response, id, buffer) { var chunks = response._chunks, chunk = chunks.get(id); @@ -1665,6 +1698,87 @@ } ); } + function stopStream(response, id, row) { + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === row ? '"$undefined"' : row); + } + function resolveErrorDev(response, errorInfo) { + var env = errorInfo.env; + errorInfo = buildFakeCallStack( + response, + errorInfo.stack, + env, + Error.bind( + null, + errorInfo.message || + "An error occurred in the Server Components render but no message was provided" + ) + ); + response = getRootTask(response, env); + response = null != response ? response.run(errorInfo) : errorInfo(); + response.environmentName = env; + return response; + } + function resolvePostponeDev(response, id, reason, stack, env) { + reason = buildFakeCallStack( + response, + stack, + env, + Error.bind(null, reason || "") + ); + stack = response._debugRootTask; + reason = null != stack ? stack.run(reason) : reason(); + reason.$$typeof = REACT_POSTPONE_TYPE; + stack = response._chunks; + (env = stack.get(id)) + ? triggerErrorOnChunk(env, reason) + : stack.set(id, new ReactPromise("rejected", null, reason, response)); + } + function resolveHint(response, code, model) { + response = JSON.parse(model, response._fromJSON); + model = ReactDOMSharedInternals.d; + switch (code) { + case "D": + model.D(response); + break; + case "C": + "string" === typeof response + ? model.C(response) + : model.C(response[0], response[1]); + break; + case "L": + code = response[0]; + var as = response[1]; + 3 === response.length + ? model.L(code, as, response[2]) + : model.L(code, as); + break; + case "m": + "string" === typeof response + ? model.m(response) + : model.m(response[0], response[1]); + break; + case "X": + "string" === typeof response + ? model.X(response) + : model.X(response[0], response[1]); + break; + case "S": + "string" === typeof response + ? model.S(response) + : model.S( + response[0], + 0 === response[1] ? void 0 : response[1], + 3 === response.length ? response[2] : void 0 + ); + break; + case "M": + "string" === typeof response + ? model.M(response) + : model.M(response[0], response[1]); + } + } function createFakeFunction( name, filename, @@ -1806,6 +1920,19 @@ null != debugInfo.owner && initializeFakeStack(response, debugInfo.owner)); } + function resolveDebugInfo(response, id, debugInfo) { + initializeFakeTask( + response, + debugInfo, + void 0 === debugInfo.env ? response._rootEnvironmentName : debugInfo.env + ); + null === debugInfo.owner && null != response._debugRootOwner + ? ((debugInfo.owner = response._debugRootOwner), + (debugInfo.debugStack = response._debugRootStack)) + : initializeFakeStack(response, debugInfo); + response = getChunk(response, id); + (response._debugInfo || (response._debugInfo = [])).push(debugInfo); + } function getCurrentStackInDEV() { var owner = currentOwnerInDEV; if (null === owner) return ""; @@ -1861,6 +1988,24 @@ } return JSCompiler_inline_result$jscomp$0; } + function resolveConsoleEntry(response, value) { + if (response._replayConsole) { + var payload = JSON.parse(value, response._fromJSON); + value = payload[0]; + var stackTrace = payload[1], + owner = payload[2], + env = payload[3]; + payload = payload.slice(4); + replayConsoleWithCallStackInDEV( + response, + value, + stackTrace, + owner, + env, + payload + ); + } + } function mergeBuffer(buffer, lastChunk) { for ( var l = buffer.length, byteLength = lastChunk.length, i = 0; @@ -1948,122 +2093,44 @@ i++ ) row += stringDecoder.decode(buffer[i], decoderOptions); - buffer = row += stringDecoder.decode(chunk); + row += stringDecoder.decode(chunk); + processFullStringRow(response, id, tag, row); + } + function processFullStringRow(response, id, tag, row) { switch (tag) { case 73: - resolveModule(response, id, buffer); + resolveModule(response, id, row); break; case 72: - id = buffer[0]; - buffer = buffer.slice(1); - response = JSON.parse(buffer, response._fromJSON); - buffer = ReactDOMSharedInternals.d; - switch (id) { - case "D": - buffer.D(response); - break; - case "C": - "string" === typeof response - ? buffer.C(response) - : buffer.C(response[0], response[1]); - break; - case "L": - id = response[0]; - tag = response[1]; - 3 === response.length - ? buffer.L(id, tag, response[2]) - : buffer.L(id, tag); - break; - case "m": - "string" === typeof response - ? buffer.m(response) - : buffer.m(response[0], response[1]); - break; - case "X": - "string" === typeof response - ? buffer.X(response) - : buffer.X(response[0], response[1]); - break; - case "S": - "string" === typeof response - ? buffer.S(response) - : buffer.S( - response[0], - 0 === response[1] ? void 0 : response[1], - 3 === response.length ? response[2] : void 0 - ); - break; - case "M": - "string" === typeof response - ? buffer.M(response) - : buffer.M(response[0], response[1]); - } + resolveHint(response, row[0], row.slice(1)); break; case 69: - chunk = JSON.parse(buffer); - buffer = chunk.digest; - tag = chunk.env; - chunk = buildFakeCallStack( - response, - chunk.stack, - tag, - Error.bind( - null, - chunk.message || - "An error occurred in the Server Components render but no message was provided" - ) - ); - stringDecoder = getRootTask(response, tag); - chunk = null != stringDecoder ? stringDecoder.run(chunk) : chunk(); - chunk.digest = buffer; - chunk.environmentName = tag; - buffer = response._chunks; - (tag = buffer.get(id)) - ? triggerErrorOnChunk(tag, chunk) - : buffer.set( - id, - new ReactPromise("rejected", null, chunk, response) - ); + row = JSON.parse(row); + tag = resolveErrorDev(response, row); + tag.digest = row.digest; + row = response._chunks; + var chunk = row.get(id); + chunk + ? triggerErrorOnChunk(chunk, tag) + : row.set(id, new ReactPromise("rejected", null, tag, response)); break; case 84: - tag = response._chunks; - (chunk = tag.get(id)) && "pending" !== chunk.status - ? chunk.reason.enqueueValue(buffer) - : tag.set( - id, - new ReactPromise("fulfilled", buffer, null, response) - ); + resolveText(response, id, row); break; case 68: - buffer = JSON.parse(buffer, response._fromJSON); - initializeFakeTask( - response, - buffer, - void 0 === buffer.env ? response._rootEnvironmentName : buffer.env - ); - null === buffer.owner && null != response._debugRootOwner - ? ((buffer.owner = response._debugRootOwner), - (buffer.debugStack = response._debugRootStack)) - : initializeFakeStack(response, buffer); - response = getChunk(response, id); - (response._debugInfo || (response._debugInfo = [])).push(buffer); + tag = new ReactPromise("resolved_model", row, null, response); + initializeModelChunk(tag); + "fulfilled" === tag.status + ? resolveDebugInfo(response, id, tag.value) + : tag.then( + function (v) { + return resolveDebugInfo(response, id, v); + }, + function () {} + ); break; case 87: - response._replayConsole && - ((stringDecoder = JSON.parse(buffer, response._fromJSON)), - (id = stringDecoder[0]), - (buffer = stringDecoder[1]), - (tag = stringDecoder[2]), - (chunk = stringDecoder[3]), - (stringDecoder = stringDecoder.slice(4)), - replayConsoleWithCallStackInDEV( - response, - id, - buffer, - tag, - chunk, - stringDecoder - )); + resolveConsoleEntry(response, row); break; case 82: startReadableStream(response, id, void 0); @@ -2078,34 +2145,14 @@ startAsyncIterable(response, id, !0); break; case 67: - (response = response._chunks.get(id)) && - "fulfilled" === response.status && - response.reason.close("" === buffer ? '"$undefined"' : buffer); + stopStream(response, id, row); break; case 80: - buffer = JSON.parse(buffer); - buffer = buildFakeCallStack( - response, - buffer.stack, - buffer.env, - Error.bind(null, buffer.reason || "") - ); - tag = response._debugRootTask; - buffer = null != tag ? tag.run(buffer) : buffer(); - buffer.$$typeof = REACT_POSTPONE_TYPE; - tag = response._chunks; - (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) - : tag.set(id, new ReactPromise("rejected", null, buffer, response)); + tag = JSON.parse(row); + resolvePostponeDev(response, id, tag.reason, tag.stack, tag.env); break; default: - (tag = response._chunks), - (chunk = tag.get(id)) - ? resolveModelChunk(chunk, buffer) - : tag.set( - id, - new ReactPromise("resolved_model", buffer, null, response) - ); + resolveModel(response, id, row); } } function createFromJSONCallback(response) { @@ -2512,10 +2559,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.0.0-experimental-2d16326d-20240930", + version: "19.0.0-experimental-1460d67c-20241003", rendererPackageName: "react-server-dom-webpack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.0.0-experimental-2d16326d-20240930", + reconcilerVersion: "19.0.0-experimental-1460d67c-20241003", getCurrentComponentInfo: function () { return currentOwnerInDEV; } @@ -2575,7 +2622,7 @@ }; exports.encodeReply = function (value, options) { return new Promise(function (resolve, reject) { - processReply( + var abort = processReply( value, "", options && options.temporaryReferences @@ -2584,6 +2631,17 @@ resolve, reject ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(signal.reason); + else { + var listener = function () { + abort(signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } }); }; })(); diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.production.js index 5e9fb3131031a..9655a380b595c 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.production.js @@ -458,12 +458,17 @@ function processReply( pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function registerServerReference(proxy, reference) { knownServerReferences.set(proxy, reference); @@ -887,6 +892,8 @@ function parseModelString(response, parentObject, key, value) { (value = value.slice(2)), getOutlinedModel(response, value, parentObject, key, createFormData) ); + case "Z": + return resolveErrorProd(); case "i": return ( (value = value.slice(2)), @@ -1160,6 +1167,13 @@ function startAsyncIterable(response, id, iterator) { } ); } +function resolveErrorProd() { + var error = Error( + "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." + ); + error.stack = "Error: " + error.message; + return error; +} function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; @@ -1295,12 +1309,9 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { } break; case 69: - tag = JSON.parse(buffer).digest; - buffer = Error( - "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." - ); - buffer.stack = "Error: " + buffer.message; - buffer.digest = tag; + tag = JSON.parse(buffer); + buffer = resolveErrorProd(); + buffer.digest = tag.digest; tag = response._chunks; (chunk = tag.get(id)) ? triggerErrorOnChunk(chunk, buffer) @@ -1528,7 +1539,7 @@ exports.createTemporaryReferenceSet = function () { }; exports.encodeReply = function (value, options) { return new Promise(function (resolve, reject) { - processReply( + var abort = processReply( value, "", options && options.temporaryReferences @@ -1537,5 +1548,16 @@ exports.encodeReply = function (value, options) { resolve, reject ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(signal.reason); + else { + var listener = function () { + abort(signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } }); }; diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.development.js index 9926673a9ce66..4a0c41be0b05c 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.development.js @@ -718,12 +718,17 @@ pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function encodeFormData(reference) { var resolve, @@ -1541,6 +1546,17 @@ createFormData ) ); + case "Z": + return ( + (value = value.slice(2)), + getOutlinedModel( + response, + value, + parentObject, + key, + resolveErrorDev + ) + ); case "i": return ( (value = value.slice(2)), @@ -1635,6 +1651,23 @@ this._rootEnvironmentName = environmentName; this._fromJSON = createFromJSONCallback(this); } + function resolveModel(response, id, model) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? resolveModelChunk(chunk, model) + : chunks.set( + id, + new ReactPromise("resolved_model", model, null, response) + ); + } + function resolveText(response, id, text) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk && "pending" !== chunk.status + ? chunk.reason.enqueueValue(text) + : chunks.set(id, new ReactPromise("fulfilled", text, null, response)); + } function resolveBuffer(response, id, buffer) { var chunks = response._chunks, chunk = chunks.get(id); @@ -1874,6 +1907,87 @@ } ); } + function stopStream(response, id, row) { + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === row ? '"$undefined"' : row); + } + function resolveErrorDev(response, errorInfo) { + var env = errorInfo.env; + errorInfo = buildFakeCallStack( + response, + errorInfo.stack, + env, + Error.bind( + null, + errorInfo.message || + "An error occurred in the Server Components render but no message was provided" + ) + ); + response = getRootTask(response, env); + response = null != response ? response.run(errorInfo) : errorInfo(); + response.environmentName = env; + return response; + } + function resolvePostponeDev(response, id, reason, stack, env) { + reason = buildFakeCallStack( + response, + stack, + env, + Error.bind(null, reason || "") + ); + stack = response._debugRootTask; + reason = null != stack ? stack.run(reason) : reason(); + reason.$$typeof = REACT_POSTPONE_TYPE; + stack = response._chunks; + (env = stack.get(id)) + ? triggerErrorOnChunk(env, reason) + : stack.set(id, new ReactPromise("rejected", null, reason, response)); + } + function resolveHint(response, code, model) { + response = JSON.parse(model, response._fromJSON); + model = ReactDOMSharedInternals.d; + switch (code) { + case "D": + model.D(response); + break; + case "C": + "string" === typeof response + ? model.C(response) + : model.C(response[0], response[1]); + break; + case "L": + code = response[0]; + var as = response[1]; + 3 === response.length + ? model.L(code, as, response[2]) + : model.L(code, as); + break; + case "m": + "string" === typeof response + ? model.m(response) + : model.m(response[0], response[1]); + break; + case "X": + "string" === typeof response + ? model.X(response) + : model.X(response[0], response[1]); + break; + case "S": + "string" === typeof response + ? model.S(response) + : model.S( + response[0], + 0 === response[1] ? void 0 : response[1], + 3 === response.length ? response[2] : void 0 + ); + break; + case "M": + "string" === typeof response + ? model.M(response) + : model.M(response[0], response[1]); + } + } function createFakeFunction( name, filename, @@ -2015,6 +2129,19 @@ null != debugInfo.owner && initializeFakeStack(response, debugInfo.owner)); } + function resolveDebugInfo(response, id, debugInfo) { + initializeFakeTask( + response, + debugInfo, + void 0 === debugInfo.env ? response._rootEnvironmentName : debugInfo.env + ); + null === debugInfo.owner && null != response._debugRootOwner + ? ((debugInfo.owner = response._debugRootOwner), + (debugInfo.debugStack = response._debugRootStack)) + : initializeFakeStack(response, debugInfo); + response = getChunk(response, id); + (response._debugInfo || (response._debugInfo = [])).push(debugInfo); + } function getCurrentStackInDEV() { var owner = currentOwnerInDEV; if (null === owner) return ""; @@ -2070,6 +2197,24 @@ } return JSCompiler_inline_result$jscomp$0; } + function resolveConsoleEntry(response, value) { + if (response._replayConsole) { + var payload = JSON.parse(value, response._fromJSON); + value = payload[0]; + var stackTrace = payload[1], + owner = payload[2], + env = payload[3]; + payload = payload.slice(4); + replayConsoleWithCallStackInDEV( + response, + value, + stackTrace, + owner, + env, + payload + ); + } + } function mergeBuffer(buffer, lastChunk) { for ( var l = buffer.length, byteLength = lastChunk.length, i = 0; @@ -2157,122 +2302,44 @@ i++ ) row += stringDecoder.decode(buffer[i], decoderOptions); - buffer = row += stringDecoder.decode(chunk); + row += stringDecoder.decode(chunk); + processFullStringRow(response, id, tag, row); + } + function processFullStringRow(response, id, tag, row) { switch (tag) { case 73: - resolveModule(response, id, buffer); + resolveModule(response, id, row); break; case 72: - id = buffer[0]; - buffer = buffer.slice(1); - response = JSON.parse(buffer, response._fromJSON); - buffer = ReactDOMSharedInternals.d; - switch (id) { - case "D": - buffer.D(response); - break; - case "C": - "string" === typeof response - ? buffer.C(response) - : buffer.C(response[0], response[1]); - break; - case "L": - id = response[0]; - tag = response[1]; - 3 === response.length - ? buffer.L(id, tag, response[2]) - : buffer.L(id, tag); - break; - case "m": - "string" === typeof response - ? buffer.m(response) - : buffer.m(response[0], response[1]); - break; - case "X": - "string" === typeof response - ? buffer.X(response) - : buffer.X(response[0], response[1]); - break; - case "S": - "string" === typeof response - ? buffer.S(response) - : buffer.S( - response[0], - 0 === response[1] ? void 0 : response[1], - 3 === response.length ? response[2] : void 0 - ); - break; - case "M": - "string" === typeof response - ? buffer.M(response) - : buffer.M(response[0], response[1]); - } + resolveHint(response, row[0], row.slice(1)); break; case 69: - chunk = JSON.parse(buffer); - buffer = chunk.digest; - tag = chunk.env; - chunk = buildFakeCallStack( - response, - chunk.stack, - tag, - Error.bind( - null, - chunk.message || - "An error occurred in the Server Components render but no message was provided" - ) - ); - stringDecoder = getRootTask(response, tag); - chunk = null != stringDecoder ? stringDecoder.run(chunk) : chunk(); - chunk.digest = buffer; - chunk.environmentName = tag; - buffer = response._chunks; - (tag = buffer.get(id)) - ? triggerErrorOnChunk(tag, chunk) - : buffer.set( - id, - new ReactPromise("rejected", null, chunk, response) - ); + row = JSON.parse(row); + tag = resolveErrorDev(response, row); + tag.digest = row.digest; + row = response._chunks; + var chunk = row.get(id); + chunk + ? triggerErrorOnChunk(chunk, tag) + : row.set(id, new ReactPromise("rejected", null, tag, response)); break; case 84: - tag = response._chunks; - (chunk = tag.get(id)) && "pending" !== chunk.status - ? chunk.reason.enqueueValue(buffer) - : tag.set( - id, - new ReactPromise("fulfilled", buffer, null, response) - ); + resolveText(response, id, row); break; case 68: - buffer = JSON.parse(buffer, response._fromJSON); - initializeFakeTask( - response, - buffer, - void 0 === buffer.env ? response._rootEnvironmentName : buffer.env - ); - null === buffer.owner && null != response._debugRootOwner - ? ((buffer.owner = response._debugRootOwner), - (buffer.debugStack = response._debugRootStack)) - : initializeFakeStack(response, buffer); - response = getChunk(response, id); - (response._debugInfo || (response._debugInfo = [])).push(buffer); + tag = new ReactPromise("resolved_model", row, null, response); + initializeModelChunk(tag); + "fulfilled" === tag.status + ? resolveDebugInfo(response, id, tag.value) + : tag.then( + function (v) { + return resolveDebugInfo(response, id, v); + }, + function () {} + ); break; case 87: - response._replayConsole && - ((stringDecoder = JSON.parse(buffer, response._fromJSON)), - (id = stringDecoder[0]), - (buffer = stringDecoder[1]), - (tag = stringDecoder[2]), - (chunk = stringDecoder[3]), - (stringDecoder = stringDecoder.slice(4)), - replayConsoleWithCallStackInDEV( - response, - id, - buffer, - tag, - chunk, - stringDecoder - )); + resolveConsoleEntry(response, row); break; case 82: startReadableStream(response, id, void 0); @@ -2287,34 +2354,14 @@ startAsyncIterable(response, id, !0); break; case 67: - (response = response._chunks.get(id)) && - "fulfilled" === response.status && - response.reason.close("" === buffer ? '"$undefined"' : buffer); + stopStream(response, id, row); break; case 80: - buffer = JSON.parse(buffer); - buffer = buildFakeCallStack( - response, - buffer.stack, - buffer.env, - Error.bind(null, buffer.reason || "") - ); - tag = response._debugRootTask; - buffer = null != tag ? tag.run(buffer) : buffer(); - buffer.$$typeof = REACT_POSTPONE_TYPE; - tag = response._chunks; - (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) - : tag.set(id, new ReactPromise("rejected", null, buffer, response)); + tag = JSON.parse(row); + resolvePostponeDev(response, id, tag.reason, tag.stack, tag.env); break; default: - (tag = response._chunks), - (chunk = tag.get(id)) - ? resolveModelChunk(chunk, buffer) - : tag.set( - id, - new ReactPromise("resolved_model", buffer, null, response) - ); + resolveModel(response, id, row); } } function createFromJSONCallback(response) { @@ -2734,7 +2781,7 @@ }; exports.encodeReply = function (value, options) { return new Promise(function (resolve, reject) { - processReply( + var abort = processReply( value, "", options && options.temporaryReferences @@ -2743,6 +2790,17 @@ resolve, reject ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(signal.reason); + else { + var listener = function () { + abort(signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } }); }; })(); diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.production.js index 379be5588c48a..4ac53ab724cbe 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.edge.production.js @@ -470,12 +470,17 @@ function processReply( pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } var boundCache = new WeakMap(); function encodeFormData(reference) { @@ -1045,6 +1050,8 @@ function parseModelString(response, parentObject, key, value) { (value = value.slice(2)), getOutlinedModel(response, value, parentObject, key, createFormData) ); + case "Z": + return resolveErrorProd(); case "i": return ( (value = value.slice(2)), @@ -1323,6 +1330,13 @@ function startAsyncIterable(response, id, iterator) { } ); } +function resolveErrorProd() { + var error = Error( + "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." + ); + error.stack = "Error: " + error.message; + return error; +} function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; @@ -1458,12 +1472,9 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { } break; case 69: - tag = JSON.parse(buffer).digest; - buffer = Error( - "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." - ); - buffer.stack = "Error: " + buffer.message; - buffer.digest = tag; + tag = JSON.parse(buffer); + buffer = resolveErrorProd(); + buffer.digest = tag.digest; tag = response._chunks; (chunk = tag.get(id)) ? triggerErrorOnChunk(chunk, buffer) @@ -1691,7 +1702,7 @@ exports.createTemporaryReferenceSet = function () { }; exports.encodeReply = function (value, options) { return new Promise(function (resolve, reject) { - processReply( + var abort = processReply( value, "", options && options.temporaryReferences @@ -1700,5 +1711,16 @@ exports.encodeReply = function (value, options) { resolve, reject ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(signal.reason); + else { + var listener = function () { + abort(signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } }); }; diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.development.js index 26568ec942508..a8affd8d36b31 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.development.js @@ -718,12 +718,17 @@ pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function encodeFormData(reference) { var resolve, @@ -1541,6 +1546,17 @@ createFormData ) ); + case "Z": + return ( + (value = value.slice(2)), + getOutlinedModel( + response, + value, + parentObject, + key, + resolveErrorDev + ) + ); case "i": return ( (value = value.slice(2)), @@ -1635,6 +1651,23 @@ this._rootEnvironmentName = environmentName; this._fromJSON = createFromJSONCallback(this); } + function resolveModel(response, id, model) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? resolveModelChunk(chunk, model) + : chunks.set( + id, + new ReactPromise("resolved_model", model, null, response) + ); + } + function resolveText(response, id, text) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk && "pending" !== chunk.status + ? chunk.reason.enqueueValue(text) + : chunks.set(id, new ReactPromise("fulfilled", text, null, response)); + } function resolveBuffer(response, id, buffer) { var chunks = response._chunks, chunk = chunks.get(id); @@ -1874,6 +1907,87 @@ } ); } + function stopStream(response, id, row) { + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === row ? '"$undefined"' : row); + } + function resolveErrorDev(response, errorInfo) { + var env = errorInfo.env; + errorInfo = buildFakeCallStack( + response, + errorInfo.stack, + env, + Error.bind( + null, + errorInfo.message || + "An error occurred in the Server Components render but no message was provided" + ) + ); + response = getRootTask(response, env); + response = null != response ? response.run(errorInfo) : errorInfo(); + response.environmentName = env; + return response; + } + function resolvePostponeDev(response, id, reason, stack, env) { + reason = buildFakeCallStack( + response, + stack, + env, + Error.bind(null, reason || "") + ); + stack = response._debugRootTask; + reason = null != stack ? stack.run(reason) : reason(); + reason.$$typeof = REACT_POSTPONE_TYPE; + stack = response._chunks; + (env = stack.get(id)) + ? triggerErrorOnChunk(env, reason) + : stack.set(id, new ReactPromise("rejected", null, reason, response)); + } + function resolveHint(response, code, model) { + response = JSON.parse(model, response._fromJSON); + model = ReactDOMSharedInternals.d; + switch (code) { + case "D": + model.D(response); + break; + case "C": + "string" === typeof response + ? model.C(response) + : model.C(response[0], response[1]); + break; + case "L": + code = response[0]; + var as = response[1]; + 3 === response.length + ? model.L(code, as, response[2]) + : model.L(code, as); + break; + case "m": + "string" === typeof response + ? model.m(response) + : model.m(response[0], response[1]); + break; + case "X": + "string" === typeof response + ? model.X(response) + : model.X(response[0], response[1]); + break; + case "S": + "string" === typeof response + ? model.S(response) + : model.S( + response[0], + 0 === response[1] ? void 0 : response[1], + 3 === response.length ? response[2] : void 0 + ); + break; + case "M": + "string" === typeof response + ? model.M(response) + : model.M(response[0], response[1]); + } + } function createFakeFunction( name, filename, @@ -2015,6 +2129,19 @@ null != debugInfo.owner && initializeFakeStack(response, debugInfo.owner)); } + function resolveDebugInfo(response, id, debugInfo) { + initializeFakeTask( + response, + debugInfo, + void 0 === debugInfo.env ? response._rootEnvironmentName : debugInfo.env + ); + null === debugInfo.owner && null != response._debugRootOwner + ? ((debugInfo.owner = response._debugRootOwner), + (debugInfo.debugStack = response._debugRootStack)) + : initializeFakeStack(response, debugInfo); + response = getChunk(response, id); + (response._debugInfo || (response._debugInfo = [])).push(debugInfo); + } function getCurrentStackInDEV() { var owner = currentOwnerInDEV; if (null === owner) return ""; @@ -2070,6 +2197,24 @@ } return JSCompiler_inline_result$jscomp$0; } + function resolveConsoleEntry(response, value) { + if (response._replayConsole) { + var payload = JSON.parse(value, response._fromJSON); + value = payload[0]; + var stackTrace = payload[1], + owner = payload[2], + env = payload[3]; + payload = payload.slice(4); + replayConsoleWithCallStackInDEV( + response, + value, + stackTrace, + owner, + env, + payload + ); + } + } function mergeBuffer(buffer, lastChunk) { for ( var l = buffer.length, byteLength = lastChunk.length, i = 0; @@ -2166,113 +2311,35 @@ resolveModule(response, id, row); break; case 72: - id = row[0]; - row = row.slice(1); - response = JSON.parse(row, response._fromJSON); - row = ReactDOMSharedInternals.d; - switch (id) { - case "D": - row.D(response); - break; - case "C": - "string" === typeof response - ? row.C(response) - : row.C(response[0], response[1]); - break; - case "L": - id = response[0]; - tag = response[1]; - 3 === response.length - ? row.L(id, tag, response[2]) - : row.L(id, tag); - break; - case "m": - "string" === typeof response - ? row.m(response) - : row.m(response[0], response[1]); - break; - case "X": - "string" === typeof response - ? row.X(response) - : row.X(response[0], response[1]); - break; - case "S": - "string" === typeof response - ? row.S(response) - : row.S( - response[0], - 0 === response[1] ? void 0 : response[1], - 3 === response.length ? response[2] : void 0 - ); - break; - case "M": - "string" === typeof response - ? row.M(response) - : row.M(response[0], response[1]); - } + resolveHint(response, row[0], row.slice(1)); break; case 69: - var errorInfo = JSON.parse(row); - row = errorInfo.digest; - tag = errorInfo.env; - errorInfo = buildFakeCallStack( - response, - errorInfo.stack, - tag, - Error.bind( - null, - errorInfo.message || - "An error occurred in the Server Components render but no message was provided" - ) - ); - var rootTask = getRootTask(response, tag); - errorInfo = null != rootTask ? rootTask.run(errorInfo) : errorInfo(); - errorInfo.digest = row; - errorInfo.environmentName = tag; + row = JSON.parse(row); + tag = resolveErrorDev(response, row); + tag.digest = row.digest; row = response._chunks; - (tag = row.get(id)) - ? triggerErrorOnChunk(tag, errorInfo) - : row.set( - id, - new ReactPromise("rejected", null, errorInfo, response) - ); + var chunk = row.get(id); + chunk + ? triggerErrorOnChunk(chunk, tag) + : row.set(id, new ReactPromise("rejected", null, tag, response)); break; case 84: - tag = response._chunks; - (errorInfo = tag.get(id)) && "pending" !== errorInfo.status - ? errorInfo.reason.enqueueValue(row) - : tag.set(id, new ReactPromise("fulfilled", row, null, response)); + resolveText(response, id, row); break; case 68: - row = JSON.parse(row, response._fromJSON); - initializeFakeTask( - response, - row, - void 0 === row.env ? response._rootEnvironmentName : row.env - ); - null === row.owner && null != response._debugRootOwner - ? ((row.owner = response._debugRootOwner), - (row.debugStack = response._debugRootStack)) - : initializeFakeStack(response, row); - response = getChunk(response, id); - (response._debugInfo || (response._debugInfo = [])).push(row); + tag = new ReactPromise("resolved_model", row, null, response); + initializeModelChunk(tag); + "fulfilled" === tag.status + ? resolveDebugInfo(response, id, tag.value) + : tag.then( + function (v) { + return resolveDebugInfo(response, id, v); + }, + function () {} + ); break; case 87: - response._replayConsole && - ((rootTask = JSON.parse(row, response._fromJSON)), - (id = rootTask[0]), - (row = rootTask[1]), - (tag = rootTask[2]), - (errorInfo = rootTask[3]), - (rootTask = rootTask.slice(4)), - replayConsoleWithCallStackInDEV( - response, - id, - row, - tag, - errorInfo, - rootTask - )); + resolveConsoleEntry(response, row); break; case 82: startReadableStream(response, id, void 0); @@ -2287,34 +2354,14 @@ startAsyncIterable(response, id, !0); break; case 67: - (response = response._chunks.get(id)) && - "fulfilled" === response.status && - response.reason.close("" === row ? '"$undefined"' : row); + stopStream(response, id, row); break; case 80: - row = JSON.parse(row); - row = buildFakeCallStack( - response, - row.stack, - row.env, - Error.bind(null, row.reason || "") - ); - tag = response._debugRootTask; - row = null != tag ? tag.run(row) : row(); - row.$$typeof = REACT_POSTPONE_TYPE; - tag = response._chunks; - (errorInfo = tag.get(id)) - ? triggerErrorOnChunk(errorInfo, row) - : tag.set(id, new ReactPromise("rejected", null, row, response)); + tag = JSON.parse(row); + resolvePostponeDev(response, id, tag.reason, tag.stack, tag.env); break; default: - (tag = response._chunks), - (errorInfo = tag.get(id)) - ? resolveModelChunk(errorInfo, row) - : tag.set( - id, - new ReactPromise("resolved_model", row, null, response) - ); + resolveModel(response, id, row); } } function createFromJSONCallback(response) { diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.production.js index 33b33c8e7a9d3..75c75f427ec8b 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.production.js @@ -471,12 +471,17 @@ function processReply( pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } var boundCache = new WeakMap(); function encodeFormData(reference) { @@ -1046,6 +1051,8 @@ function parseModelString(response, parentObject, key, value) { (value = value.slice(2)), getOutlinedModel(response, value, parentObject, key, createFormData) ); + case "Z": + return resolveErrorProd(); case "i": return ( (value = value.slice(2)), @@ -1324,6 +1331,13 @@ function startAsyncIterable(response, id, iterator) { } ); } +function resolveErrorProd() { + var error = Error( + "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." + ); + error.stack = "Error: " + error.message; + return error; +} function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; @@ -1460,12 +1474,9 @@ function processFullStringRow(response, id, tag, row) { } break; case 69: - tag = JSON.parse(row).digest; - row = Error( - "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." - ); - row.stack = "Error: " + row.message; - row.digest = tag; + tag = JSON.parse(row); + row = resolveErrorProd(); + row.digest = tag.digest; tag = response._chunks; var chunk = tag.get(id); chunk diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.development.js index 5c3b6d8a8e2fb..9c5386f55cc1c 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.development.js @@ -697,12 +697,17 @@ pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function encodeFormData(reference) { var resolve, @@ -1516,6 +1521,17 @@ createFormData ) ); + case "Z": + return ( + (value = value.slice(2)), + getOutlinedModel( + response, + value, + parentObject, + key, + resolveErrorDev + ) + ); case "i": return ( (value = value.slice(2)), @@ -1610,6 +1626,23 @@ this._rootEnvironmentName = environmentName; this._fromJSON = createFromJSONCallback(this); } + function resolveModel(response, id, model) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? resolveModelChunk(chunk, model) + : chunks.set( + id, + new ReactPromise("resolved_model", model, null, response) + ); + } + function resolveText(response, id, text) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk && "pending" !== chunk.status + ? chunk.reason.enqueueValue(text) + : chunks.set(id, new ReactPromise("fulfilled", text, null, response)); + } function resolveBuffer(response, id, buffer) { var chunks = response._chunks, chunk = chunks.get(id); @@ -1849,6 +1882,87 @@ } ); } + function stopStream(response, id, row) { + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === row ? '"$undefined"' : row); + } + function resolveErrorDev(response, errorInfo) { + var env = errorInfo.env; + errorInfo = buildFakeCallStack( + response, + errorInfo.stack, + env, + Error.bind( + null, + errorInfo.message || + "An error occurred in the Server Components render but no message was provided" + ) + ); + response = getRootTask(response, env); + response = null != response ? response.run(errorInfo) : errorInfo(); + response.environmentName = env; + return response; + } + function resolvePostponeDev(response, id, reason, stack, env) { + reason = buildFakeCallStack( + response, + stack, + env, + Error.bind(null, reason || "") + ); + stack = response._debugRootTask; + reason = null != stack ? stack.run(reason) : reason(); + reason.$$typeof = REACT_POSTPONE_TYPE; + stack = response._chunks; + (env = stack.get(id)) + ? triggerErrorOnChunk(env, reason) + : stack.set(id, new ReactPromise("rejected", null, reason, response)); + } + function resolveHint(response, code, model) { + response = JSON.parse(model, response._fromJSON); + model = ReactDOMSharedInternals.d; + switch (code) { + case "D": + model.D(response); + break; + case "C": + "string" === typeof response + ? model.C(response) + : model.C(response[0], response[1]); + break; + case "L": + code = response[0]; + var as = response[1]; + 3 === response.length + ? model.L(code, as, response[2]) + : model.L(code, as); + break; + case "m": + "string" === typeof response + ? model.m(response) + : model.m(response[0], response[1]); + break; + case "X": + "string" === typeof response + ? model.X(response) + : model.X(response[0], response[1]); + break; + case "S": + "string" === typeof response + ? model.S(response) + : model.S( + response[0], + 0 === response[1] ? void 0 : response[1], + 3 === response.length ? response[2] : void 0 + ); + break; + case "M": + "string" === typeof response + ? model.M(response) + : model.M(response[0], response[1]); + } + } function createFakeFunction( name, filename, @@ -1990,6 +2104,19 @@ null != debugInfo.owner && initializeFakeStack(response, debugInfo.owner)); } + function resolveDebugInfo(response, id, debugInfo) { + initializeFakeTask( + response, + debugInfo, + void 0 === debugInfo.env ? response._rootEnvironmentName : debugInfo.env + ); + null === debugInfo.owner && null != response._debugRootOwner + ? ((debugInfo.owner = response._debugRootOwner), + (debugInfo.debugStack = response._debugRootStack)) + : initializeFakeStack(response, debugInfo); + response = getChunk(response, id); + (response._debugInfo || (response._debugInfo = [])).push(debugInfo); + } function getCurrentStackInDEV() { var owner = currentOwnerInDEV; if (null === owner) return ""; @@ -2045,6 +2172,24 @@ } return JSCompiler_inline_result$jscomp$0; } + function resolveConsoleEntry(response, value) { + if (response._replayConsole) { + var payload = JSON.parse(value, response._fromJSON); + value = payload[0]; + var stackTrace = payload[1], + owner = payload[2], + env = payload[3]; + payload = payload.slice(4); + replayConsoleWithCallStackInDEV( + response, + value, + stackTrace, + owner, + env, + payload + ); + } + } function mergeBuffer(buffer, lastChunk) { for ( var l = buffer.length, byteLength = lastChunk.length, i = 0; @@ -2141,113 +2286,35 @@ resolveModule(response, id, row); break; case 72: - id = row[0]; - row = row.slice(1); - response = JSON.parse(row, response._fromJSON); - row = ReactDOMSharedInternals.d; - switch (id) { - case "D": - row.D(response); - break; - case "C": - "string" === typeof response - ? row.C(response) - : row.C(response[0], response[1]); - break; - case "L": - id = response[0]; - tag = response[1]; - 3 === response.length - ? row.L(id, tag, response[2]) - : row.L(id, tag); - break; - case "m": - "string" === typeof response - ? row.m(response) - : row.m(response[0], response[1]); - break; - case "X": - "string" === typeof response - ? row.X(response) - : row.X(response[0], response[1]); - break; - case "S": - "string" === typeof response - ? row.S(response) - : row.S( - response[0], - 0 === response[1] ? void 0 : response[1], - 3 === response.length ? response[2] : void 0 - ); - break; - case "M": - "string" === typeof response - ? row.M(response) - : row.M(response[0], response[1]); - } + resolveHint(response, row[0], row.slice(1)); break; case 69: - var errorInfo = JSON.parse(row); - row = errorInfo.digest; - tag = errorInfo.env; - errorInfo = buildFakeCallStack( - response, - errorInfo.stack, - tag, - Error.bind( - null, - errorInfo.message || - "An error occurred in the Server Components render but no message was provided" - ) - ); - var rootTask = getRootTask(response, tag); - errorInfo = null != rootTask ? rootTask.run(errorInfo) : errorInfo(); - errorInfo.digest = row; - errorInfo.environmentName = tag; + row = JSON.parse(row); + tag = resolveErrorDev(response, row); + tag.digest = row.digest; row = response._chunks; - (tag = row.get(id)) - ? triggerErrorOnChunk(tag, errorInfo) - : row.set( - id, - new ReactPromise("rejected", null, errorInfo, response) - ); + var chunk = row.get(id); + chunk + ? triggerErrorOnChunk(chunk, tag) + : row.set(id, new ReactPromise("rejected", null, tag, response)); break; case 84: - tag = response._chunks; - (errorInfo = tag.get(id)) && "pending" !== errorInfo.status - ? errorInfo.reason.enqueueValue(row) - : tag.set(id, new ReactPromise("fulfilled", row, null, response)); + resolveText(response, id, row); break; case 68: - row = JSON.parse(row, response._fromJSON); - initializeFakeTask( - response, - row, - void 0 === row.env ? response._rootEnvironmentName : row.env - ); - null === row.owner && null != response._debugRootOwner - ? ((row.owner = response._debugRootOwner), - (row.debugStack = response._debugRootStack)) - : initializeFakeStack(response, row); - response = getChunk(response, id); - (response._debugInfo || (response._debugInfo = [])).push(row); + tag = new ReactPromise("resolved_model", row, null, response); + initializeModelChunk(tag); + "fulfilled" === tag.status + ? resolveDebugInfo(response, id, tag.value) + : tag.then( + function (v) { + return resolveDebugInfo(response, id, v); + }, + function () {} + ); break; case 87: - response._replayConsole && - ((rootTask = JSON.parse(row, response._fromJSON)), - (id = rootTask[0]), - (row = rootTask[1]), - (tag = rootTask[2]), - (errorInfo = rootTask[3]), - (rootTask = rootTask.slice(4)), - replayConsoleWithCallStackInDEV( - response, - id, - row, - tag, - errorInfo, - rootTask - )); + resolveConsoleEntry(response, row); break; case 82: startReadableStream(response, id, void 0); @@ -2262,34 +2329,14 @@ startAsyncIterable(response, id, !0); break; case 67: - (response = response._chunks.get(id)) && - "fulfilled" === response.status && - response.reason.close("" === row ? '"$undefined"' : row); + stopStream(response, id, row); break; case 80: - row = JSON.parse(row); - row = buildFakeCallStack( - response, - row.stack, - row.env, - Error.bind(null, row.reason || "") - ); - tag = response._debugRootTask; - row = null != tag ? tag.run(row) : row(); - row.$$typeof = REACT_POSTPONE_TYPE; - tag = response._chunks; - (errorInfo = tag.get(id)) - ? triggerErrorOnChunk(errorInfo, row) - : tag.set(id, new ReactPromise("rejected", null, row, response)); + tag = JSON.parse(row); + resolvePostponeDev(response, id, tag.reason, tag.stack, tag.env); break; default: - (tag = response._chunks), - (errorInfo = tag.get(id)) - ? resolveModelChunk(errorInfo, row) - : tag.set( - id, - new ReactPromise("resolved_model", row, null, response) - ); + resolveModel(response, id, row); } } function createFromJSONCallback(response) { diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.production.js index 0b46271364b46..7d32d9d409443 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.node.unbundled.production.js @@ -454,12 +454,17 @@ function processReply( pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } var boundCache = new WeakMap(); function encodeFormData(reference) { @@ -1025,6 +1030,8 @@ function parseModelString(response, parentObject, key, value) { (value = value.slice(2)), getOutlinedModel(response, value, parentObject, key, createFormData) ); + case "Z": + return resolveErrorProd(); case "i": return ( (value = value.slice(2)), @@ -1303,6 +1310,13 @@ function startAsyncIterable(response, id, iterator) { } ); } +function resolveErrorProd() { + var error = Error( + "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." + ); + error.stack = "Error: " + error.message; + return error; +} function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; @@ -1439,12 +1453,9 @@ function processFullStringRow(response, id, tag, row) { } break; case 69: - tag = JSON.parse(row).digest; - row = Error( - "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." - ); - row.stack = "Error: " + row.message; - row.digest = tag; + tag = JSON.parse(row); + row = resolveErrorProd(); + row.digest = tag.digest; tag = response._chunks; var chunk = tag.get(id); chunk diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.development.js index adfd63037a303..6d9b746523574 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.development.js @@ -1069,9 +1069,10 @@ null === task.debugStack ? null : filterStackTrace(request, task.debugStack, 1); + componentDebugInfo.props = props; componentDebugInfo.debugStack = task.debugStack; componentDebugInfo.debugTask = task.debugTask; - outlineModel(request, componentDebugInfo); + outlineComponentInfo(request, componentDebugInfo); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; 2 === validated && @@ -1271,6 +1272,7 @@ null === task.debugStack ? null : filterStackTrace(request, task.debugStack, 1), + props: props, debugStack: task.debugStack, debugTask: task.debugTask }), @@ -1338,6 +1340,8 @@ ); ref = task.keyPath; null === key ? (key = ref) : null !== ref && (key = ref + "," + key); + null !== task.debugOwner && + outlineComponentInfo(request, task.debugOwner); request = [ REACT_ELEMENT_TYPE, type, @@ -1644,18 +1648,6 @@ reader.read().then(progress).catch(error); return "$B" + newTask.id.toString(16); } - function isReactComponentInfo(value) { - return ( - (("object" === typeof value.debugTask && - null !== value.debugTask && - "function" === typeof value.debugTask.run) || - value.debugStack instanceof Error) && - (isArrayImpl(value.stack) || null === value.stack) && - "string" === typeof value.name && - "string" === typeof value.env && - void 0 !== value.owner - ); - } function renderModel(request, task, parent, key, value) { var prevKeyPath = task.keyPath, prevImplicitSlot = task.implicitSlot; @@ -1864,6 +1856,7 @@ if (value instanceof Set) return serializeSet(request, value); if ("function" === typeof FormData && value instanceof FormData) return serializeFormData(request, value); + if (value instanceof Error) return serializeErrorValue(request, value); if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -1918,17 +1911,6 @@ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." + describeObjectForErrorMessage(parent, parentPropertyName) ); - if (isReactComponentInfo(value)) - return ( - (request = { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }), - (request.stack = value.stack), - request - ); if ("Object" !== objectName(value)) callWithDebugContextInDEV(request, task, function () { console.error( @@ -2109,6 +2091,27 @@ id = stringToChunk(id); request.completedErrorChunks.push(id); } + function serializeErrorValue(request, error) { + var env = (0, request.environmentName)(); + try { + var message = String(error.message); + var stack = filterStackTrace(request, error, 0); + var errorEnv = error.environmentName; + "string" === typeof errorEnv && (env = errorEnv); + } catch (x) { + (message = + "An error occurred but serializing the error message failed."), + (stack = []); + } + return ( + "$Z" + + outlineModel(request, { + message: message, + stack: stack, + env: env + }).toString(16) + ); + } function emitErrorChunk(request, id, digest, error) { var env = (0, request.environmentName)(); try { @@ -2143,7 +2146,7 @@ request.completedRegularChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var counter = { objectCount: 0 }; + var counter = { objectLimit: 500 }; debugInfo = stringify(debugInfo, function (parentPropertyName, value) { return renderConsoleValue( request, @@ -2157,6 +2160,33 @@ id = stringToChunk(id); request.completedRegularChunks.push(id); } + function outlineComponentInfo(request, componentInfo) { + if (!request.writtenObjects.has(componentInfo)) { + null != componentInfo.owner && + outlineComponentInfo(request, componentInfo.owner); + var objectLimit = 10; + null != componentInfo.stack && + (objectLimit += componentInfo.stack.length); + objectLimit = { objectLimit: objectLimit }; + var componentDebugInfo = { + name: componentInfo.name, + env: componentInfo.env, + key: componentInfo.key, + owner: componentInfo.owner + }; + componentDebugInfo.stack = componentInfo.stack; + componentDebugInfo.props = componentInfo.props; + objectLimit = outlineConsoleValue( + request, + objectLimit, + componentDebugInfo + ); + request.writtenObjects.set( + componentInfo, + serializeByValueID(objectLimit) + ); + } + } function emitTypedArrayChunk(request, id, tag, typedArray) { if (TaintRegistryByteLengths.has(typedArray.byteLength)) { var tainted = TaintRegistryValues.get( @@ -2217,11 +2247,39 @@ ((parent = request.temporaryReferences.get(value)), void 0 !== parent) ) return "$T" + parent; - if (500 < counter.objectCount) return "$Y"; - counter.objectCount++; parent = request.writtenObjects.get(value); + if (void 0 !== parent) return parent; + if (0 >= counter.objectLimit) return "$Y"; + counter.objectLimit--; + switch (value.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + null != value._owner && + outlineComponentInfo(request, value._owner), + (counter = null), + null != value._debugStack && + ((counter = filterStackTrace(request, value._debugStack, 1)), + (parent = outlineConsoleValue( + request, + { objectLimit: counter.length + 2 }, + counter + )), + request.writtenObjects.set( + counter, + serializeByValueID(parent) + )), + [ + REACT_ELEMENT_TYPE, + value.type, + value.key, + value.props, + value._owner, + counter, + value._store.validated + ] + ); + } if ("function" === typeof value.then) { - if (void 0 !== parent) return parent; switch (value.status) { case "fulfilled": return ( @@ -2243,20 +2301,19 @@ } return "$@"; } - return void 0 !== parent - ? parent - : isArrayImpl(value) - ? value - : value instanceof Map + return isArrayImpl(value) + ? value + : value instanceof Map + ? ((value = Array.from(value)), + "$Q" + outlineConsoleValue(request, counter, value).toString(16)) + : value instanceof Set ? ((value = Array.from(value)), - "$Q" + + "$W" + outlineConsoleValue(request, counter, value).toString(16)) - : value instanceof Set - ? ((value = Array.from(value)), - "$W" + - outlineConsoleValue(request, counter, value).toString(16)) - : "function" === typeof FormData && value instanceof FormData - ? serializeFormData(request, value) + : "function" === typeof FormData && value instanceof FormData + ? serializeFormData(request, value) + : value instanceof Error + ? serializeErrorValue(request, value) : value instanceof ArrayBuffer ? serializeTypedArray(request, "A", new Uint8Array(value)) : value instanceof Int8Array @@ -2300,17 +2357,7 @@ ? serializeBlob(request, value) : getIteratorFn(value) ? Array.from(value) - : isReactComponentInfo(value) - ? ((request = { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }), - (request.stack = - value.stack), - request) - : value; + : value; } if ("string" === typeof value) return "Z" === value[value.length - 1] && originalValue instanceof Date @@ -2355,7 +2402,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); request.pendingChunks++; @@ -2373,8 +2423,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }, - env = (0, request.environmentName)(); + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(); methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { @@ -2387,7 +2438,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); id = serializeRowHeader("W", id) + args + "\n"; @@ -2398,7 +2452,7 @@ for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, "string" === typeof debugInfo[i].name && - outlineModel(request, debugInfo[i]), + outlineComponentInfo(request, debugInfo[i]), emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.production.js index 507f1bff591e6..7e3d6374600ae 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.browser.production.js @@ -1545,6 +1545,7 @@ function renderModelDestructive( (value = Array.from(value.entries())), "$K" + outlineModel(request, value).toString(16) ); + if (value instanceof Error) return "$Z"; if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.development.js index 45f38a29e5243..1f350ece95eb4 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.development.js @@ -1078,9 +1078,10 @@ null === task.debugStack ? null : filterStackTrace(request, task.debugStack, 1); + componentDebugInfo.props = props; componentDebugInfo.debugStack = task.debugStack; componentDebugInfo.debugTask = task.debugTask; - outlineModel(request, componentDebugInfo); + outlineComponentInfo(request, componentDebugInfo); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; 2 === validated && @@ -1328,6 +1329,7 @@ null === task.debugStack ? null : filterStackTrace(request, task.debugStack, 1), + props: props, debugStack: task.debugStack, debugTask: task.debugTask }), @@ -1395,6 +1397,8 @@ ); ref = task.keyPath; null === key ? (key = ref) : null !== ref && (key = ref + "," + key); + null !== task.debugOwner && + outlineComponentInfo(request, task.debugOwner); request = [ REACT_ELEMENT_TYPE, type, @@ -1701,18 +1705,6 @@ reader.read().then(progress).catch(error); return "$B" + newTask.id.toString(16); } - function isReactComponentInfo(value) { - return ( - (("object" === typeof value.debugTask && - null !== value.debugTask && - "function" === typeof value.debugTask.run) || - value.debugStack instanceof Error) && - (isArrayImpl(value.stack) || null === value.stack) && - "string" === typeof value.name && - "string" === typeof value.env && - void 0 !== value.owner - ); - } function renderModel(request, task, parent, key, value) { var prevKeyPath = task.keyPath, prevImplicitSlot = task.implicitSlot; @@ -1921,6 +1913,7 @@ if (value instanceof Set) return serializeSet(request, value); if ("function" === typeof FormData && value instanceof FormData) return serializeFormData(request, value); + if (value instanceof Error) return serializeErrorValue(request, value); if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -1975,17 +1968,6 @@ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." + describeObjectForErrorMessage(parent, parentPropertyName) ); - if (isReactComponentInfo(value)) - return ( - (request = { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }), - (request.stack = value.stack), - request - ); if ("Object" !== objectName(value)) callWithDebugContextInDEV(request, task, function () { console.error( @@ -2188,6 +2170,27 @@ id = stringToChunk(id); request.completedErrorChunks.push(id); } + function serializeErrorValue(request, error) { + var env = (0, request.environmentName)(); + try { + var message = String(error.message); + var stack = filterStackTrace(request, error, 0); + var errorEnv = error.environmentName; + "string" === typeof errorEnv && (env = errorEnv); + } catch (x) { + (message = + "An error occurred but serializing the error message failed."), + (stack = []); + } + return ( + "$Z" + + outlineModel(request, { + message: message, + stack: stack, + env: env + }).toString(16) + ); + } function emitErrorChunk(request, id, digest, error) { var env = (0, request.environmentName)(); try { @@ -2222,7 +2225,7 @@ request.completedRegularChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var counter = { objectCount: 0 }; + var counter = { objectLimit: 500 }; debugInfo = stringify(debugInfo, function (parentPropertyName, value) { return renderConsoleValue( request, @@ -2236,6 +2239,33 @@ id = stringToChunk(id); request.completedRegularChunks.push(id); } + function outlineComponentInfo(request, componentInfo) { + if (!request.writtenObjects.has(componentInfo)) { + null != componentInfo.owner && + outlineComponentInfo(request, componentInfo.owner); + var objectLimit = 10; + null != componentInfo.stack && + (objectLimit += componentInfo.stack.length); + objectLimit = { objectLimit: objectLimit }; + var componentDebugInfo = { + name: componentInfo.name, + env: componentInfo.env, + key: componentInfo.key, + owner: componentInfo.owner + }; + componentDebugInfo.stack = componentInfo.stack; + componentDebugInfo.props = componentInfo.props; + objectLimit = outlineConsoleValue( + request, + objectLimit, + componentDebugInfo + ); + request.writtenObjects.set( + componentInfo, + serializeByValueID(objectLimit) + ); + } + } function emitTypedArrayChunk(request, id, tag, typedArray) { if (TaintRegistryByteLengths.has(typedArray.byteLength)) { var tainted = TaintRegistryValues.get( @@ -2296,11 +2326,39 @@ ((parent = request.temporaryReferences.get(value)), void 0 !== parent) ) return "$T" + parent; - if (500 < counter.objectCount) return "$Y"; - counter.objectCount++; parent = request.writtenObjects.get(value); + if (void 0 !== parent) return parent; + if (0 >= counter.objectLimit) return "$Y"; + counter.objectLimit--; + switch (value.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + null != value._owner && + outlineComponentInfo(request, value._owner), + (counter = null), + null != value._debugStack && + ((counter = filterStackTrace(request, value._debugStack, 1)), + (parent = outlineConsoleValue( + request, + { objectLimit: counter.length + 2 }, + counter + )), + request.writtenObjects.set( + counter, + serializeByValueID(parent) + )), + [ + REACT_ELEMENT_TYPE, + value.type, + value.key, + value.props, + value._owner, + counter, + value._store.validated + ] + ); + } if ("function" === typeof value.then) { - if (void 0 !== parent) return parent; switch (value.status) { case "fulfilled": return ( @@ -2322,20 +2380,19 @@ } return "$@"; } - return void 0 !== parent - ? parent - : isArrayImpl(value) - ? value - : value instanceof Map + return isArrayImpl(value) + ? value + : value instanceof Map + ? ((value = Array.from(value)), + "$Q" + outlineConsoleValue(request, counter, value).toString(16)) + : value instanceof Set ? ((value = Array.from(value)), - "$Q" + + "$W" + outlineConsoleValue(request, counter, value).toString(16)) - : value instanceof Set - ? ((value = Array.from(value)), - "$W" + - outlineConsoleValue(request, counter, value).toString(16)) - : "function" === typeof FormData && value instanceof FormData - ? serializeFormData(request, value) + : "function" === typeof FormData && value instanceof FormData + ? serializeFormData(request, value) + : value instanceof Error + ? serializeErrorValue(request, value) : value instanceof ArrayBuffer ? serializeTypedArray(request, "A", new Uint8Array(value)) : value instanceof Int8Array @@ -2379,17 +2436,7 @@ ? serializeBlob(request, value) : getIteratorFn(value) ? Array.from(value) - : isReactComponentInfo(value) - ? ((request = { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }), - (request.stack = - value.stack), - request) - : value; + : value; } if ("string" === typeof value) return "Z" === value[value.length - 1] && originalValue instanceof Date @@ -2434,7 +2481,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); request.pendingChunks++; @@ -2452,8 +2502,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }, - env = (0, request.environmentName)(); + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(); methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { @@ -2466,7 +2517,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); id = serializeRowHeader("W", id) + args + "\n"; @@ -2477,7 +2531,7 @@ for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, "string" === typeof debugInfo[i].name && - outlineModel(request, debugInfo[i]), + outlineComponentInfo(request, debugInfo[i]), emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.production.js index 66cd986cb8b6f..f64a4416a9a26 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.edge.production.js @@ -1550,6 +1550,7 @@ function renderModelDestructive( (value = Array.from(value.entries())), "$K" + outlineModel(request, value).toString(16) ); + if (value instanceof Error) return "$Z"; if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.development.js index 60c33f50624a6..313ae45c18ee7 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.development.js @@ -1098,9 +1098,10 @@ null === task.debugStack ? null : filterStackTrace(request, task.debugStack, 1); + componentDebugInfo.props = props; componentDebugInfo.debugStack = task.debugStack; componentDebugInfo.debugTask = task.debugTask; - outlineModel(request, componentDebugInfo); + outlineComponentInfo(request, componentDebugInfo); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; 2 === validated && @@ -1326,6 +1327,7 @@ null === task.debugStack ? null : filterStackTrace(request, task.debugStack, 1), + props: props, debugStack: task.debugStack, debugTask: task.debugTask }), @@ -1393,6 +1395,8 @@ ); ref = task.keyPath; null === key ? (key = ref) : null !== ref && (key = ref + "," + key); + null !== task.debugOwner && + outlineComponentInfo(request, task.debugOwner); request = [ REACT_ELEMENT_TYPE, type, @@ -1697,18 +1701,6 @@ reader.read().then(progress).catch(error); return "$B" + newTask.id.toString(16); } - function isReactComponentInfo(value) { - return ( - (("object" === typeof value.debugTask && - null !== value.debugTask && - "function" === typeof value.debugTask.run) || - value.debugStack instanceof Error) && - (isArrayImpl(value.stack) || null === value.stack) && - "string" === typeof value.name && - "string" === typeof value.env && - void 0 !== value.owner - ); - } function renderModel(request, task, parent, key, value) { var prevKeyPath = task.keyPath, prevImplicitSlot = task.implicitSlot; @@ -1917,6 +1909,7 @@ if (value instanceof Set) return serializeSet(request, value); if ("function" === typeof FormData && value instanceof FormData) return serializeFormData(request, value); + if (value instanceof Error) return serializeErrorValue(request, value); if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -1971,17 +1964,6 @@ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." + describeObjectForErrorMessage(parent, parentPropertyName) ); - if (isReactComponentInfo(value)) - return ( - (request = { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }), - (request.stack = value.stack), - request - ); if ("Object" !== objectName(value)) callWithDebugContextInDEV(request, task, function () { console.error( @@ -2174,6 +2156,27 @@ "\n"; request.completedErrorChunks.push(id); } + function serializeErrorValue(request, error) { + var env = (0, request.environmentName)(); + try { + var message = String(error.message); + var stack = filterStackTrace(request, error, 0); + var errorEnv = error.environmentName; + "string" === typeof errorEnv && (env = errorEnv); + } catch (x) { + (message = + "An error occurred but serializing the error message failed."), + (stack = []); + } + return ( + "$Z" + + outlineModel(request, { + message: message, + stack: stack, + env: env + }).toString(16) + ); + } function emitErrorChunk(request, id, digest, error) { var env = (0, request.environmentName)(); try { @@ -2206,7 +2209,7 @@ request.completedRegularChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var counter = { objectCount: 0 }; + var counter = { objectLimit: 500 }; debugInfo = stringify(debugInfo, function (parentPropertyName, value) { return renderConsoleValue( request, @@ -2219,6 +2222,33 @@ id = serializeRowHeader("D", id) + debugInfo + "\n"; request.completedRegularChunks.push(id); } + function outlineComponentInfo(request, componentInfo) { + if (!request.writtenObjects.has(componentInfo)) { + null != componentInfo.owner && + outlineComponentInfo(request, componentInfo.owner); + var objectLimit = 10; + null != componentInfo.stack && + (objectLimit += componentInfo.stack.length); + objectLimit = { objectLimit: objectLimit }; + var componentDebugInfo = { + name: componentInfo.name, + env: componentInfo.env, + key: componentInfo.key, + owner: componentInfo.owner + }; + componentDebugInfo.stack = componentInfo.stack; + componentDebugInfo.props = componentInfo.props; + objectLimit = outlineConsoleValue( + request, + objectLimit, + componentDebugInfo + ); + request.writtenObjects.set( + componentInfo, + serializeByValueID(objectLimit) + ); + } + } function emitTypedArrayChunk(request, id, tag, typedArray) { if (TaintRegistryByteLengths.has(typedArray.byteLength)) { var tainted = TaintRegistryValues.get( @@ -2275,11 +2305,39 @@ ((parent = request.temporaryReferences.get(value)), void 0 !== parent) ) return "$T" + parent; - if (500 < counter.objectCount) return "$Y"; - counter.objectCount++; parent = request.writtenObjects.get(value); + if (void 0 !== parent) return parent; + if (0 >= counter.objectLimit) return "$Y"; + counter.objectLimit--; + switch (value.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + null != value._owner && + outlineComponentInfo(request, value._owner), + (counter = null), + null != value._debugStack && + ((counter = filterStackTrace(request, value._debugStack, 1)), + (parent = outlineConsoleValue( + request, + { objectLimit: counter.length + 2 }, + counter + )), + request.writtenObjects.set( + counter, + serializeByValueID(parent) + )), + [ + REACT_ELEMENT_TYPE, + value.type, + value.key, + value.props, + value._owner, + counter, + value._store.validated + ] + ); + } if ("function" === typeof value.then) { - if (void 0 !== parent) return parent; switch (value.status) { case "fulfilled": return ( @@ -2301,20 +2359,19 @@ } return "$@"; } - return void 0 !== parent - ? parent - : isArrayImpl(value) - ? value - : value instanceof Map + return isArrayImpl(value) + ? value + : value instanceof Map + ? ((value = Array.from(value)), + "$Q" + outlineConsoleValue(request, counter, value).toString(16)) + : value instanceof Set ? ((value = Array.from(value)), - "$Q" + + "$W" + outlineConsoleValue(request, counter, value).toString(16)) - : value instanceof Set - ? ((value = Array.from(value)), - "$W" + - outlineConsoleValue(request, counter, value).toString(16)) - : "function" === typeof FormData && value instanceof FormData - ? serializeFormData(request, value) + : "function" === typeof FormData && value instanceof FormData + ? serializeFormData(request, value) + : value instanceof Error + ? serializeErrorValue(request, value) : value instanceof ArrayBuffer ? serializeTypedArray(request, "A", new Uint8Array(value)) : value instanceof Int8Array @@ -2358,17 +2415,7 @@ ? serializeBlob(request, value) : getIteratorFn(value) ? Array.from(value) - : isReactComponentInfo(value) - ? ((request = { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }), - (request.stack = - value.stack), - request) - : value; + : value; } if ("string" === typeof value) return "Z" === value[value.length - 1] && originalValue instanceof Date @@ -2413,7 +2460,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); request.pendingChunks++; @@ -2430,8 +2480,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }, - env = (0, request.environmentName)(); + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(); methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { @@ -2444,7 +2495,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); id = serializeRowHeader("W", id) + args + "\n"; @@ -2454,7 +2508,7 @@ for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, "string" === typeof debugInfo[i].name && - outlineModel(request, debugInfo[i]), + outlineComponentInfo(request, debugInfo[i]), emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.production.js index 7342f80a6866b..f5591256eb494 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.production.js @@ -1564,6 +1564,7 @@ function renderModelDestructive( (value = Array.from(value.entries())), "$K" + outlineModel(request, value).toString(16) ); + if (value instanceof Error) return "$Z"; if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -2958,12 +2959,12 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) { "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_229 = []; + var JSCompiler_object_inline_chunks_233 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_229.push(chunk); + JSCompiler_object_inline_chunks_233.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_229, { + var blob = new Blob(JSCompiler_object_inline_chunks_233, { type: mimeType }); response._formData.append(name, blob, filename); diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.development.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.development.js index 27c73a2b9b74a..b85ba578ec53b 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.development.js @@ -1098,9 +1098,10 @@ null === task.debugStack ? null : filterStackTrace(request, task.debugStack, 1); + componentDebugInfo.props = props; componentDebugInfo.debugStack = task.debugStack; componentDebugInfo.debugTask = task.debugTask; - outlineModel(request, componentDebugInfo); + outlineComponentInfo(request, componentDebugInfo); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; 2 === validated && @@ -1326,6 +1327,7 @@ null === task.debugStack ? null : filterStackTrace(request, task.debugStack, 1), + props: props, debugStack: task.debugStack, debugTask: task.debugTask }), @@ -1393,6 +1395,8 @@ ); ref = task.keyPath; null === key ? (key = ref) : null !== ref && (key = ref + "," + key); + null !== task.debugOwner && + outlineComponentInfo(request, task.debugOwner); request = [ REACT_ELEMENT_TYPE, type, @@ -1697,18 +1701,6 @@ reader.read().then(progress).catch(error); return "$B" + newTask.id.toString(16); } - function isReactComponentInfo(value) { - return ( - (("object" === typeof value.debugTask && - null !== value.debugTask && - "function" === typeof value.debugTask.run) || - value.debugStack instanceof Error) && - (isArrayImpl(value.stack) || null === value.stack) && - "string" === typeof value.name && - "string" === typeof value.env && - void 0 !== value.owner - ); - } function renderModel(request, task, parent, key, value) { var prevKeyPath = task.keyPath, prevImplicitSlot = task.implicitSlot; @@ -1917,6 +1909,7 @@ if (value instanceof Set) return serializeSet(request, value); if ("function" === typeof FormData && value instanceof FormData) return serializeFormData(request, value); + if (value instanceof Error) return serializeErrorValue(request, value); if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -1971,17 +1964,6 @@ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." + describeObjectForErrorMessage(parent, parentPropertyName) ); - if (isReactComponentInfo(value)) - return ( - (request = { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }), - (request.stack = value.stack), - request - ); if ("Object" !== objectName(value)) callWithDebugContextInDEV(request, task, function () { console.error( @@ -2174,6 +2156,27 @@ "\n"; request.completedErrorChunks.push(id); } + function serializeErrorValue(request, error) { + var env = (0, request.environmentName)(); + try { + var message = String(error.message); + var stack = filterStackTrace(request, error, 0); + var errorEnv = error.environmentName; + "string" === typeof errorEnv && (env = errorEnv); + } catch (x) { + (message = + "An error occurred but serializing the error message failed."), + (stack = []); + } + return ( + "$Z" + + outlineModel(request, { + message: message, + stack: stack, + env: env + }).toString(16) + ); + } function emitErrorChunk(request, id, digest, error) { var env = (0, request.environmentName)(); try { @@ -2206,7 +2209,7 @@ request.completedRegularChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var counter = { objectCount: 0 }; + var counter = { objectLimit: 500 }; debugInfo = stringify(debugInfo, function (parentPropertyName, value) { return renderConsoleValue( request, @@ -2219,6 +2222,33 @@ id = serializeRowHeader("D", id) + debugInfo + "\n"; request.completedRegularChunks.push(id); } + function outlineComponentInfo(request, componentInfo) { + if (!request.writtenObjects.has(componentInfo)) { + null != componentInfo.owner && + outlineComponentInfo(request, componentInfo.owner); + var objectLimit = 10; + null != componentInfo.stack && + (objectLimit += componentInfo.stack.length); + objectLimit = { objectLimit: objectLimit }; + var componentDebugInfo = { + name: componentInfo.name, + env: componentInfo.env, + key: componentInfo.key, + owner: componentInfo.owner + }; + componentDebugInfo.stack = componentInfo.stack; + componentDebugInfo.props = componentInfo.props; + objectLimit = outlineConsoleValue( + request, + objectLimit, + componentDebugInfo + ); + request.writtenObjects.set( + componentInfo, + serializeByValueID(objectLimit) + ); + } + } function emitTypedArrayChunk(request, id, tag, typedArray) { if (TaintRegistryByteLengths.has(typedArray.byteLength)) { var tainted = TaintRegistryValues.get( @@ -2275,11 +2305,39 @@ ((parent = request.temporaryReferences.get(value)), void 0 !== parent) ) return "$T" + parent; - if (500 < counter.objectCount) return "$Y"; - counter.objectCount++; parent = request.writtenObjects.get(value); + if (void 0 !== parent) return parent; + if (0 >= counter.objectLimit) return "$Y"; + counter.objectLimit--; + switch (value.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + null != value._owner && + outlineComponentInfo(request, value._owner), + (counter = null), + null != value._debugStack && + ((counter = filterStackTrace(request, value._debugStack, 1)), + (parent = outlineConsoleValue( + request, + { objectLimit: counter.length + 2 }, + counter + )), + request.writtenObjects.set( + counter, + serializeByValueID(parent) + )), + [ + REACT_ELEMENT_TYPE, + value.type, + value.key, + value.props, + value._owner, + counter, + value._store.validated + ] + ); + } if ("function" === typeof value.then) { - if (void 0 !== parent) return parent; switch (value.status) { case "fulfilled": return ( @@ -2301,20 +2359,19 @@ } return "$@"; } - return void 0 !== parent - ? parent - : isArrayImpl(value) - ? value - : value instanceof Map + return isArrayImpl(value) + ? value + : value instanceof Map + ? ((value = Array.from(value)), + "$Q" + outlineConsoleValue(request, counter, value).toString(16)) + : value instanceof Set ? ((value = Array.from(value)), - "$Q" + + "$W" + outlineConsoleValue(request, counter, value).toString(16)) - : value instanceof Set - ? ((value = Array.from(value)), - "$W" + - outlineConsoleValue(request, counter, value).toString(16)) - : "function" === typeof FormData && value instanceof FormData - ? serializeFormData(request, value) + : "function" === typeof FormData && value instanceof FormData + ? serializeFormData(request, value) + : value instanceof Error + ? serializeErrorValue(request, value) : value instanceof ArrayBuffer ? serializeTypedArray(request, "A", new Uint8Array(value)) : value instanceof Int8Array @@ -2358,17 +2415,7 @@ ? serializeBlob(request, value) : getIteratorFn(value) ? Array.from(value) - : isReactComponentInfo(value) - ? ((request = { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }), - (request.stack = - value.stack), - request) - : value; + : value; } if ("string" === typeof value) return "Z" === value[value.length - 1] && originalValue instanceof Date @@ -2413,7 +2460,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); request.pendingChunks++; @@ -2430,8 +2480,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }, - env = (0, request.environmentName)(); + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(); methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { @@ -2444,7 +2495,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); id = serializeRowHeader("W", id) + args + "\n"; @@ -2454,7 +2508,7 @@ for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, "string" === typeof debugInfo[i].name && - outlineModel(request, debugInfo[i]), + outlineComponentInfo(request, debugInfo[i]), emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.production.js b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.production.js index c78253048b9e4..4e657cd22d078 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-server.node.unbundled.production.js @@ -1564,6 +1564,7 @@ function renderModelDestructive( (value = Array.from(value.entries())), "$K" + outlineModel(request, value).toString(16) ); + if (value instanceof Error) return "$Z"; if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -2926,12 +2927,12 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) { "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_229 = []; + var JSCompiler_object_inline_chunks_233 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_229.push(chunk); + JSCompiler_object_inline_chunks_233.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_229, { + var blob = new Blob(JSCompiler_object_inline_chunks_233, { type: mimeType }); response._formData.append(name, blob, filename); diff --git a/packages/next/src/compiled/react-server-dom-webpack-experimental/package.json b/packages/next/src/compiled/react-server-dom-webpack-experimental/package.json index 798c78cdba57c..c3dfb416405b0 100644 --- a/packages/next/src/compiled/react-server-dom-webpack-experimental/package.json +++ b/packages/next/src/compiled/react-server-dom-webpack-experimental/package.json @@ -64,8 +64,8 @@ "webpack-sources": "^3.2.0" }, "peerDependencies": { - "react": "0.0.0-experimental-2d16326d-20240930", - "react-dom": "0.0.0-experimental-2d16326d-20240930", + "react": "0.0.0-experimental-1460d67c-20241003", + "react-dom": "0.0.0-experimental-1460d67c-20241003", "webpack": "^5.59.0" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js index 4c5d8faefc732..01510eb812def 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js @@ -729,12 +729,17 @@ pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function createFakeServerFunction( name, @@ -1345,6 +1350,17 @@ createFormData ) ); + case "Z": + return ( + (value = value.slice(2)), + getOutlinedModel( + response, + value, + parentObject, + key, + resolveErrorDev + ) + ); case "i": return ( (value = value.slice(2)), @@ -1435,6 +1451,23 @@ void 0 === environmentName ? "Server" : environmentName; this._fromJSON = createFromJSONCallback(this); } + function resolveModel(response, id, model) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? resolveModelChunk(chunk, model) + : chunks.set( + id, + new ReactPromise("resolved_model", model, null, response) + ); + } + function resolveText(response, id, text) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk && "pending" !== chunk.status + ? chunk.reason.enqueueValue(text) + : chunks.set(id, new ReactPromise("fulfilled", text, null, response)); + } function resolveBuffer(response, id, buffer) { var chunks = response._chunks, chunk = chunks.get(id); @@ -1669,6 +1702,88 @@ } ); } + function stopStream(response, id, row) { + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === row ? '"$undefined"' : row); + } + function resolveErrorDev(response, errorInfo) { + response = errorInfo.stack; + var env = errorInfo.env; + errorInfo = Error( + errorInfo.message || + "An error occurred in the Server Components render but no message was provided" + ); + var v8StyleStack = errorInfo.name + ": " + errorInfo.message; + if (response) + for (var i = 0; i < response.length; i++) { + var frame = response[i], + name = frame[0], + filename = frame[1], + line = frame[2]; + frame = frame[3]; + v8StyleStack = name + ? v8StyleStack + + ("\n at " + + name + + " (" + + filename + + ":" + + line + + ":" + + frame + + ")") + : v8StyleStack + + ("\n at " + filename + ":" + line + ":" + frame); + } + errorInfo.stack = v8StyleStack; + errorInfo.environmentName = env; + return errorInfo; + } + function resolveHint(response, code, model) { + response = JSON.parse(model, response._fromJSON); + model = ReactDOMSharedInternals.d; + switch (code) { + case "D": + model.D(response); + break; + case "C": + "string" === typeof response + ? model.C(response) + : model.C(response[0], response[1]); + break; + case "L": + code = response[0]; + var as = response[1]; + 3 === response.length + ? model.L(code, as, response[2]) + : model.L(code, as); + break; + case "m": + "string" === typeof response + ? model.m(response) + : model.m(response[0], response[1]); + break; + case "X": + "string" === typeof response + ? model.X(response) + : model.X(response[0], response[1]); + break; + case "S": + "string" === typeof response + ? model.S(response) + : model.S( + response[0], + 0 === response[1] ? void 0 : response[1], + 3 === response.length ? response[2] : void 0 + ); + break; + case "M": + "string" === typeof response + ? model.M(response) + : model.M(response[0], response[1]); + } + } function createFakeFunction( name, filename, @@ -1757,9 +1872,26 @@ null != debugInfo.owner && initializeFakeStack(response, debugInfo.owner)); } + function resolveDebugInfo(response, id, debugInfo) { + null === debugInfo.owner && null != response._debugRootOwner + ? ((debugInfo.owner = response._debugRootOwner), + (debugInfo.debugStack = response._debugRootStack)) + : initializeFakeStack(response, debugInfo); + response = getChunk(response, id); + (response._debugInfo || (response._debugInfo = [])).push(debugInfo); + } function getCurrentStackInDEV() { return ""; } + function resolveConsoleEntry(response, value) { + if (response._replayConsole) { + var payload = JSON.parse(value, response._fromJSON); + response = payload[0]; + value = payload[3]; + payload = payload.slice(4); + bindToConsole(response, payload, value)(); + } + } function mergeBuffer(buffer, lastChunk) { for ( var l = buffer.length, byteLength = lastChunk.length, i = 0; @@ -1847,120 +1979,44 @@ i++ ) row += stringDecoder.decode(buffer[i], decoderOptions); - buffer = row += stringDecoder.decode(chunk); + row += stringDecoder.decode(chunk); + processFullStringRow(response, id, tag, row); + } + function processFullStringRow(response, id, tag, row) { switch (tag) { case 73: - resolveModule(response, id, buffer); + resolveModule(response, id, row); break; case 72: - id = buffer[0]; - buffer = buffer.slice(1); - response = JSON.parse(buffer, response._fromJSON); - buffer = ReactDOMSharedInternals.d; - switch (id) { - case "D": - buffer.D(response); - break; - case "C": - "string" === typeof response - ? buffer.C(response) - : buffer.C(response[0], response[1]); - break; - case "L": - id = response[0]; - tag = response[1]; - 3 === response.length - ? buffer.L(id, tag, response[2]) - : buffer.L(id, tag); - break; - case "m": - "string" === typeof response - ? buffer.m(response) - : buffer.m(response[0], response[1]); - break; - case "X": - "string" === typeof response - ? buffer.X(response) - : buffer.X(response[0], response[1]); - break; - case "S": - "string" === typeof response - ? buffer.S(response) - : buffer.S( - response[0], - 0 === response[1] ? void 0 : response[1], - 3 === response.length ? response[2] : void 0 - ); - break; - case "M": - "string" === typeof response - ? buffer.M(response) - : buffer.M(response[0], response[1]); - } + resolveHint(response, row[0], row.slice(1)); break; case 69: - stringDecoder = JSON.parse(buffer); - tag = stringDecoder.digest; - chunk = stringDecoder.env; - buffer = Error( - stringDecoder.message || - "An error occurred in the Server Components render but no message was provided" - ); - stringDecoder = stringDecoder.stack; - row = buffer.name + ": " + buffer.message; - if (stringDecoder) - for (i = 0; i < stringDecoder.length; i++) { - var frame = stringDecoder[i], - name = frame[0], - filename = frame[1], - line = frame[2]; - frame = frame[3]; - row = name - ? row + - ("\n at " + - name + - " (" + - filename + - ":" + - line + - ":" + - frame + - ")") - : row + ("\n at " + filename + ":" + line + ":" + frame); - } - buffer.stack = row; - buffer.digest = tag; - buffer.environmentName = chunk; - tag = response._chunks; - (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) - : tag.set(id, new ReactPromise("rejected", null, buffer, response)); + row = JSON.parse(row); + tag = resolveErrorDev(response, row); + tag.digest = row.digest; + row = response._chunks; + var chunk = row.get(id); + chunk + ? triggerErrorOnChunk(chunk, tag) + : row.set(id, new ReactPromise("rejected", null, tag, response)); break; case 84: - tag = response._chunks; - (chunk = tag.get(id)) && "pending" !== chunk.status - ? chunk.reason.enqueueValue(buffer) - : tag.set( - id, - new ReactPromise("fulfilled", buffer, null, response) - ); + resolveText(response, id, row); break; case 68: - buffer = JSON.parse(buffer, response._fromJSON); - null === buffer.owner && null != response._debugRootOwner - ? ((buffer.owner = response._debugRootOwner), - (buffer.debugStack = response._debugRootStack)) - : initializeFakeStack(response, buffer); - response = getChunk(response, id); - (response._debugInfo || (response._debugInfo = [])).push(buffer); + tag = new ReactPromise("resolved_model", row, null, response); + initializeModelChunk(tag); + "fulfilled" === tag.status + ? resolveDebugInfo(response, id, tag.value) + : tag.then( + function (v) { + return resolveDebugInfo(response, id, v); + }, + function () {} + ); break; case 87: - response._replayConsole && - ((buffer = JSON.parse(buffer, response._fromJSON)), - (response = buffer[0]), - (id = buffer[3]), - (buffer = buffer.slice(4)), - bindToConsole(response, buffer, id)()); + resolveConsoleEntry(response, row); break; case 82: startReadableStream(response, id, void 0); @@ -1975,18 +2031,10 @@ startAsyncIterable(response, id, !0); break; case 67: - (response = response._chunks.get(id)) && - "fulfilled" === response.status && - response.reason.close("" === buffer ? '"$undefined"' : buffer); + stopStream(response, id, row); break; default: - (tag = response._chunks), - (chunk = tag.get(id)) - ? resolveModelChunk(chunk, buffer) - : tag.set( - id, - new ReactPromise("resolved_model", buffer, null, response) - ); + resolveModel(response, id, row); } } function createFromJSONCallback(response) { @@ -2312,10 +2360,10 @@ return hook.checkDCE ? !0 : !1; })({ bundleType: 1, - version: "19.0.0-rc-2d16326d-20240930", + version: "19.0.0-rc-1460d67c-20241003", rendererPackageName: "react-server-dom-webpack", currentDispatcherRef: ReactSharedInternals, - reconcilerVersion: "19.0.0-rc-2d16326d-20240930", + reconcilerVersion: "19.0.0-rc-1460d67c-20241003", getCurrentComponentInfo: function () { return currentOwnerInDEV; } @@ -2375,7 +2423,7 @@ }; exports.encodeReply = function (value, options) { return new Promise(function (resolve, reject) { - processReply( + var abort = processReply( value, "", options && options.temporaryReferences @@ -2384,6 +2432,17 @@ resolve, reject ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(signal.reason); + else { + var listener = function () { + abort(signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } }); }; })(); diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js index dbb05bff6351a..deffe55f0189f 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.js @@ -457,12 +457,17 @@ function processReply( pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function registerServerReference(proxy, reference) { knownServerReferences.set(proxy, reference); @@ -886,6 +891,8 @@ function parseModelString(response, parentObject, key, value) { (value = value.slice(2)), getOutlinedModel(response, value, parentObject, key, createFormData) ); + case "Z": + return resolveErrorProd(); case "i": return ( (value = value.slice(2)), @@ -1159,6 +1166,13 @@ function startAsyncIterable(response, id, iterator) { } ); } +function resolveErrorProd() { + var error = Error( + "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." + ); + error.stack = "Error: " + error.message; + return error; +} function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; @@ -1294,12 +1308,9 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { } break; case 69: - tag = JSON.parse(buffer).digest; - buffer = Error( - "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." - ); - buffer.stack = "Error: " + buffer.message; - buffer.digest = tag; + tag = JSON.parse(buffer); + buffer = resolveErrorProd(); + buffer.digest = tag.digest; tag = response._chunks; (chunk = tag.get(id)) ? triggerErrorOnChunk(chunk, buffer) @@ -1516,7 +1527,7 @@ exports.createTemporaryReferenceSet = function () { }; exports.encodeReply = function (value, options) { return new Promise(function (resolve, reject) { - processReply( + var abort = processReply( value, "", options && options.temporaryReferences @@ -1525,5 +1536,16 @@ exports.encodeReply = function (value, options) { resolve, reject ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(signal.reason); + else { + var listener = function () { + abort(signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } }); }; diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js index 128d518568bc7..20d7637fcfe86 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.development.js @@ -750,12 +750,17 @@ pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function encodeFormData(reference) { var resolve, @@ -1549,6 +1554,17 @@ createFormData ) ); + case "Z": + return ( + (value = value.slice(2)), + getOutlinedModel( + response, + value, + parentObject, + key, + resolveErrorDev + ) + ); case "i": return ( (value = value.slice(2)), @@ -1639,6 +1655,23 @@ void 0 === environmentName ? "Server" : environmentName; this._fromJSON = createFromJSONCallback(this); } + function resolveModel(response, id, model) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? resolveModelChunk(chunk, model) + : chunks.set( + id, + new ReactPromise("resolved_model", model, null, response) + ); + } + function resolveText(response, id, text) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk && "pending" !== chunk.status + ? chunk.reason.enqueueValue(text) + : chunks.set(id, new ReactPromise("fulfilled", text, null, response)); + } function resolveBuffer(response, id, buffer) { var chunks = response._chunks, chunk = chunks.get(id); @@ -1878,6 +1911,88 @@ } ); } + function stopStream(response, id, row) { + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === row ? '"$undefined"' : row); + } + function resolveErrorDev(response, errorInfo) { + response = errorInfo.stack; + var env = errorInfo.env; + errorInfo = Error( + errorInfo.message || + "An error occurred in the Server Components render but no message was provided" + ); + var v8StyleStack = errorInfo.name + ": " + errorInfo.message; + if (response) + for (var i = 0; i < response.length; i++) { + var frame = response[i], + name = frame[0], + filename = frame[1], + line = frame[2]; + frame = frame[3]; + v8StyleStack = name + ? v8StyleStack + + ("\n at " + + name + + " (" + + filename + + ":" + + line + + ":" + + frame + + ")") + : v8StyleStack + + ("\n at " + filename + ":" + line + ":" + frame); + } + errorInfo.stack = v8StyleStack; + errorInfo.environmentName = env; + return errorInfo; + } + function resolveHint(response, code, model) { + response = JSON.parse(model, response._fromJSON); + model = ReactDOMSharedInternals.d; + switch (code) { + case "D": + model.D(response); + break; + case "C": + "string" === typeof response + ? model.C(response) + : model.C(response[0], response[1]); + break; + case "L": + code = response[0]; + var as = response[1]; + 3 === response.length + ? model.L(code, as, response[2]) + : model.L(code, as); + break; + case "m": + "string" === typeof response + ? model.m(response) + : model.m(response[0], response[1]); + break; + case "X": + "string" === typeof response + ? model.X(response) + : model.X(response[0], response[1]); + break; + case "S": + "string" === typeof response + ? model.S(response) + : model.S( + response[0], + 0 === response[1] ? void 0 : response[1], + 3 === response.length ? response[2] : void 0 + ); + break; + case "M": + "string" === typeof response + ? model.M(response) + : model.M(response[0], response[1]); + } + } function createFakeFunction( name, filename, @@ -1966,9 +2081,26 @@ null != debugInfo.owner && initializeFakeStack(response, debugInfo.owner)); } + function resolveDebugInfo(response, id, debugInfo) { + null === debugInfo.owner && null != response._debugRootOwner + ? ((debugInfo.owner = response._debugRootOwner), + (debugInfo.debugStack = response._debugRootStack)) + : initializeFakeStack(response, debugInfo); + response = getChunk(response, id); + (response._debugInfo || (response._debugInfo = [])).push(debugInfo); + } function getCurrentStackInDEV() { return ""; } + function resolveConsoleEntry(response, value) { + if (response._replayConsole) { + var payload = JSON.parse(value, response._fromJSON); + response = payload[0]; + value = payload[3]; + payload = payload.slice(4); + bindToConsole(response, payload, value)(); + } + } function mergeBuffer(buffer, lastChunk) { for ( var l = buffer.length, byteLength = lastChunk.length, i = 0; @@ -2056,120 +2188,44 @@ i++ ) row += stringDecoder.decode(buffer[i], decoderOptions); - buffer = row += stringDecoder.decode(chunk); + row += stringDecoder.decode(chunk); + processFullStringRow(response, id, tag, row); + } + function processFullStringRow(response, id, tag, row) { switch (tag) { case 73: - resolveModule(response, id, buffer); + resolveModule(response, id, row); break; case 72: - id = buffer[0]; - buffer = buffer.slice(1); - response = JSON.parse(buffer, response._fromJSON); - buffer = ReactDOMSharedInternals.d; - switch (id) { - case "D": - buffer.D(response); - break; - case "C": - "string" === typeof response - ? buffer.C(response) - : buffer.C(response[0], response[1]); - break; - case "L": - id = response[0]; - tag = response[1]; - 3 === response.length - ? buffer.L(id, tag, response[2]) - : buffer.L(id, tag); - break; - case "m": - "string" === typeof response - ? buffer.m(response) - : buffer.m(response[0], response[1]); - break; - case "X": - "string" === typeof response - ? buffer.X(response) - : buffer.X(response[0], response[1]); - break; - case "S": - "string" === typeof response - ? buffer.S(response) - : buffer.S( - response[0], - 0 === response[1] ? void 0 : response[1], - 3 === response.length ? response[2] : void 0 - ); - break; - case "M": - "string" === typeof response - ? buffer.M(response) - : buffer.M(response[0], response[1]); - } + resolveHint(response, row[0], row.slice(1)); break; case 69: - stringDecoder = JSON.parse(buffer); - tag = stringDecoder.digest; - chunk = stringDecoder.env; - buffer = Error( - stringDecoder.message || - "An error occurred in the Server Components render but no message was provided" - ); - stringDecoder = stringDecoder.stack; - row = buffer.name + ": " + buffer.message; - if (stringDecoder) - for (i = 0; i < stringDecoder.length; i++) { - var frame = stringDecoder[i], - name = frame[0], - filename = frame[1], - line = frame[2]; - frame = frame[3]; - row = name - ? row + - ("\n at " + - name + - " (" + - filename + - ":" + - line + - ":" + - frame + - ")") - : row + ("\n at " + filename + ":" + line + ":" + frame); - } - buffer.stack = row; - buffer.digest = tag; - buffer.environmentName = chunk; - tag = response._chunks; - (chunk = tag.get(id)) - ? triggerErrorOnChunk(chunk, buffer) - : tag.set(id, new ReactPromise("rejected", null, buffer, response)); + row = JSON.parse(row); + tag = resolveErrorDev(response, row); + tag.digest = row.digest; + row = response._chunks; + var chunk = row.get(id); + chunk + ? triggerErrorOnChunk(chunk, tag) + : row.set(id, new ReactPromise("rejected", null, tag, response)); break; case 84: - tag = response._chunks; - (chunk = tag.get(id)) && "pending" !== chunk.status - ? chunk.reason.enqueueValue(buffer) - : tag.set( - id, - new ReactPromise("fulfilled", buffer, null, response) - ); + resolveText(response, id, row); break; case 68: - buffer = JSON.parse(buffer, response._fromJSON); - null === buffer.owner && null != response._debugRootOwner - ? ((buffer.owner = response._debugRootOwner), - (buffer.debugStack = response._debugRootStack)) - : initializeFakeStack(response, buffer); - response = getChunk(response, id); - (response._debugInfo || (response._debugInfo = [])).push(buffer); + tag = new ReactPromise("resolved_model", row, null, response); + initializeModelChunk(tag); + "fulfilled" === tag.status + ? resolveDebugInfo(response, id, tag.value) + : tag.then( + function (v) { + return resolveDebugInfo(response, id, v); + }, + function () {} + ); break; case 87: - response._replayConsole && - ((buffer = JSON.parse(buffer, response._fromJSON)), - (response = buffer[0]), - (id = buffer[3]), - (buffer = buffer.slice(4)), - bindToConsole(response, buffer, id)()); + resolveConsoleEntry(response, row); break; case 82: startReadableStream(response, id, void 0); @@ -2184,18 +2240,10 @@ startAsyncIterable(response, id, !0); break; case 67: - (response = response._chunks.get(id)) && - "fulfilled" === response.status && - response.reason.close("" === buffer ? '"$undefined"' : buffer); + stopStream(response, id, row); break; default: - (tag = response._chunks), - (chunk = tag.get(id)) - ? resolveModelChunk(chunk, buffer) - : tag.set( - id, - new ReactPromise("resolved_model", buffer, null, response) - ); + resolveModel(response, id, row); } } function createFromJSONCallback(response) { @@ -2531,7 +2579,7 @@ }; exports.encodeReply = function (value, options) { return new Promise(function (resolve, reject) { - processReply( + var abort = processReply( value, "", options && options.temporaryReferences @@ -2540,6 +2588,17 @@ resolve, reject ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(signal.reason); + else { + var listener = function () { + abort(signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } }); }; })(); diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js index d37850f831c83..174a180e64cf7 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.js @@ -469,12 +469,17 @@ function processReply( pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } var boundCache = new WeakMap(); function encodeFormData(reference) { @@ -1044,6 +1049,8 @@ function parseModelString(response, parentObject, key, value) { (value = value.slice(2)), getOutlinedModel(response, value, parentObject, key, createFormData) ); + case "Z": + return resolveErrorProd(); case "i": return ( (value = value.slice(2)), @@ -1322,6 +1329,13 @@ function startAsyncIterable(response, id, iterator) { } ); } +function resolveErrorProd() { + var error = Error( + "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." + ); + error.stack = "Error: " + error.message; + return error; +} function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; @@ -1457,12 +1471,9 @@ function processFullBinaryRow(response, id, tag, buffer, chunk) { } break; case 69: - tag = JSON.parse(buffer).digest; - buffer = Error( - "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." - ); - buffer.stack = "Error: " + buffer.message; - buffer.digest = tag; + tag = JSON.parse(buffer); + buffer = resolveErrorProd(); + buffer.digest = tag.digest; tag = response._chunks; (chunk = tag.get(id)) ? triggerErrorOnChunk(chunk, buffer) @@ -1679,7 +1690,7 @@ exports.createTemporaryReferenceSet = function () { }; exports.encodeReply = function (value, options) { return new Promise(function (resolve, reject) { - processReply( + var abort = processReply( value, "", options && options.temporaryReferences @@ -1688,5 +1699,16 @@ exports.encodeReply = function (value, options) { resolve, reject ); + if (options && options.signal) { + var signal = options.signal; + if (signal.aborted) abort(signal.reason); + else { + var listener = function () { + abort(signal.reason); + signal.removeEventListener("abort", listener); + }; + signal.addEventListener("abort", listener); + } + } }); }; diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js index 76cde1d3f7ef2..ee1f83574109a 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.development.js @@ -750,12 +750,17 @@ pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function encodeFormData(reference) { var resolve, @@ -1549,6 +1554,17 @@ createFormData ) ); + case "Z": + return ( + (value = value.slice(2)), + getOutlinedModel( + response, + value, + parentObject, + key, + resolveErrorDev + ) + ); case "i": return ( (value = value.slice(2)), @@ -1639,6 +1655,23 @@ void 0 === environmentName ? "Server" : environmentName; this._fromJSON = createFromJSONCallback(this); } + function resolveModel(response, id, model) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? resolveModelChunk(chunk, model) + : chunks.set( + id, + new ReactPromise("resolved_model", model, null, response) + ); + } + function resolveText(response, id, text) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk && "pending" !== chunk.status + ? chunk.reason.enqueueValue(text) + : chunks.set(id, new ReactPromise("fulfilled", text, null, response)); + } function resolveBuffer(response, id, buffer) { var chunks = response._chunks, chunk = chunks.get(id); @@ -1878,6 +1911,88 @@ } ); } + function stopStream(response, id, row) { + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === row ? '"$undefined"' : row); + } + function resolveErrorDev(response, errorInfo) { + response = errorInfo.stack; + var env = errorInfo.env; + errorInfo = Error( + errorInfo.message || + "An error occurred in the Server Components render but no message was provided" + ); + var v8StyleStack = errorInfo.name + ": " + errorInfo.message; + if (response) + for (var i = 0; i < response.length; i++) { + var frame = response[i], + name = frame[0], + filename = frame[1], + line = frame[2]; + frame = frame[3]; + v8StyleStack = name + ? v8StyleStack + + ("\n at " + + name + + " (" + + filename + + ":" + + line + + ":" + + frame + + ")") + : v8StyleStack + + ("\n at " + filename + ":" + line + ":" + frame); + } + errorInfo.stack = v8StyleStack; + errorInfo.environmentName = env; + return errorInfo; + } + function resolveHint(response, code, model) { + response = JSON.parse(model, response._fromJSON); + model = ReactDOMSharedInternals.d; + switch (code) { + case "D": + model.D(response); + break; + case "C": + "string" === typeof response + ? model.C(response) + : model.C(response[0], response[1]); + break; + case "L": + code = response[0]; + var as = response[1]; + 3 === response.length + ? model.L(code, as, response[2]) + : model.L(code, as); + break; + case "m": + "string" === typeof response + ? model.m(response) + : model.m(response[0], response[1]); + break; + case "X": + "string" === typeof response + ? model.X(response) + : model.X(response[0], response[1]); + break; + case "S": + "string" === typeof response + ? model.S(response) + : model.S( + response[0], + 0 === response[1] ? void 0 : response[1], + 3 === response.length ? response[2] : void 0 + ); + break; + case "M": + "string" === typeof response + ? model.M(response) + : model.M(response[0], response[1]); + } + } function createFakeFunction( name, filename, @@ -1966,9 +2081,26 @@ null != debugInfo.owner && initializeFakeStack(response, debugInfo.owner)); } + function resolveDebugInfo(response, id, debugInfo) { + null === debugInfo.owner && null != response._debugRootOwner + ? ((debugInfo.owner = response._debugRootOwner), + (debugInfo.debugStack = response._debugRootStack)) + : initializeFakeStack(response, debugInfo); + response = getChunk(response, id); + (response._debugInfo || (response._debugInfo = [])).push(debugInfo); + } function getCurrentStackInDEV() { return ""; } + function resolveConsoleEntry(response, value) { + if (response._replayConsole) { + var payload = JSON.parse(value, response._fromJSON); + response = payload[0]; + value = payload[3]; + payload = payload.slice(4); + bindToConsole(response, payload, value)(); + } + } function mergeBuffer(buffer, lastChunk) { for ( var l = buffer.length, byteLength = lastChunk.length, i = 0; @@ -2065,112 +2197,35 @@ resolveModule(response, id, row); break; case 72: - id = row[0]; - row = row.slice(1); - response = JSON.parse(row, response._fromJSON); - row = ReactDOMSharedInternals.d; - switch (id) { - case "D": - row.D(response); - break; - case "C": - "string" === typeof response - ? row.C(response) - : row.C(response[0], response[1]); - break; - case "L": - id = response[0]; - tag = response[1]; - 3 === response.length - ? row.L(id, tag, response[2]) - : row.L(id, tag); - break; - case "m": - "string" === typeof response - ? row.m(response) - : row.m(response[0], response[1]); - break; - case "X": - "string" === typeof response - ? row.X(response) - : row.X(response[0], response[1]); - break; - case "S": - "string" === typeof response - ? row.S(response) - : row.S( - response[0], - 0 === response[1] ? void 0 : response[1], - 3 === response.length ? response[2] : void 0 - ); - break; - case "M": - "string" === typeof response - ? row.M(response) - : row.M(response[0], response[1]); - } + resolveHint(response, row[0], row.slice(1)); break; case 69: - var errorInfo = JSON.parse(row); - tag = errorInfo.digest; - var env = errorInfo.env; - row = Error( - errorInfo.message || - "An error occurred in the Server Components render but no message was provided" - ); - errorInfo = errorInfo.stack; - var v8StyleStack = row.name + ": " + row.message; - if (errorInfo) - for (var i = 0; i < errorInfo.length; i++) { - var frame = errorInfo[i], - name = frame[0], - filename = frame[1], - line = frame[2]; - frame = frame[3]; - v8StyleStack = name - ? v8StyleStack + - ("\n at " + - name + - " (" + - filename + - ":" + - line + - ":" + - frame + - ")") - : v8StyleStack + - ("\n at " + filename + ":" + line + ":" + frame); - } - row.stack = v8StyleStack; - row.digest = tag; - row.environmentName = env; - tag = response._chunks; - (env = tag.get(id)) - ? triggerErrorOnChunk(env, row) - : tag.set(id, new ReactPromise("rejected", null, row, response)); + row = JSON.parse(row); + tag = resolveErrorDev(response, row); + tag.digest = row.digest; + row = response._chunks; + var chunk = row.get(id); + chunk + ? triggerErrorOnChunk(chunk, tag) + : row.set(id, new ReactPromise("rejected", null, tag, response)); break; case 84: - tag = response._chunks; - (env = tag.get(id)) && "pending" !== env.status - ? env.reason.enqueueValue(row) - : tag.set(id, new ReactPromise("fulfilled", row, null, response)); + resolveText(response, id, row); break; case 68: - row = JSON.parse(row, response._fromJSON); - null === row.owner && null != response._debugRootOwner - ? ((row.owner = response._debugRootOwner), - (row.debugStack = response._debugRootStack)) - : initializeFakeStack(response, row); - response = getChunk(response, id); - (response._debugInfo || (response._debugInfo = [])).push(row); + tag = new ReactPromise("resolved_model", row, null, response); + initializeModelChunk(tag); + "fulfilled" === tag.status + ? resolveDebugInfo(response, id, tag.value) + : tag.then( + function (v) { + return resolveDebugInfo(response, id, v); + }, + function () {} + ); break; case 87: - response._replayConsole && - ((row = JSON.parse(row, response._fromJSON)), - (response = row[0]), - (id = row[3]), - (row = row.slice(4)), - bindToConsole(response, row, id)()); + resolveConsoleEntry(response, row); break; case 82: startReadableStream(response, id, void 0); @@ -2185,18 +2240,10 @@ startAsyncIterable(response, id, !0); break; case 67: - (response = response._chunks.get(id)) && - "fulfilled" === response.status && - response.reason.close("" === row ? '"$undefined"' : row); + stopStream(response, id, row); break; default: - (tag = response._chunks), - (env = tag.get(id)) - ? resolveModelChunk(env, row) - : tag.set( - id, - new ReactPromise("resolved_model", row, null, response) - ); + resolveModel(response, id, row); } } function createFromJSONCallback(response) { diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js index 50258515567f2..193ff8720afea 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.js @@ -470,12 +470,17 @@ function processReply( pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } var boundCache = new WeakMap(); function encodeFormData(reference) { @@ -1045,6 +1050,8 @@ function parseModelString(response, parentObject, key, value) { (value = value.slice(2)), getOutlinedModel(response, value, parentObject, key, createFormData) ); + case "Z": + return resolveErrorProd(); case "i": return ( (value = value.slice(2)), @@ -1323,6 +1330,13 @@ function startAsyncIterable(response, id, iterator) { } ); } +function resolveErrorProd() { + var error = Error( + "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." + ); + error.stack = "Error: " + error.message; + return error; +} function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; @@ -1459,12 +1473,9 @@ function processFullStringRow(response, id, tag, row) { } break; case 69: - tag = JSON.parse(row).digest; - row = Error( - "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." - ); - row.stack = "Error: " + row.message; - row.digest = tag; + tag = JSON.parse(row); + row = resolveErrorProd(); + row.digest = tag.digest; tag = response._chunks; var chunk = tag.get(id); chunk diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js index 52b18b183411f..daf238ac79312 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.development.js @@ -729,12 +729,17 @@ pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } function encodeFormData(reference) { var resolve, @@ -1524,6 +1529,17 @@ createFormData ) ); + case "Z": + return ( + (value = value.slice(2)), + getOutlinedModel( + response, + value, + parentObject, + key, + resolveErrorDev + ) + ); case "i": return ( (value = value.slice(2)), @@ -1614,6 +1630,23 @@ void 0 === environmentName ? "Server" : environmentName; this._fromJSON = createFromJSONCallback(this); } + function resolveModel(response, id, model) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk + ? resolveModelChunk(chunk, model) + : chunks.set( + id, + new ReactPromise("resolved_model", model, null, response) + ); + } + function resolveText(response, id, text) { + var chunks = response._chunks, + chunk = chunks.get(id); + chunk && "pending" !== chunk.status + ? chunk.reason.enqueueValue(text) + : chunks.set(id, new ReactPromise("fulfilled", text, null, response)); + } function resolveBuffer(response, id, buffer) { var chunks = response._chunks, chunk = chunks.get(id); @@ -1853,6 +1886,88 @@ } ); } + function stopStream(response, id, row) { + (response = response._chunks.get(id)) && + "fulfilled" === response.status && + response.reason.close("" === row ? '"$undefined"' : row); + } + function resolveErrorDev(response, errorInfo) { + response = errorInfo.stack; + var env = errorInfo.env; + errorInfo = Error( + errorInfo.message || + "An error occurred in the Server Components render but no message was provided" + ); + var v8StyleStack = errorInfo.name + ": " + errorInfo.message; + if (response) + for (var i = 0; i < response.length; i++) { + var frame = response[i], + name = frame[0], + filename = frame[1], + line = frame[2]; + frame = frame[3]; + v8StyleStack = name + ? v8StyleStack + + ("\n at " + + name + + " (" + + filename + + ":" + + line + + ":" + + frame + + ")") + : v8StyleStack + + ("\n at " + filename + ":" + line + ":" + frame); + } + errorInfo.stack = v8StyleStack; + errorInfo.environmentName = env; + return errorInfo; + } + function resolveHint(response, code, model) { + response = JSON.parse(model, response._fromJSON); + model = ReactDOMSharedInternals.d; + switch (code) { + case "D": + model.D(response); + break; + case "C": + "string" === typeof response + ? model.C(response) + : model.C(response[0], response[1]); + break; + case "L": + code = response[0]; + var as = response[1]; + 3 === response.length + ? model.L(code, as, response[2]) + : model.L(code, as); + break; + case "m": + "string" === typeof response + ? model.m(response) + : model.m(response[0], response[1]); + break; + case "X": + "string" === typeof response + ? model.X(response) + : model.X(response[0], response[1]); + break; + case "S": + "string" === typeof response + ? model.S(response) + : model.S( + response[0], + 0 === response[1] ? void 0 : response[1], + 3 === response.length ? response[2] : void 0 + ); + break; + case "M": + "string" === typeof response + ? model.M(response) + : model.M(response[0], response[1]); + } + } function createFakeFunction( name, filename, @@ -1941,9 +2056,26 @@ null != debugInfo.owner && initializeFakeStack(response, debugInfo.owner)); } + function resolveDebugInfo(response, id, debugInfo) { + null === debugInfo.owner && null != response._debugRootOwner + ? ((debugInfo.owner = response._debugRootOwner), + (debugInfo.debugStack = response._debugRootStack)) + : initializeFakeStack(response, debugInfo); + response = getChunk(response, id); + (response._debugInfo || (response._debugInfo = [])).push(debugInfo); + } function getCurrentStackInDEV() { return ""; } + function resolveConsoleEntry(response, value) { + if (response._replayConsole) { + var payload = JSON.parse(value, response._fromJSON); + response = payload[0]; + value = payload[3]; + payload = payload.slice(4); + bindToConsole(response, payload, value)(); + } + } function mergeBuffer(buffer, lastChunk) { for ( var l = buffer.length, byteLength = lastChunk.length, i = 0; @@ -2040,112 +2172,35 @@ resolveModule(response, id, row); break; case 72: - id = row[0]; - row = row.slice(1); - response = JSON.parse(row, response._fromJSON); - row = ReactDOMSharedInternals.d; - switch (id) { - case "D": - row.D(response); - break; - case "C": - "string" === typeof response - ? row.C(response) - : row.C(response[0], response[1]); - break; - case "L": - id = response[0]; - tag = response[1]; - 3 === response.length - ? row.L(id, tag, response[2]) - : row.L(id, tag); - break; - case "m": - "string" === typeof response - ? row.m(response) - : row.m(response[0], response[1]); - break; - case "X": - "string" === typeof response - ? row.X(response) - : row.X(response[0], response[1]); - break; - case "S": - "string" === typeof response - ? row.S(response) - : row.S( - response[0], - 0 === response[1] ? void 0 : response[1], - 3 === response.length ? response[2] : void 0 - ); - break; - case "M": - "string" === typeof response - ? row.M(response) - : row.M(response[0], response[1]); - } + resolveHint(response, row[0], row.slice(1)); break; case 69: - var errorInfo = JSON.parse(row); - tag = errorInfo.digest; - var env = errorInfo.env; - row = Error( - errorInfo.message || - "An error occurred in the Server Components render but no message was provided" - ); - errorInfo = errorInfo.stack; - var v8StyleStack = row.name + ": " + row.message; - if (errorInfo) - for (var i = 0; i < errorInfo.length; i++) { - var frame = errorInfo[i], - name = frame[0], - filename = frame[1], - line = frame[2]; - frame = frame[3]; - v8StyleStack = name - ? v8StyleStack + - ("\n at " + - name + - " (" + - filename + - ":" + - line + - ":" + - frame + - ")") - : v8StyleStack + - ("\n at " + filename + ":" + line + ":" + frame); - } - row.stack = v8StyleStack; - row.digest = tag; - row.environmentName = env; - tag = response._chunks; - (env = tag.get(id)) - ? triggerErrorOnChunk(env, row) - : tag.set(id, new ReactPromise("rejected", null, row, response)); + row = JSON.parse(row); + tag = resolveErrorDev(response, row); + tag.digest = row.digest; + row = response._chunks; + var chunk = row.get(id); + chunk + ? triggerErrorOnChunk(chunk, tag) + : row.set(id, new ReactPromise("rejected", null, tag, response)); break; case 84: - tag = response._chunks; - (env = tag.get(id)) && "pending" !== env.status - ? env.reason.enqueueValue(row) - : tag.set(id, new ReactPromise("fulfilled", row, null, response)); + resolveText(response, id, row); break; case 68: - row = JSON.parse(row, response._fromJSON); - null === row.owner && null != response._debugRootOwner - ? ((row.owner = response._debugRootOwner), - (row.debugStack = response._debugRootStack)) - : initializeFakeStack(response, row); - response = getChunk(response, id); - (response._debugInfo || (response._debugInfo = [])).push(row); + tag = new ReactPromise("resolved_model", row, null, response); + initializeModelChunk(tag); + "fulfilled" === tag.status + ? resolveDebugInfo(response, id, tag.value) + : tag.then( + function (v) { + return resolveDebugInfo(response, id, v); + }, + function () {} + ); break; case 87: - response._replayConsole && - ((row = JSON.parse(row, response._fromJSON)), - (response = row[0]), - (id = row[3]), - (row = row.slice(4)), - bindToConsole(response, row, id)()); + resolveConsoleEntry(response, row); break; case 82: startReadableStream(response, id, void 0); @@ -2160,18 +2215,10 @@ startAsyncIterable(response, id, !0); break; case 67: - (response = response._chunks.get(id)) && - "fulfilled" === response.status && - response.reason.close("" === row ? '"$undefined"' : row); + stopStream(response, id, row); break; default: - (tag = response._chunks), - (env = tag.get(id)) - ? resolveModelChunk(env, row) - : tag.set( - id, - new ReactPromise("resolved_model", row, null, response) - ); + resolveModel(response, id, row); } } function createFromJSONCallback(response) { diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.js index bfe9e0469a5a0..db7a5663552eb 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.js @@ -453,12 +453,17 @@ function processReply( pendingParts = 0, formData = null, writtenObjects = new WeakMap(), - modelRoot = root; - root = serializeModel(root, 0); + modelRoot = root, + json = serializeModel(root, 0); null === formData - ? resolve(root) - : (formData.set(formFieldPrefix + "0", root), + ? resolve(json) + : (formData.set(formFieldPrefix + "0", json), 0 === pendingParts && resolve(formData)); + return function () { + 0 < pendingParts && + ((pendingParts = 0), + null === formData ? resolve(json) : resolve(formData)); + }; } var boundCache = new WeakMap(); function encodeFormData(reference) { @@ -1024,6 +1029,8 @@ function parseModelString(response, parentObject, key, value) { (value = value.slice(2)), getOutlinedModel(response, value, parentObject, key, createFormData) ); + case "Z": + return resolveErrorProd(); case "i": return ( (value = value.slice(2)), @@ -1302,6 +1309,13 @@ function startAsyncIterable(response, id, iterator) { } ); } +function resolveErrorProd() { + var error = Error( + "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." + ); + error.stack = "Error: " + error.message; + return error; +} function mergeBuffer(buffer, lastChunk) { for (var l = buffer.length, byteLength = lastChunk.length, i = 0; i < l; i++) byteLength += buffer[i].byteLength; @@ -1438,12 +1452,9 @@ function processFullStringRow(response, id, tag, row) { } break; case 69: - tag = JSON.parse(row).digest; - row = Error( - "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error." - ); - row.stack = "Error: " + row.message; - row.digest = tag; + tag = JSON.parse(row); + row = resolveErrorProd(); + row.digest = tag.digest; tag = response._chunks; var chunk = tag.get(id); chunk diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js index 736c01c78101c..55dc3905ce1fc 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js @@ -927,7 +927,8 @@ key: key, owner: task.debugOwner }; - outlineModel(request, componentDebugInfo); + componentDebugInfo.props = props; + outlineComponentInfo(request, componentDebugInfo); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; } @@ -1088,7 +1089,7 @@ return ( (type = task.implicitSlot), null === task.keyPath && (task.implicitSlot = !0), - (props = renderModelDestructive( + (request = renderModelDestructive( request, task, emptyRoot, @@ -1096,7 +1097,7 @@ props.children )), (task.implicitSlot = type), - props + request ); if ( null != type && @@ -1122,13 +1123,12 @@ type._store.validated = 1; } } else return renderFunctionComponent(request, task, key, type, props); - request = key; - key = task.keyPath; - null === request - ? (request = key) - : null !== key && (request = key + "," + request); - props = [REACT_ELEMENT_TYPE, type, request, props, task.debugOwner]; - task = task.implicitSlot && null !== request ? [props] : props; + ref = task.keyPath; + null === key ? (key = ref) : null !== ref && (key = ref + "," + key); + null !== task.debugOwner && + outlineComponentInfo(request, task.debugOwner); + request = [REACT_ELEMENT_TYPE, type, key, props, task.debugOwner]; + task = task.implicitSlot && null !== key ? [request] : request; return task; } function pingTask(request, task) { @@ -1398,18 +1398,6 @@ reader.read().then(progress).catch(error); return "$B" + newTask.id.toString(16); } - function isReactComponentInfo(value) { - return ( - (("object" === typeof value.debugTask && - null !== value.debugTask && - "function" === typeof value.debugTask.run) || - value.debugStack instanceof Error) && - "undefined" === typeof value.stack && - "string" === typeof value.name && - "string" === typeof value.env && - void 0 !== value.owner - ); - } function renderModel(request, task, parent, key, value) { var prevKeyPath = task.keyPath, prevImplicitSlot = task.implicitSlot; @@ -1596,6 +1584,7 @@ if (value instanceof Set) return serializeSet(request, value); if ("function" === typeof FormData && value instanceof FormData) return serializeFormData(request, value); + if (value instanceof Error) return serializeErrorValue(request, value); if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -1650,13 +1639,6 @@ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." + describeObjectForErrorMessage(parent, parentPropertyName) ); - if (isReactComponentInfo(value)) - return { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }; if ("Object" !== objectName(value)) callWithDebugContextInDEV(request, task, function () { console.error( @@ -1797,6 +1779,27 @@ closeWithError(request.destination, error)) : ((request.status = CLOSING), (request.fatalError = error)); } + function serializeErrorValue(request, error) { + var env = (0, request.environmentName)(); + try { + var message = String(error.message); + var stack = filterStackTrace(request, error, 0); + var errorEnv = error.environmentName; + "string" === typeof errorEnv && (env = errorEnv); + } catch (x) { + (message = + "An error occurred but serializing the error message failed."), + (stack = []); + } + return ( + "$Z" + + outlineModel(request, { + message: message, + stack: stack, + env: env + }).toString(16) + ); + } function emitErrorChunk(request, id, digest, error) { var env = (0, request.environmentName)(); try { @@ -1831,7 +1834,7 @@ request.completedRegularChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var counter = { objectCount: 0 }; + var counter = { objectLimit: 500 }; debugInfo = stringify(debugInfo, function (parentPropertyName, value) { return renderConsoleValue( request, @@ -1845,6 +1848,32 @@ id = stringToChunk(id); request.completedRegularChunks.push(id); } + function outlineComponentInfo(request, componentInfo) { + if (!request.writtenObjects.has(componentInfo)) { + null != componentInfo.owner && + outlineComponentInfo(request, componentInfo.owner); + var objectLimit = 10; + null != componentInfo.stack && + (objectLimit += componentInfo.stack.length); + objectLimit = { objectLimit: objectLimit }; + var componentDebugInfo = { + name: componentInfo.name, + env: componentInfo.env, + key: componentInfo.key, + owner: componentInfo.owner + }; + componentDebugInfo.props = componentInfo.props; + objectLimit = outlineConsoleValue( + request, + objectLimit, + componentDebugInfo + ); + request.writtenObjects.set( + componentInfo, + serializeByValueID(objectLimit) + ); + } + } function emitTypedArrayChunk(request, id, tag, typedArray) { request.pendingChunks++; var buffer = new Uint8Array( @@ -1892,11 +1921,25 @@ ((parent = request.temporaryReferences.get(value)), void 0 !== parent) ) return "$T" + parent; - if (500 < counter.objectCount) return "$Y"; - counter.objectCount++; parent = request.writtenObjects.get(value); + if (void 0 !== parent) return parent; + if (0 >= counter.objectLimit) return "$Y"; + counter.objectLimit--; + switch (value.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + null != value._owner && + outlineComponentInfo(request, value._owner), + [ + REACT_ELEMENT_TYPE, + value.type, + value.key, + value.props, + value._owner + ] + ); + } if ("function" === typeof value.then) { - if (void 0 !== parent) return parent; switch (value.status) { case "fulfilled": return ( @@ -1914,20 +1957,19 @@ } return "$@"; } - return void 0 !== parent - ? parent - : isArrayImpl(value) - ? value - : value instanceof Map + return isArrayImpl(value) + ? value + : value instanceof Map + ? ((value = Array.from(value)), + "$Q" + outlineConsoleValue(request, counter, value).toString(16)) + : value instanceof Set ? ((value = Array.from(value)), - "$Q" + + "$W" + outlineConsoleValue(request, counter, value).toString(16)) - : value instanceof Set - ? ((value = Array.from(value)), - "$W" + - outlineConsoleValue(request, counter, value).toString(16)) - : "function" === typeof FormData && value instanceof FormData - ? serializeFormData(request, value) + : "function" === typeof FormData && value instanceof FormData + ? serializeFormData(request, value) + : value instanceof Error + ? serializeErrorValue(request, value) : value instanceof ArrayBuffer ? serializeTypedArray(request, "A", new Uint8Array(value)) : value instanceof Int8Array @@ -1971,14 +2013,7 @@ ? serializeBlob(request, value) : getIteratorFn(value) ? Array.from(value) - : isReactComponentInfo(value) - ? { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - } - : value; + : value; } if ("string" === typeof value) return "Z" === value[value.length - 1] && originalValue instanceof Date @@ -2023,7 +2058,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); request.pendingChunks++; @@ -2041,8 +2079,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }, - env = (0, request.environmentName)(); + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(); methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { @@ -2055,7 +2094,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); id = serializeRowHeader("W", id) + args + "\n"; @@ -2066,7 +2108,7 @@ for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, "string" === typeof debugInfo[i].name && - outlineModel(request, debugInfo[i]), + outlineComponentInfo(request, debugInfo[i]), emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js index 9f8436e528cb2..e89c6e0eea0ef 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.js @@ -1459,6 +1459,7 @@ function renderModelDestructive( (value = Array.from(value.entries())), "$K" + outlineModel(request, value).toString(16) ); + if (value instanceof Error) return "$Z"; if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js index 4bb05c5c1b019..6ef8c407eab24 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js @@ -936,7 +936,8 @@ key: key, owner: task.debugOwner }; - outlineModel(request, componentDebugInfo); + componentDebugInfo.props = props; + outlineComponentInfo(request, componentDebugInfo); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; } @@ -1105,7 +1106,7 @@ return ( (type = task.implicitSlot), null === task.keyPath && (task.implicitSlot = !0), - (props = renderModelDestructive( + (request = renderModelDestructive( request, task, emptyRoot, @@ -1113,7 +1114,7 @@ props.children )), (task.implicitSlot = type), - props + request ); if ( null != type && @@ -1139,13 +1140,12 @@ type._store.validated = 1; } } else return renderFunctionComponent(request, task, key, type, props); - request = key; - key = task.keyPath; - null === request - ? (request = key) - : null !== key && (request = key + "," + request); - props = [REACT_ELEMENT_TYPE, type, request, props, task.debugOwner]; - task = task.implicitSlot && null !== request ? [props] : props; + ref = task.keyPath; + null === key ? (key = ref) : null !== ref && (key = ref + "," + key); + null !== task.debugOwner && + outlineComponentInfo(request, task.debugOwner); + request = [REACT_ELEMENT_TYPE, type, key, props, task.debugOwner]; + task = task.implicitSlot && null !== key ? [request] : request; return task; } function pingTask(request, task) { @@ -1415,18 +1415,6 @@ reader.read().then(progress).catch(error); return "$B" + newTask.id.toString(16); } - function isReactComponentInfo(value) { - return ( - (("object" === typeof value.debugTask && - null !== value.debugTask && - "function" === typeof value.debugTask.run) || - value.debugStack instanceof Error) && - "undefined" === typeof value.stack && - "string" === typeof value.name && - "string" === typeof value.env && - void 0 !== value.owner - ); - } function renderModel(request, task, parent, key, value) { var prevKeyPath = task.keyPath, prevImplicitSlot = task.implicitSlot; @@ -1613,6 +1601,7 @@ if (value instanceof Set) return serializeSet(request, value); if ("function" === typeof FormData && value instanceof FormData) return serializeFormData(request, value); + if (value instanceof Error) return serializeErrorValue(request, value); if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -1667,13 +1656,6 @@ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." + describeObjectForErrorMessage(parent, parentPropertyName) ); - if (isReactComponentInfo(value)) - return { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }; if ("Object" !== objectName(value)) callWithDebugContextInDEV(request, task, function () { console.error( @@ -1825,6 +1807,27 @@ closeWithError(request.destination, error)) : ((request.status = CLOSING), (request.fatalError = error)); } + function serializeErrorValue(request, error) { + var env = (0, request.environmentName)(); + try { + var message = String(error.message); + var stack = filterStackTrace(request, error, 0); + var errorEnv = error.environmentName; + "string" === typeof errorEnv && (env = errorEnv); + } catch (x) { + (message = + "An error occurred but serializing the error message failed."), + (stack = []); + } + return ( + "$Z" + + outlineModel(request, { + message: message, + stack: stack, + env: env + }).toString(16) + ); + } function emitErrorChunk(request, id, digest, error) { var env = (0, request.environmentName)(); try { @@ -1859,7 +1862,7 @@ request.completedRegularChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var counter = { objectCount: 0 }; + var counter = { objectLimit: 500 }; debugInfo = stringify(debugInfo, function (parentPropertyName, value) { return renderConsoleValue( request, @@ -1873,6 +1876,32 @@ id = stringToChunk(id); request.completedRegularChunks.push(id); } + function outlineComponentInfo(request, componentInfo) { + if (!request.writtenObjects.has(componentInfo)) { + null != componentInfo.owner && + outlineComponentInfo(request, componentInfo.owner); + var objectLimit = 10; + null != componentInfo.stack && + (objectLimit += componentInfo.stack.length); + objectLimit = { objectLimit: objectLimit }; + var componentDebugInfo = { + name: componentInfo.name, + env: componentInfo.env, + key: componentInfo.key, + owner: componentInfo.owner + }; + componentDebugInfo.props = componentInfo.props; + objectLimit = outlineConsoleValue( + request, + objectLimit, + componentDebugInfo + ); + request.writtenObjects.set( + componentInfo, + serializeByValueID(objectLimit) + ); + } + } function emitTypedArrayChunk(request, id, tag, typedArray) { request.pendingChunks++; var buffer = new Uint8Array( @@ -1920,11 +1949,25 @@ ((parent = request.temporaryReferences.get(value)), void 0 !== parent) ) return "$T" + parent; - if (500 < counter.objectCount) return "$Y"; - counter.objectCount++; parent = request.writtenObjects.get(value); + if (void 0 !== parent) return parent; + if (0 >= counter.objectLimit) return "$Y"; + counter.objectLimit--; + switch (value.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + null != value._owner && + outlineComponentInfo(request, value._owner), + [ + REACT_ELEMENT_TYPE, + value.type, + value.key, + value.props, + value._owner + ] + ); + } if ("function" === typeof value.then) { - if (void 0 !== parent) return parent; switch (value.status) { case "fulfilled": return ( @@ -1942,20 +1985,19 @@ } return "$@"; } - return void 0 !== parent - ? parent - : isArrayImpl(value) - ? value - : value instanceof Map + return isArrayImpl(value) + ? value + : value instanceof Map + ? ((value = Array.from(value)), + "$Q" + outlineConsoleValue(request, counter, value).toString(16)) + : value instanceof Set ? ((value = Array.from(value)), - "$Q" + + "$W" + outlineConsoleValue(request, counter, value).toString(16)) - : value instanceof Set - ? ((value = Array.from(value)), - "$W" + - outlineConsoleValue(request, counter, value).toString(16)) - : "function" === typeof FormData && value instanceof FormData - ? serializeFormData(request, value) + : "function" === typeof FormData && value instanceof FormData + ? serializeFormData(request, value) + : value instanceof Error + ? serializeErrorValue(request, value) : value instanceof ArrayBuffer ? serializeTypedArray(request, "A", new Uint8Array(value)) : value instanceof Int8Array @@ -1999,14 +2041,7 @@ ? serializeBlob(request, value) : getIteratorFn(value) ? Array.from(value) - : isReactComponentInfo(value) - ? { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - } - : value; + : value; } if ("string" === typeof value) return "Z" === value[value.length - 1] && originalValue instanceof Date @@ -2051,7 +2086,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); request.pendingChunks++; @@ -2069,8 +2107,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }, - env = (0, request.environmentName)(); + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(); methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { @@ -2083,7 +2122,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); id = serializeRowHeader("W", id) + args + "\n"; @@ -2094,7 +2136,7 @@ for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, "string" === typeof debugInfo[i].name && - outlineModel(request, debugInfo[i]), + outlineComponentInfo(request, debugInfo[i]), emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js index 3693cda7d9df4..6f9174380d3e4 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js @@ -1464,6 +1464,7 @@ function renderModelDestructive( (value = Array.from(value.entries())), "$K" + outlineModel(request, value).toString(16) ); + if (value instanceof Error) return "$Z"; if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js index 19bc1046a49c6..badfc88de3737 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js @@ -956,7 +956,8 @@ key: key, owner: task.debugOwner }; - outlineModel(request, componentDebugInfo); + componentDebugInfo.props = props; + outlineComponentInfo(request, componentDebugInfo); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; } @@ -1123,7 +1124,7 @@ return ( (type = task.implicitSlot), null === task.keyPath && (task.implicitSlot = !0), - (props = renderModelDestructive( + (request = renderModelDestructive( request, task, emptyRoot, @@ -1131,7 +1132,7 @@ props.children )), (task.implicitSlot = type), - props + request ); if ( null != type && @@ -1157,13 +1158,12 @@ type._store.validated = 1; } } else return renderFunctionComponent(request, task, key, type, props); - request = key; - key = task.keyPath; - null === request - ? (request = key) - : null !== key && (request = key + "," + request); - props = [REACT_ELEMENT_TYPE, type, request, props, task.debugOwner]; - task = task.implicitSlot && null !== request ? [props] : props; + ref = task.keyPath; + null === key ? (key = ref) : null !== ref && (key = ref + "," + key); + null !== task.debugOwner && + outlineComponentInfo(request, task.debugOwner); + request = [REACT_ELEMENT_TYPE, type, key, props, task.debugOwner]; + task = task.implicitSlot && null !== key ? [request] : request; return task; } function pingTask(request, task) { @@ -1431,18 +1431,6 @@ reader.read().then(progress).catch(error); return "$B" + newTask.id.toString(16); } - function isReactComponentInfo(value) { - return ( - (("object" === typeof value.debugTask && - null !== value.debugTask && - "function" === typeof value.debugTask.run) || - value.debugStack instanceof Error) && - "undefined" === typeof value.stack && - "string" === typeof value.name && - "string" === typeof value.env && - void 0 !== value.owner - ); - } function renderModel(request, task, parent, key, value) { var prevKeyPath = task.keyPath, prevImplicitSlot = task.implicitSlot; @@ -1629,6 +1617,7 @@ if (value instanceof Set) return serializeSet(request, value); if ("function" === typeof FormData && value instanceof FormData) return serializeFormData(request, value); + if (value instanceof Error) return serializeErrorValue(request, value); if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -1683,13 +1672,6 @@ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." + describeObjectForErrorMessage(parent, parentPropertyName) ); - if (isReactComponentInfo(value)) - return { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }; if ("Object" !== objectName(value)) callWithDebugContextInDEV(request, task, function () { console.error( @@ -1836,6 +1818,27 @@ ? ((request.status = CLOSED), request.destination.destroy(error)) : ((request.status = CLOSING), (request.fatalError = error)); } + function serializeErrorValue(request, error) { + var env = (0, request.environmentName)(); + try { + var message = String(error.message); + var stack = filterStackTrace(request, error, 0); + var errorEnv = error.environmentName; + "string" === typeof errorEnv && (env = errorEnv); + } catch (x) { + (message = + "An error occurred but serializing the error message failed."), + (stack = []); + } + return ( + "$Z" + + outlineModel(request, { + message: message, + stack: stack, + env: env + }).toString(16) + ); + } function emitErrorChunk(request, id, digest, error) { var env = (0, request.environmentName)(); try { @@ -1868,7 +1871,7 @@ request.completedRegularChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var counter = { objectCount: 0 }; + var counter = { objectLimit: 500 }; debugInfo = stringify(debugInfo, function (parentPropertyName, value) { return renderConsoleValue( request, @@ -1881,6 +1884,32 @@ id = serializeRowHeader("D", id) + debugInfo + "\n"; request.completedRegularChunks.push(id); } + function outlineComponentInfo(request, componentInfo) { + if (!request.writtenObjects.has(componentInfo)) { + null != componentInfo.owner && + outlineComponentInfo(request, componentInfo.owner); + var objectLimit = 10; + null != componentInfo.stack && + (objectLimit += componentInfo.stack.length); + objectLimit = { objectLimit: objectLimit }; + var componentDebugInfo = { + name: componentInfo.name, + env: componentInfo.env, + key: componentInfo.key, + owner: componentInfo.owner + }; + componentDebugInfo.props = componentInfo.props; + objectLimit = outlineConsoleValue( + request, + objectLimit, + componentDebugInfo + ); + request.writtenObjects.set( + componentInfo, + serializeByValueID(objectLimit) + ); + } + } function emitTypedArrayChunk(request, id, tag, typedArray) { request.pendingChunks++; typedArray = new Uint8Array( @@ -1924,11 +1953,25 @@ ((parent = request.temporaryReferences.get(value)), void 0 !== parent) ) return "$T" + parent; - if (500 < counter.objectCount) return "$Y"; - counter.objectCount++; parent = request.writtenObjects.get(value); + if (void 0 !== parent) return parent; + if (0 >= counter.objectLimit) return "$Y"; + counter.objectLimit--; + switch (value.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + null != value._owner && + outlineComponentInfo(request, value._owner), + [ + REACT_ELEMENT_TYPE, + value.type, + value.key, + value.props, + value._owner + ] + ); + } if ("function" === typeof value.then) { - if (void 0 !== parent) return parent; switch (value.status) { case "fulfilled": return ( @@ -1946,20 +1989,19 @@ } return "$@"; } - return void 0 !== parent - ? parent - : isArrayImpl(value) - ? value - : value instanceof Map + return isArrayImpl(value) + ? value + : value instanceof Map + ? ((value = Array.from(value)), + "$Q" + outlineConsoleValue(request, counter, value).toString(16)) + : value instanceof Set ? ((value = Array.from(value)), - "$Q" + + "$W" + outlineConsoleValue(request, counter, value).toString(16)) - : value instanceof Set - ? ((value = Array.from(value)), - "$W" + - outlineConsoleValue(request, counter, value).toString(16)) - : "function" === typeof FormData && value instanceof FormData - ? serializeFormData(request, value) + : "function" === typeof FormData && value instanceof FormData + ? serializeFormData(request, value) + : value instanceof Error + ? serializeErrorValue(request, value) : value instanceof ArrayBuffer ? serializeTypedArray(request, "A", new Uint8Array(value)) : value instanceof Int8Array @@ -2003,14 +2045,7 @@ ? serializeBlob(request, value) : getIteratorFn(value) ? Array.from(value) - : isReactComponentInfo(value) - ? { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - } - : value; + : value; } if ("string" === typeof value) return "Z" === value[value.length - 1] && originalValue instanceof Date @@ -2055,7 +2090,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); request.pendingChunks++; @@ -2072,8 +2110,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }, - env = (0, request.environmentName)(); + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(); methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { @@ -2086,7 +2125,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); id = serializeRowHeader("W", id) + args + "\n"; @@ -2096,7 +2138,7 @@ for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, "string" === typeof debugInfo[i].name && - outlineModel(request, debugInfo[i]), + outlineComponentInfo(request, debugInfo[i]), emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js index a60144160e89e..59254da953883 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.js @@ -1477,6 +1477,7 @@ function renderModelDestructive( (value = Array.from(value.entries())), "$K" + outlineModel(request, value).toString(16) ); + if (value instanceof Error) return "$Z"; if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -2774,12 +2775,12 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) { "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_212 = []; + var JSCompiler_object_inline_chunks_216 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_212.push(chunk); + JSCompiler_object_inline_chunks_216.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_212, { + var blob = new Blob(JSCompiler_object_inline_chunks_216, { type: mimeType }); response._formData.append(name, blob, filename); diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js index 94042eac2e09a..b6cc30f7e455e 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js @@ -956,7 +956,8 @@ key: key, owner: task.debugOwner }; - outlineModel(request, componentDebugInfo); + componentDebugInfo.props = props; + outlineComponentInfo(request, componentDebugInfo); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; } @@ -1123,7 +1124,7 @@ return ( (type = task.implicitSlot), null === task.keyPath && (task.implicitSlot = !0), - (props = renderModelDestructive( + (request = renderModelDestructive( request, task, emptyRoot, @@ -1131,7 +1132,7 @@ props.children )), (task.implicitSlot = type), - props + request ); if ( null != type && @@ -1157,13 +1158,12 @@ type._store.validated = 1; } } else return renderFunctionComponent(request, task, key, type, props); - request = key; - key = task.keyPath; - null === request - ? (request = key) - : null !== key && (request = key + "," + request); - props = [REACT_ELEMENT_TYPE, type, request, props, task.debugOwner]; - task = task.implicitSlot && null !== request ? [props] : props; + ref = task.keyPath; + null === key ? (key = ref) : null !== ref && (key = ref + "," + key); + null !== task.debugOwner && + outlineComponentInfo(request, task.debugOwner); + request = [REACT_ELEMENT_TYPE, type, key, props, task.debugOwner]; + task = task.implicitSlot && null !== key ? [request] : request; return task; } function pingTask(request, task) { @@ -1431,18 +1431,6 @@ reader.read().then(progress).catch(error); return "$B" + newTask.id.toString(16); } - function isReactComponentInfo(value) { - return ( - (("object" === typeof value.debugTask && - null !== value.debugTask && - "function" === typeof value.debugTask.run) || - value.debugStack instanceof Error) && - "undefined" === typeof value.stack && - "string" === typeof value.name && - "string" === typeof value.env && - void 0 !== value.owner - ); - } function renderModel(request, task, parent, key, value) { var prevKeyPath = task.keyPath, prevImplicitSlot = task.implicitSlot; @@ -1629,6 +1617,7 @@ if (value instanceof Set) return serializeSet(request, value); if ("function" === typeof FormData && value instanceof FormData) return serializeFormData(request, value); + if (value instanceof Error) return serializeErrorValue(request, value); if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -1683,13 +1672,6 @@ "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." + describeObjectForErrorMessage(parent, parentPropertyName) ); - if (isReactComponentInfo(value)) - return { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - }; if ("Object" !== objectName(value)) callWithDebugContextInDEV(request, task, function () { console.error( @@ -1836,6 +1818,27 @@ ? ((request.status = CLOSED), request.destination.destroy(error)) : ((request.status = CLOSING), (request.fatalError = error)); } + function serializeErrorValue(request, error) { + var env = (0, request.environmentName)(); + try { + var message = String(error.message); + var stack = filterStackTrace(request, error, 0); + var errorEnv = error.environmentName; + "string" === typeof errorEnv && (env = errorEnv); + } catch (x) { + (message = + "An error occurred but serializing the error message failed."), + (stack = []); + } + return ( + "$Z" + + outlineModel(request, { + message: message, + stack: stack, + env: env + }).toString(16) + ); + } function emitErrorChunk(request, id, digest, error) { var env = (0, request.environmentName)(); try { @@ -1868,7 +1871,7 @@ request.completedRegularChunks.push(id); } function emitDebugChunk(request, id, debugInfo) { - var counter = { objectCount: 0 }; + var counter = { objectLimit: 500 }; debugInfo = stringify(debugInfo, function (parentPropertyName, value) { return renderConsoleValue( request, @@ -1881,6 +1884,32 @@ id = serializeRowHeader("D", id) + debugInfo + "\n"; request.completedRegularChunks.push(id); } + function outlineComponentInfo(request, componentInfo) { + if (!request.writtenObjects.has(componentInfo)) { + null != componentInfo.owner && + outlineComponentInfo(request, componentInfo.owner); + var objectLimit = 10; + null != componentInfo.stack && + (objectLimit += componentInfo.stack.length); + objectLimit = { objectLimit: objectLimit }; + var componentDebugInfo = { + name: componentInfo.name, + env: componentInfo.env, + key: componentInfo.key, + owner: componentInfo.owner + }; + componentDebugInfo.props = componentInfo.props; + objectLimit = outlineConsoleValue( + request, + objectLimit, + componentDebugInfo + ); + request.writtenObjects.set( + componentInfo, + serializeByValueID(objectLimit) + ); + } + } function emitTypedArrayChunk(request, id, tag, typedArray) { request.pendingChunks++; typedArray = new Uint8Array( @@ -1924,11 +1953,25 @@ ((parent = request.temporaryReferences.get(value)), void 0 !== parent) ) return "$T" + parent; - if (500 < counter.objectCount) return "$Y"; - counter.objectCount++; parent = request.writtenObjects.get(value); + if (void 0 !== parent) return parent; + if (0 >= counter.objectLimit) return "$Y"; + counter.objectLimit--; + switch (value.$$typeof) { + case REACT_ELEMENT_TYPE: + return ( + null != value._owner && + outlineComponentInfo(request, value._owner), + [ + REACT_ELEMENT_TYPE, + value.type, + value.key, + value.props, + value._owner + ] + ); + } if ("function" === typeof value.then) { - if (void 0 !== parent) return parent; switch (value.status) { case "fulfilled": return ( @@ -1946,20 +1989,19 @@ } return "$@"; } - return void 0 !== parent - ? parent - : isArrayImpl(value) - ? value - : value instanceof Map + return isArrayImpl(value) + ? value + : value instanceof Map + ? ((value = Array.from(value)), + "$Q" + outlineConsoleValue(request, counter, value).toString(16)) + : value instanceof Set ? ((value = Array.from(value)), - "$Q" + + "$W" + outlineConsoleValue(request, counter, value).toString(16)) - : value instanceof Set - ? ((value = Array.from(value)), - "$W" + - outlineConsoleValue(request, counter, value).toString(16)) - : "function" === typeof FormData && value instanceof FormData - ? serializeFormData(request, value) + : "function" === typeof FormData && value instanceof FormData + ? serializeFormData(request, value) + : value instanceof Error + ? serializeErrorValue(request, value) : value instanceof ArrayBuffer ? serializeTypedArray(request, "A", new Uint8Array(value)) : value instanceof Int8Array @@ -2003,14 +2045,7 @@ ? serializeBlob(request, value) : getIteratorFn(value) ? Array.from(value) - : isReactComponentInfo(value) - ? { - name: value.name, - env: value.env, - key: value.key, - owner: value.owner - } - : value; + : value; } if ("string" === typeof value) return "Z" === value[value.length - 1] && originalValue instanceof Date @@ -2055,7 +2090,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); request.pendingChunks++; @@ -2072,8 +2110,9 @@ stackTrace, args ) { - var counter = { objectCount: 0 }, - env = (0, request.environmentName)(); + var counter = { objectLimit: 500 }; + null != owner && outlineComponentInfo(request, owner); + var env = (0, request.environmentName)(); methodName = [methodName, stackTrace, owner, env]; methodName.push.apply(methodName, args); args = stringify(methodName, function (parentPropertyName, value) { @@ -2086,7 +2125,10 @@ value ); } catch (x) { - return "unknown value"; + return ( + "Unknown Value: React could not send it from the server.\n" + + x.message + ); } }); id = serializeRowHeader("W", id) + args + "\n"; @@ -2096,7 +2138,7 @@ for (var i = 0; i < debugInfo.length; i++) request.pendingChunks++, "string" === typeof debugInfo[i].name && - outlineModel(request, debugInfo[i]), + outlineComponentInfo(request, debugInfo[i]), emitDebugChunk(request, id, debugInfo[i]); } function emitChunk(request, task, value) { diff --git a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js index cf3c6c75cd473..07873c3594d4b 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js +++ b/packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.js @@ -1477,6 +1477,7 @@ function renderModelDestructive( (value = Array.from(value.entries())), "$K" + outlineModel(request, value).toString(16) ); + if (value instanceof Error) return "$Z"; if (value instanceof ArrayBuffer) return serializeTypedArray(request, "A", new Uint8Array(value)); if (value instanceof Int8Array) @@ -2742,12 +2743,12 @@ exports.decodeReplyFromBusboy = function (busboyStream, webpackMap, options) { "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it." ); pendingFiles++; - var JSCompiler_object_inline_chunks_212 = []; + var JSCompiler_object_inline_chunks_216 = []; value.on("data", function (chunk) { - JSCompiler_object_inline_chunks_212.push(chunk); + JSCompiler_object_inline_chunks_216.push(chunk); }); value.on("end", function () { - var blob = new Blob(JSCompiler_object_inline_chunks_212, { + var blob = new Blob(JSCompiler_object_inline_chunks_216, { type: mimeType }); response._formData.append(name, blob, filename); diff --git a/packages/next/src/compiled/react-server-dom-webpack/package.json b/packages/next/src/compiled/react-server-dom-webpack/package.json index 212eb8110eb53..3631fe107b63c 100644 --- a/packages/next/src/compiled/react-server-dom-webpack/package.json +++ b/packages/next/src/compiled/react-server-dom-webpack/package.json @@ -64,8 +64,8 @@ "webpack-sources": "^3.2.0" }, "peerDependencies": { - "react": "19.0.0-rc-2d16326d-20240930", - "react-dom": "19.0.0-rc-2d16326d-20240930", + "react": "19.0.0-rc-1460d67c-20241003", + "react-dom": "19.0.0-rc-1460d67c-20241003", "webpack": "^5.59.0" } } \ No newline at end of file diff --git a/packages/next/src/compiled/react/cjs/react.development.js b/packages/next/src/compiled/react/cjs/react.development.js index 3ec2a969fc470..67ef4edc05746 100644 --- a/packages/next/src/compiled/react/cjs/react.development.js +++ b/packages/next/src/compiled/react/cjs/react.development.js @@ -1516,7 +1516,7 @@ exports.useTransition = function () { return resolveDispatcher().useTransition(); }; - exports.version = "19.0.0-rc-2d16326d-20240930"; + exports.version = "19.0.0-rc-1460d67c-20241003"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/packages/next/src/compiled/react/cjs/react.production.js b/packages/next/src/compiled/react/cjs/react.production.js index 61da7506f8c98..2401be94a1446 100644 --- a/packages/next/src/compiled/react/cjs/react.production.js +++ b/packages/next/src/compiled/react/cjs/react.production.js @@ -536,4 +536,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactSharedInternals.H.useTransition(); }; -exports.version = "19.0.0-rc-2d16326d-20240930"; +exports.version = "19.0.0-rc-1460d67c-20241003"; diff --git a/packages/next/src/compiled/react/cjs/react.react-server.development.js b/packages/next/src/compiled/react/cjs/react.react-server.development.js index f159898a062e9..f031bc3404bf7 100644 --- a/packages/next/src/compiled/react/cjs/react.react-server.development.js +++ b/packages/next/src/compiled/react/cjs/react.react-server.development.js @@ -1113,5 +1113,5 @@ exports.useMemo = function (create, deps) { return resolveDispatcher().useMemo(create, deps); }; - exports.version = "19.0.0-rc-2d16326d-20240930"; + exports.version = "19.0.0-rc-1460d67c-20241003"; })(); diff --git a/packages/next/src/compiled/react/cjs/react.react-server.production.js b/packages/next/src/compiled/react/cjs/react.react-server.production.js index 82f37c62674a0..336dc0b505c29 100644 --- a/packages/next/src/compiled/react/cjs/react.react-server.production.js +++ b/packages/next/src/compiled/react/cjs/react.react-server.production.js @@ -424,4 +424,4 @@ exports.useId = function () { exports.useMemo = function (create, deps) { return ReactSharedInternals.H.useMemo(create, deps); }; -exports.version = "19.0.0-rc-2d16326d-20240930"; +exports.version = "19.0.0-rc-1460d67c-20241003"; diff --git a/packages/next/src/compiled/unistore/unistore.js b/packages/next/src/compiled/unistore/unistore.js index b6368abb2b14e..548d3adb80267 100644 --- a/packages/next/src/compiled/unistore/unistore.js +++ b/packages/next/src/compiled/unistore/unistore.js @@ -1 +1 @@ -(()=>{var t={826:t=>{function n(t,i){for(var _ in i)t[_]=i[_];return t}t.exports=function(t){var i=[];function u(t){for(var _=[],a=0;a{var t={351:t=>{function n(t,i){for(var _ in i)t[_]=i[_];return t}t.exports=function(t){var i=[];function u(t){for(var _=[],a=0;a