From 0a50547a9812ba05a438f93b9bfe74d9308d75ed Mon Sep 17 00:00:00 2001 From: acdlite Date: Sun, 2 Jul 2023 02:49:14 +0000 Subject: [PATCH] Detect and warn about native async function components in development (#27031) Adds a development warning to complement the error introduced by https://github.com/facebook/react/pull/27019. We can detect and warn about async client components by checking the prototype of the function. This won't work for environments where async functions are transpiled, but for native async functions, it allows us to log an earlier warning during development, including in cases that don't trigger the infinite loop guard added in https://github.com/facebook/react/pull/27019. It does not supersede the infinite loop guard, though, because that mechanism also prevents the app from crashing. I also added a warning for calling a hook inside an async function. This one fires even during a transition. We could add a corresponding warning to Flight, since hooks are not allowed in async Server Components, either. (Though in both environments, this is better handled by a lint rule.) DiffTrain build for commit https://github.com/facebook/react/commit/5c8dabf8864e1d826c831d6096b2dfa66309961a. --- .../cjs/ReactTestRenderer-dev.js | 121 +++++++-- .../cjs/ReactTestRenderer-prod.js | 182 +++++++------ .../cjs/ReactTestRenderer-profiling.js | 240 +++++++++--------- .../RKJSModules/vendor/react/cjs/React-dev.js | 2 +- .../vendor/react/cjs/React-prod.js | 2 +- .../vendor/react/cjs/React-profiling.js | 2 +- .../Libraries/Renderer/REVISION | 2 +- .../implementations/ReactFabric-dev.fb.js | 121 +++++++-- .../implementations/ReactFabric-prod.fb.js | 166 ++++++------ .../ReactFabric-profiling.fb.js | 210 ++++++++------- .../ReactNativeRenderer-dev.fb.js | 121 +++++++-- .../ReactNativeRenderer-prod.fb.js | 186 +++++++------- .../ReactNativeRenderer-profiling.fb.js | 230 +++++++++-------- 13 files changed, 953 insertions(+), 632 deletions(-) diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js index 7519a0f95a6db..fb1be9c2183a8 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<4a19698954f795c20e290576071bf6b0>> */ 'use strict'; @@ -4118,6 +4118,7 @@ function trackUsedThenable(thenableState, thenable, index) { case "rejected": { var rejectedError = thenable.reason; + checkIfUseWrappedInAsyncCatch(rejectedError); throw rejectedError; } @@ -4173,18 +4174,20 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ); - } // Check one more time in case the thenable resolved synchronously. + ); // Check one more time in case the thenable resolved synchronously. - switch (thenable.status) { - case "fulfilled": { - var fulfilledThenable = thenable; - return fulfilledThenable.value; - } + switch (thenable.status) { + case "fulfilled": { + var fulfilledThenable = thenable; + return fulfilledThenable.value; + } - case "rejected": { - var rejectedThenable = thenable; - throw rejectedThenable.reason; + case "rejected": { + var rejectedThenable = thenable; + var _rejectedError = rejectedThenable.reason; + checkIfUseWrappedInAsyncCatch(_rejectedError); + throw _rejectedError; + } } } // Suspend. // @@ -4243,6 +4246,22 @@ function checkIfUseWrappedInTryCatch() { return false; } +function checkIfUseWrappedInAsyncCatch(rejectedReason) { + // This check runs in prod, too, because it prevents a more confusing + // downstream error, where SuspenseException is caught by a promise and + // thrown asynchronously. + // TODO: Another way to prevent SuspenseException from leaking into an async + // execution context is to check the dispatcher every time `use` is called, + // or some equivalent. That might be preferable for other reasons, too, since + // it matches how we prevent similar mistakes for other hooks. + if (rejectedReason === SuspenseException) { + throw new Error( + "Hooks are not supported inside an async component. This " + + "error is often caused by accidentally adding `'use client'` " + + "to a module that was originally written for the server." + ); + } +} var thenableState$1 = null; var thenableIndexCounter$1 = 0; @@ -6527,10 +6546,12 @@ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; var didWarnAboutUseWrappedInTryCatch; +var didWarnAboutAsyncClientComponent; { didWarnAboutMismatchedHooksForComponent = new Set(); didWarnAboutUseWrappedInTryCatch = new Set(); + didWarnAboutAsyncClientComponent = new Set(); } // The effect "instance" is a shared object that remains the same for the entire // lifetime of an effect. In Rust terms, a RefCell. We use it to store the // "destroy" function that is returned from an effect, because that is stateful. @@ -6671,6 +6692,57 @@ function warnOnHookMismatchInDev(currentHookName) { } } +function warnIfAsyncClientComponent(Component, componentDoesIncludeHooks) { + { + // This dev-only check only works for detecting native async functions, + // not transpiled ones. There's also a prod check that we use to prevent + // async client components from crashing the app; the prod one works even + // for transpiled async functions. Neither mechanism is completely + // bulletproof but together they cover the most common cases. + var isAsyncFunction = // $FlowIgnore[method-unbinding] + Object.prototype.toString.call(Component) === "[object AsyncFunction]"; + + if (isAsyncFunction) { + // Encountered an async Client Component. This is not yet supported, + // except in certain constrained cases, like during a route navigation. + var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1); + + if (!didWarnAboutAsyncClientComponent.has(componentName)) { + didWarnAboutAsyncClientComponent.add(componentName); // Check if this is a sync update. We use the "root" render lanes here + // because the "subtree" render lanes may include additional entangled + // lanes related to revealing previously hidden content. + + var root = getWorkInProgressRoot(); + var rootRenderLanes = getWorkInProgressRootRenderLanes(); + + if (root !== null && includesBlockingLane(root, rootRenderLanes)) { + error( + "async/await is not yet supported in Client Components, only " + + "Server Components. This error is often caused by accidentally " + + "adding `'use client'` to a module that was originally written " + + "for the server." + ); + } else { + // This is a concurrent (Transition, Retry, etc) render. We don't + // warn in these cases. + // + // However, Async Components are forbidden to include hooks, even + // during a transition, so let's check for that here. + // + // TODO: Add a corresponding warning to Server Components runtime. + if (componentDoesIncludeHooks) { + error( + "Hooks are not supported inside an async component. This " + + "error is often caused by accidentally adding `'use client'` " + + "to a module that was originally written for the server." + ); + } + } + } + } + } +} + function throwInvalidHookError() { throw new Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for" + @@ -6823,18 +6895,20 @@ function renderWithHooks( ); } - finishRenderingHooks(current, workInProgress); + finishRenderingHooks(current, workInProgress, Component); return children; } -function finishRenderingHooks(current, workInProgress) { - // We can assume the previous dispatcher is always this one, since we set it - // at the beginning of the render phase and there's no re-entrance. - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - +function finishRenderingHooks(current, workInProgress, Component) { { workInProgress._debugHookTypes = hookTypesDev; - } // This check uses currentHook so that it works the same in DEV and prod bundles. + var componentDoesIncludeHooks = + workInProgressHook !== null || thenableIndexCounter !== 0; + warnIfAsyncClientComponent(Component, componentDoesIncludeHooks); + } // We can assume the previous dispatcher is always this one, since we set it + // at the beginning of the render phase and there's no re-entrance. + + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; // This check uses currentHook so that it works the same in DEV and prod bundles. // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles. var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; @@ -6885,7 +6959,12 @@ function finishRenderingHooks(current, workInProgress) { var componentName = getComponentNameFromFiber(workInProgress) || "Unknown"; - if (!didWarnAboutUseWrappedInTryCatch.has(componentName)) { + if ( + !didWarnAboutUseWrappedInTryCatch.has(componentName) && // This warning also fires if you suspend with `use` inside an + // async component. Since we warn for that above, we'll silence this + // second warning by checking here. + !didWarnAboutAsyncClientComponent.has(componentName) + ) { didWarnAboutUseWrappedInTryCatch.add(componentName); error( @@ -6925,7 +7004,7 @@ function replaySuspendedComponentWithHooks( props, secondArg ); - finishRenderingHooks(current, workInProgress); + finishRenderingHooks(current, workInProgress, Component); return children; } @@ -23903,7 +23982,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-canary-47385f8fa-20230630"; +var ReactVersion = "18.3.0-canary-5c8dabf88-20230701"; // Might add PROFILE later. diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js index bc63d90ccfb6c..2a87eebcee1fa 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<205a70046761c0bf48d4a1e41c13f041>> + * @generated SignedSource<> */ "use strict"; @@ -1074,7 +1074,11 @@ function trackUsedThenable(thenableState, thenable, index) { case "fulfilled": return thenable.value; case "rejected": - throw thenable.reason; + throw ( + ((thenableState = thenable.reason), + checkIfUseWrappedInAsyncCatch(thenableState), + thenableState) + ); default: if ("string" === typeof thenable.status) thenable.then(noop, noop); else { @@ -1101,12 +1105,16 @@ function trackUsedThenable(thenableState, thenable, index) { } } ); - } - switch (thenable.status) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw ( + ((thenableState = thenable.reason), + checkIfUseWrappedInAsyncCatch(thenableState), + thenableState) + ); + } } suspendedThenable = thenable; throw SuspenseException; @@ -1122,6 +1130,12 @@ function getSuspendedThenable() { suspendedThenable = null; return thenable; } +function checkIfUseWrappedInAsyncCatch(rejectedReason) { + if (rejectedReason === SuspenseException) + throw Error( + "Hooks are not supported inside an async component. This error is often caused by accidentally adding `'use client'` to a module that was originally written for the server." + ); +} var thenableState$1 = null, thenableIndexCounter$1 = 0; function unwrapThenable(thenable) { @@ -4492,14 +4506,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$58 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$58 = lastTailNode), + for (var lastTailNode$59 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$59 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$58 + null === lastTailNode$59 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$58.sibling = null); + : (lastTailNode$59.sibling = null); } } function bubbleProperties(completedWork) { @@ -4509,19 +4523,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$59 = completedWork.child; null !== child$59; ) - (newChildLanes |= child$59.lanes | child$59.childLanes), - (subtreeFlags |= child$59.subtreeFlags & 31457280), - (subtreeFlags |= child$59.flags & 31457280), - (child$59.return = completedWork), - (child$59 = child$59.sibling); + for (var child$60 = completedWork.child; null !== child$60; ) + (newChildLanes |= child$60.lanes | child$60.childLanes), + (subtreeFlags |= child$60.subtreeFlags & 31457280), + (subtreeFlags |= child$60.flags & 31457280), + (child$60.return = completedWork), + (child$60 = child$60.sibling); else - for (child$59 = completedWork.child; null !== child$59; ) - (newChildLanes |= child$59.lanes | child$59.childLanes), - (subtreeFlags |= child$59.subtreeFlags), - (subtreeFlags |= child$59.flags), - (child$59.return = completedWork), - (child$59 = child$59.sibling); + for (child$60 = completedWork.child; null !== child$60; ) + (newChildLanes |= child$60.lanes | child$60.childLanes), + (subtreeFlags |= child$60.subtreeFlags), + (subtreeFlags |= child$60.flags), + (child$60.return = completedWork), + (child$60 = child$60.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -4682,11 +4696,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (index = newProps.alternate.memoizedState.cachePool.pool); - var cache$63 = null; + var cache$64 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$63 = newProps.memoizedState.cachePool.pool); - cache$63 !== index && (newProps.flags |= 2048); + (cache$64 = newProps.memoizedState.cachePool.pool); + cache$64 !== index && (newProps.flags |= 2048); } renderLanes !== current && renderLanes && @@ -4713,8 +4727,8 @@ function completeWork(current, workInProgress, renderLanes) { index = workInProgress.memoizedState; if (null === index) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$63 = index.rendering; - if (null === cache$63) + cache$64 = index.rendering; + if (null === cache$64) if (newProps) cutOffTailIfNeeded(index, !1); else { if ( @@ -4722,11 +4736,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$63 = findFirstSuspended(current); - if (null !== cache$63) { + cache$64 = findFirstSuspended(current); + if (null !== cache$64) { workInProgress.flags |= 128; cutOffTailIfNeeded(index, !1); - current = cache$63.updateQueue; + current = cache$64.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -4751,7 +4765,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$63)), null !== current)) { + if (((current = findFirstSuspended(cache$64)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -4761,7 +4775,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(index, !0), null === index.tail && "hidden" === index.tailMode && - !cache$63.alternate) + !cache$64.alternate) ) return bubbleProperties(workInProgress), null; } else @@ -4773,13 +4787,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(index, !1), (workInProgress.lanes = 8388608)); index.isBackwards - ? ((cache$63.sibling = workInProgress.child), - (workInProgress.child = cache$63)) + ? ((cache$64.sibling = workInProgress.child), + (workInProgress.child = cache$64)) : ((current = index.last), null !== current - ? (current.sibling = cache$63) - : (workInProgress.child = cache$63), - (index.last = cache$63)); + ? (current.sibling = cache$64) + : (workInProgress.child = cache$64), + (index.last = cache$64)); } if (null !== index.tail) return ( @@ -4992,8 +5006,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { else if ("function" === typeof ref) try { ref(null); - } catch (error$79) { - captureCommitPhaseError(current, nearestMountedAncestor, error$79); + } catch (error$80) { + captureCommitPhaseError(current, nearestMountedAncestor, error$80); } else ref.current = null; } @@ -5099,10 +5113,10 @@ function commitHookEffectListMount(flags, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & flags) === flags) { - var create$80 = effect.create, + var create$81 = effect.create, inst = effect.inst; - create$80 = create$80(); - inst.destroy = create$80; + create$81 = create$81(); + inst.destroy = create$81; } effect = effect.next; } while (effect !== finishedWork); @@ -5156,11 +5170,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$81) { + } catch (error$82) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$81 + error$82 ); } } @@ -5537,8 +5551,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$89) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$89); + } catch (error$90) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$90); } } break; @@ -5576,8 +5590,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { finishedWork.updateQueue = null; try { (flags.type = type), (flags.props = existingHiddenCallbacks); - } catch (error$92) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$92); + } catch (error$93) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$93); } } break; @@ -5593,8 +5607,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { existingHiddenCallbacks = finishedWork.memoizedProps; try { flags.text = existingHiddenCallbacks; - } catch (error$93) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$93); + } catch (error$94) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$94); } } break; @@ -5678,11 +5692,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { wasHidden.stateNode.isHidden = existingHiddenCallbacks ? !0 : !1; - } catch (error$83) { + } catch (error$84) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$83 + error$84 ); } } else if ( @@ -5760,12 +5774,12 @@ function commitReconciliationEffects(finishedWork) { break; case 3: case 4: - var parent$84 = JSCompiler_inline_result.stateNode.containerInfo, - before$85 = getHostSibling(finishedWork); + var parent$85 = JSCompiler_inline_result.stateNode.containerInfo, + before$86 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$85, - parent$84 + before$86, + parent$85 ); break; default: @@ -6493,16 +6507,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout = renderRootSync(root, lanes); if (2 === didTimeout) { errorRetryLanes = lanes; - var errorRetryLanes$102 = getLanesToRetrySynchronouslyOnError( + var errorRetryLanes$103 = getLanesToRetrySynchronouslyOnError( root, errorRetryLanes ); - 0 !== errorRetryLanes$102 && - ((lanes = errorRetryLanes$102), + 0 !== errorRetryLanes$103 && + ((lanes = errorRetryLanes$103), (didTimeout = recoverFromConcurrentError( root, errorRetryLanes, - errorRetryLanes$102 + errorRetryLanes$103 ))); } if (1 === didTimeout) @@ -6813,8 +6827,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$104) { - handleThrow(root, thrownValue$104); + } catch (thrownValue$105) { + handleThrow(root, thrownValue$105); } while (1); lanes && root.shellSuspendCounter++; @@ -6922,8 +6936,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$106) { - handleThrow(root, thrownValue$106); + } catch (thrownValue$107) { + handleThrow(root, thrownValue$107); } while (1); resetContextDependencies(); @@ -7092,10 +7106,10 @@ function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var retryQueue$28 = offscreenQueue.retryQueue; - null === retryQueue$28 + var retryQueue$29 = offscreenQueue.retryQueue; + null === retryQueue$29 ? (offscreenQueue.retryQueue = new Set([wakeable])) - : retryQueue$28.add(wakeable); + : retryQueue$29.add(wakeable); } } break; @@ -8611,19 +8625,19 @@ function wrapFiber(fiber) { fiberToWrapper.set(fiber, wrapper)); return wrapper; } -var devToolsConfig$jscomp$inline_1031 = { +var devToolsConfig$jscomp$inline_1032 = { findFiberByHostInstance: function () { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-canary-47385f8fa-20230630", + version: "18.3.0-canary-5c8dabf88-20230701", rendererPackageName: "react-test-renderer" }; -var internals$jscomp$inline_1230 = { - bundleType: devToolsConfig$jscomp$inline_1031.bundleType, - version: devToolsConfig$jscomp$inline_1031.version, - rendererPackageName: devToolsConfig$jscomp$inline_1031.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1031.rendererConfig, +var internals$jscomp$inline_1231 = { + bundleType: devToolsConfig$jscomp$inline_1032.bundleType, + version: devToolsConfig$jscomp$inline_1032.version, + rendererPackageName: devToolsConfig$jscomp$inline_1032.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1032.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8640,26 +8654,26 @@ var internals$jscomp$inline_1230 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1031.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1032.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-47385f8fa-20230630" + reconcilerVersion: "18.3.0-canary-5c8dabf88-20230701" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1231 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1232 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1231.isDisabled && - hook$jscomp$inline_1231.supportsFiber + !hook$jscomp$inline_1232.isDisabled && + hook$jscomp$inline_1232.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1231.inject( - internals$jscomp$inline_1230 + (rendererID = hook$jscomp$inline_1232.inject( + internals$jscomp$inline_1231 )), - (injectedHook = hook$jscomp$inline_1231); + (injectedHook = hook$jscomp$inline_1232); } catch (err) {} } exports._Scheduler = Scheduler; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js index 291f45c27cef6..687cbb2279fe1 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<2af92e66a4414f0a6220bd4dac0e6fac>> + * @generated SignedSource<> */ "use strict"; @@ -1092,7 +1092,11 @@ function trackUsedThenable(thenableState, thenable, index) { case "fulfilled": return thenable.value; case "rejected": - throw thenable.reason; + throw ( + ((thenableState = thenable.reason), + checkIfUseWrappedInAsyncCatch(thenableState), + thenableState) + ); default: if ("string" === typeof thenable.status) thenable.then(noop, noop); else { @@ -1119,12 +1123,16 @@ function trackUsedThenable(thenableState, thenable, index) { } } ); - } - switch (thenable.status) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw ( + ((thenableState = thenable.reason), + checkIfUseWrappedInAsyncCatch(thenableState), + thenableState) + ); + } } suspendedThenable = thenable; throw SuspenseException; @@ -1140,6 +1148,12 @@ function getSuspendedThenable() { suspendedThenable = null; return thenable; } +function checkIfUseWrappedInAsyncCatch(rejectedReason) { + if (rejectedReason === SuspenseException) + throw Error( + "Hooks are not supported inside an async component. This error is often caused by accidentally adding `'use client'` to a module that was originally written for the server." + ); +} var thenableState$1 = null, thenableIndexCounter$1 = 0; function unwrapThenable(thenable) { @@ -4596,14 +4610,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$59 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$59 = lastTailNode), + for (var lastTailNode$60 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$60 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$59 + null === lastTailNode$60 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$59.sibling = null); + : (lastTailNode$60.sibling = null); } } function bubbleProperties(completedWork) { @@ -4615,53 +4629,53 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$61 = completedWork.selfBaseDuration, - child$62 = completedWork.child; - null !== child$62; + var treeBaseDuration$62 = completedWork.selfBaseDuration, + child$63 = completedWork.child; + null !== child$63; ) - (newChildLanes |= child$62.lanes | child$62.childLanes), - (subtreeFlags |= child$62.subtreeFlags & 31457280), - (subtreeFlags |= child$62.flags & 31457280), - (treeBaseDuration$61 += child$62.treeBaseDuration), - (child$62 = child$62.sibling); - completedWork.treeBaseDuration = treeBaseDuration$61; + (newChildLanes |= child$63.lanes | child$63.childLanes), + (subtreeFlags |= child$63.subtreeFlags & 31457280), + (subtreeFlags |= child$63.flags & 31457280), + (treeBaseDuration$62 += child$63.treeBaseDuration), + (child$63 = child$63.sibling); + completedWork.treeBaseDuration = treeBaseDuration$62; } else for ( - treeBaseDuration$61 = completedWork.child; - null !== treeBaseDuration$61; + treeBaseDuration$62 = completedWork.child; + null !== treeBaseDuration$62; ) (newChildLanes |= - treeBaseDuration$61.lanes | treeBaseDuration$61.childLanes), - (subtreeFlags |= treeBaseDuration$61.subtreeFlags & 31457280), - (subtreeFlags |= treeBaseDuration$61.flags & 31457280), - (treeBaseDuration$61.return = completedWork), - (treeBaseDuration$61 = treeBaseDuration$61.sibling); + treeBaseDuration$62.lanes | treeBaseDuration$62.childLanes), + (subtreeFlags |= treeBaseDuration$62.subtreeFlags & 31457280), + (subtreeFlags |= treeBaseDuration$62.flags & 31457280), + (treeBaseDuration$62.return = completedWork), + (treeBaseDuration$62 = treeBaseDuration$62.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$61 = completedWork.actualDuration; - child$62 = completedWork.selfBaseDuration; + treeBaseDuration$62 = completedWork.actualDuration; + child$63 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$61 += child.actualDuration), - (child$62 += child.treeBaseDuration), + (treeBaseDuration$62 += child.actualDuration), + (child$63 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$61; - completedWork.treeBaseDuration = child$62; + completedWork.actualDuration = treeBaseDuration$62; + completedWork.treeBaseDuration = child$63; } else for ( - treeBaseDuration$61 = completedWork.child; - null !== treeBaseDuration$61; + treeBaseDuration$62 = completedWork.child; + null !== treeBaseDuration$62; ) (newChildLanes |= - treeBaseDuration$61.lanes | treeBaseDuration$61.childLanes), - (subtreeFlags |= treeBaseDuration$61.subtreeFlags), - (subtreeFlags |= treeBaseDuration$61.flags), - (treeBaseDuration$61.return = completedWork), - (treeBaseDuration$61 = treeBaseDuration$61.sibling); + treeBaseDuration$62.lanes | treeBaseDuration$62.childLanes), + (subtreeFlags |= treeBaseDuration$62.subtreeFlags), + (subtreeFlags |= treeBaseDuration$62.flags), + (treeBaseDuration$62.return = completedWork), + (treeBaseDuration$62 = treeBaseDuration$62.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -4832,11 +4846,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (index = newProps.alternate.memoizedState.cachePool.pool); - var cache$69 = null; + var cache$70 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$69 = newProps.memoizedState.cachePool.pool); - cache$69 !== index && (newProps.flags |= 2048); + (cache$70 = newProps.memoizedState.cachePool.pool); + cache$70 !== index && (newProps.flags |= 2048); } renderLanes !== current && renderLanes && @@ -4868,8 +4882,8 @@ function completeWork(current, workInProgress, renderLanes) { index = workInProgress.memoizedState; if (null === index) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$69 = index.rendering; - if (null === cache$69) + cache$70 = index.rendering; + if (null === cache$70) if (newProps) cutOffTailIfNeeded(index, !1); else { if ( @@ -4877,11 +4891,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$69 = findFirstSuspended(current); - if (null !== cache$69) { + cache$70 = findFirstSuspended(current); + if (null !== cache$70) { workInProgress.flags |= 128; cutOffTailIfNeeded(index, !1); - current = cache$69.updateQueue; + current = cache$70.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -4906,7 +4920,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$69)), null !== current)) { + if (((current = findFirstSuspended(cache$70)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -4916,7 +4930,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(index, !0), null === index.tail && "hidden" === index.tailMode && - !cache$69.alternate) + !cache$70.alternate) ) return bubbleProperties(workInProgress), null; } else @@ -4928,13 +4942,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(index, !1), (workInProgress.lanes = 8388608)); index.isBackwards - ? ((cache$69.sibling = workInProgress.child), - (workInProgress.child = cache$69)) + ? ((cache$70.sibling = workInProgress.child), + (workInProgress.child = cache$70)) : ((current = index.last), null !== current - ? (current.sibling = cache$69) - : (workInProgress.child = cache$69), - (index.last = cache$69)); + ? (current.sibling = cache$70) + : (workInProgress.child = cache$70), + (index.last = cache$70)); } if (null !== index.tail) return ( @@ -5188,8 +5202,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { recordLayoutEffectDuration(current); } else ref(null); - } catch (error$85) { - captureCommitPhaseError(current, nearestMountedAncestor, error$85); + } catch (error$86) { + captureCommitPhaseError(current, nearestMountedAncestor, error$86); } else ref.current = null; } @@ -5295,10 +5309,10 @@ function commitHookEffectListMount(flags, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & flags) === flags) { - var create$86 = effect.create, + var create$87 = effect.create, inst = effect.inst; - create$86 = create$86(); - inst.destroy = create$86; + create$87 = create$87(); + inst.destroy = create$87; } effect = effect.next; } while (effect !== finishedWork); @@ -5316,8 +5330,8 @@ function commitHookLayoutEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$88) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$88); + } catch (error$89) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$89); } } function commitClassCallbacks(finishedWork) { @@ -5397,11 +5411,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { } else try { finishedRoot.componentDidMount(); - } catch (error$89) { + } catch (error$90) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$89 + error$90 ); } else { @@ -5418,11 +5432,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$90) { + } catch (error$91) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$90 + error$91 ); } recordLayoutEffectDuration(finishedWork); @@ -5433,11 +5447,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$91) { + } catch (error$92) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$91 + error$92 ); } } @@ -5824,22 +5838,22 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { startLayoutEffectTimer(), commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$100) { + } catch (error$101) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$100 + error$101 ); } recordLayoutEffectDuration(finishedWork); } else try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$101) { + } catch (error$102) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$101 + error$102 ); } } @@ -5878,8 +5892,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { finishedWork.updateQueue = null; try { (flags.type = type), (flags.props = existingHiddenCallbacks); - } catch (error$104) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$104); + } catch (error$105) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$105); } } break; @@ -5895,8 +5909,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { existingHiddenCallbacks = finishedWork.memoizedProps; try { flags.text = existingHiddenCallbacks; - } catch (error$105) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$105); + } catch (error$106) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$106); } } break; @@ -5980,11 +5994,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { wasHidden.stateNode.isHidden = existingHiddenCallbacks ? !0 : !1; - } catch (error$94) { + } catch (error$95) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$94 + error$95 ); } } else if ( @@ -6062,12 +6076,12 @@ function commitReconciliationEffects(finishedWork) { break; case 3: case 4: - var parent$95 = JSCompiler_inline_result.stateNode.containerInfo, - before$96 = getHostSibling(finishedWork); + var parent$96 = JSCompiler_inline_result.stateNode.containerInfo, + before$97 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$96, - parent$95 + before$97, + parent$96 ); break; default: @@ -6247,8 +6261,8 @@ function commitHookPassiveMountEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$109) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$109); + } catch (error$110) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$110); } } function commitOffscreenPassiveMountEffects(current, finishedWork) { @@ -6833,16 +6847,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { didTimeout = renderRootSync(root, lanes); if (2 === didTimeout) { errorRetryLanes = lanes; - var errorRetryLanes$115 = getLanesToRetrySynchronouslyOnError( + var errorRetryLanes$116 = getLanesToRetrySynchronouslyOnError( root, errorRetryLanes ); - 0 !== errorRetryLanes$115 && - ((lanes = errorRetryLanes$115), + 0 !== errorRetryLanes$116 && + ((lanes = errorRetryLanes$116), (didTimeout = recoverFromConcurrentError( root, errorRetryLanes, - errorRetryLanes$115 + errorRetryLanes$116 ))); } if (1 === didTimeout) @@ -7155,8 +7169,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$117) { - handleThrow(root, thrownValue$117); + } catch (thrownValue$118) { + handleThrow(root, thrownValue$118); } while (1); lanes && root.shellSuspendCounter++; @@ -7264,8 +7278,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$119) { - handleThrow(root, thrownValue$119); + } catch (thrownValue$120) { + handleThrow(root, thrownValue$120); } while (1); resetContextDependencies(); @@ -7444,10 +7458,10 @@ function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var retryQueue$28 = offscreenQueue.retryQueue; - null === retryQueue$28 + var retryQueue$29 = offscreenQueue.retryQueue; + null === retryQueue$29 ? (offscreenQueue.retryQueue = new Set([wakeable])) - : retryQueue$28.add(wakeable); + : retryQueue$29.add(wakeable); } } break; @@ -7737,11 +7751,11 @@ function flushPassiveEffects() { _finishedWork$memoize = finishedWork.memoizedProps, id = _finishedWork$memoize.id, onPostCommit = _finishedWork$memoize.onPostCommit, - commitTime$87 = commitTime, + commitTime$88 = commitTime, phase = null === finishedWork.alternate ? "mount" : "update"; currentUpdateIsNested && (phase = "nested-update"); "function" === typeof onPostCommit && - onPostCommit(id, phase, passiveEffectDuration, commitTime$87); + onPostCommit(id, phase, passiveEffectDuration, commitTime$88); var parentFiber = finishedWork.return; b: for (; null !== parentFiber; ) { switch (parentFiber.tag) { @@ -9037,19 +9051,19 @@ function wrapFiber(fiber) { fiberToWrapper.set(fiber, wrapper)); return wrapper; } -var devToolsConfig$jscomp$inline_1073 = { +var devToolsConfig$jscomp$inline_1074 = { findFiberByHostInstance: function () { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-canary-47385f8fa-20230630", + version: "18.3.0-canary-5c8dabf88-20230701", rendererPackageName: "react-test-renderer" }; -var internals$jscomp$inline_1271 = { - bundleType: devToolsConfig$jscomp$inline_1073.bundleType, - version: devToolsConfig$jscomp$inline_1073.version, - rendererPackageName: devToolsConfig$jscomp$inline_1073.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1073.rendererConfig, +var internals$jscomp$inline_1272 = { + bundleType: devToolsConfig$jscomp$inline_1074.bundleType, + version: devToolsConfig$jscomp$inline_1074.version, + rendererPackageName: devToolsConfig$jscomp$inline_1074.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1074.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -9066,26 +9080,26 @@ var internals$jscomp$inline_1271 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1073.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1074.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-47385f8fa-20230630" + reconcilerVersion: "18.3.0-canary-5c8dabf88-20230701" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1272 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1273 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1272.isDisabled && - hook$jscomp$inline_1272.supportsFiber + !hook$jscomp$inline_1273.isDisabled && + hook$jscomp$inline_1273.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1272.inject( - internals$jscomp$inline_1271 + (rendererID = hook$jscomp$inline_1273.inject( + internals$jscomp$inline_1272 )), - (injectedHook = hook$jscomp$inline_1272); + (injectedHook = hook$jscomp$inline_1273); } catch (err) {} } exports._Scheduler = Scheduler; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js index 78d1f7b2ab6c5..23cb45ca50427 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js @@ -27,7 +27,7 @@ if ( } "use strict"; -var ReactVersion = "18.3.0-canary-47385f8fa-20230630"; +var ReactVersion = "18.3.0-canary-5c8dabf88-20230701"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js index f75f3e1e6e3a0..34c10d79fe5b4 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js @@ -623,4 +623,4 @@ exports.useSyncExternalStore = function ( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-canary-47385f8fa-20230630"; +exports.version = "18.3.0-canary-5c8dabf88-20230701"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js index 57b886c80757c..8cf9631c01794 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js @@ -626,7 +626,7 @@ exports.useSyncExternalStore = function ( ); }; exports.useTransition = useTransition; -exports.version = "18.3.0-canary-47385f8fa-20230630"; +exports.version = "18.3.0-canary-5c8dabf88-20230701"; /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if ( diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION index cc4c178e5440c..510440e79e071 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION @@ -1 +1 @@ -47385f8fa448e52326f08d0afa357339fac6f86e +5c8dabf8864e1d826c831d6096b2dfa66309961a diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index 0ea0acd917c0e..82b61dc8efbf1 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<8e7e35f7d6ee020f57b9bb22ec115fac>> */ 'use strict'; @@ -7837,6 +7837,7 @@ function trackUsedThenable(thenableState, thenable, index) { case "rejected": { var rejectedError = thenable.reason; + checkIfUseWrappedInAsyncCatch(rejectedError); throw rejectedError; } @@ -7892,18 +7893,20 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ); - } // Check one more time in case the thenable resolved synchronously. + ); // Check one more time in case the thenable resolved synchronously. - switch (thenable.status) { - case "fulfilled": { - var fulfilledThenable = thenable; - return fulfilledThenable.value; - } + switch (thenable.status) { + case "fulfilled": { + var fulfilledThenable = thenable; + return fulfilledThenable.value; + } - case "rejected": { - var rejectedThenable = thenable; - throw rejectedThenable.reason; + case "rejected": { + var rejectedThenable = thenable; + var _rejectedError = rejectedThenable.reason; + checkIfUseWrappedInAsyncCatch(_rejectedError); + throw _rejectedError; + } } } // Suspend. // @@ -7962,6 +7965,22 @@ function checkIfUseWrappedInTryCatch() { return false; } +function checkIfUseWrappedInAsyncCatch(rejectedReason) { + // This check runs in prod, too, because it prevents a more confusing + // downstream error, where SuspenseException is caught by a promise and + // thrown asynchronously. + // TODO: Another way to prevent SuspenseException from leaking into an async + // execution context is to check the dispatcher every time `use` is called, + // or some equivalent. That might be preferable for other reasons, too, since + // it matches how we prevent similar mistakes for other hooks. + if (rejectedReason === SuspenseException) { + throw new Error( + "Hooks are not supported inside an async component. This " + + "error is often caused by accidentally adding `'use client'` " + + "to a module that was originally written for the server." + ); + } +} var thenableState$1 = null; var thenableIndexCounter$1 = 0; @@ -10254,10 +10273,12 @@ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; var didWarnAboutUseWrappedInTryCatch; +var didWarnAboutAsyncClientComponent; { didWarnAboutMismatchedHooksForComponent = new Set(); didWarnAboutUseWrappedInTryCatch = new Set(); + didWarnAboutAsyncClientComponent = new Set(); } // The effect "instance" is a shared object that remains the same for the entire // lifetime of an effect. In Rust terms, a RefCell. We use it to store the // "destroy" function that is returned from an effect, because that is stateful. @@ -10398,6 +10419,57 @@ function warnOnHookMismatchInDev(currentHookName) { } } +function warnIfAsyncClientComponent(Component, componentDoesIncludeHooks) { + { + // This dev-only check only works for detecting native async functions, + // not transpiled ones. There's also a prod check that we use to prevent + // async client components from crashing the app; the prod one works even + // for transpiled async functions. Neither mechanism is completely + // bulletproof but together they cover the most common cases. + var isAsyncFunction = // $FlowIgnore[method-unbinding] + Object.prototype.toString.call(Component) === "[object AsyncFunction]"; + + if (isAsyncFunction) { + // Encountered an async Client Component. This is not yet supported, + // except in certain constrained cases, like during a route navigation. + var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1); + + if (!didWarnAboutAsyncClientComponent.has(componentName)) { + didWarnAboutAsyncClientComponent.add(componentName); // Check if this is a sync update. We use the "root" render lanes here + // because the "subtree" render lanes may include additional entangled + // lanes related to revealing previously hidden content. + + var root = getWorkInProgressRoot(); + var rootRenderLanes = getWorkInProgressRootRenderLanes(); + + if (root !== null && includesBlockingLane(root, rootRenderLanes)) { + error( + "async/await is not yet supported in Client Components, only " + + "Server Components. This error is often caused by accidentally " + + "adding `'use client'` to a module that was originally written " + + "for the server." + ); + } else { + // This is a concurrent (Transition, Retry, etc) render. We don't + // warn in these cases. + // + // However, Async Components are forbidden to include hooks, even + // during a transition, so let's check for that here. + // + // TODO: Add a corresponding warning to Server Components runtime. + if (componentDoesIncludeHooks) { + error( + "Hooks are not supported inside an async component. This " + + "error is often caused by accidentally adding `'use client'` " + + "to a module that was originally written for the server." + ); + } + } + } + } + } +} + function throwInvalidHookError() { throw new Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for" + @@ -10567,18 +10639,20 @@ function renderWithHooks( } } - finishRenderingHooks(current, workInProgress); + finishRenderingHooks(current, workInProgress, Component); return children; } -function finishRenderingHooks(current, workInProgress) { - // We can assume the previous dispatcher is always this one, since we set it - // at the beginning of the render phase and there's no re-entrance. - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - +function finishRenderingHooks(current, workInProgress, Component) { { workInProgress._debugHookTypes = hookTypesDev; - } // This check uses currentHook so that it works the same in DEV and prod bundles. + var componentDoesIncludeHooks = + workInProgressHook !== null || thenableIndexCounter !== 0; + warnIfAsyncClientComponent(Component, componentDoesIncludeHooks); + } // We can assume the previous dispatcher is always this one, since we set it + // at the beginning of the render phase and there's no re-entrance. + + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; // This check uses currentHook so that it works the same in DEV and prod bundles. // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles. var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; @@ -10629,7 +10703,12 @@ function finishRenderingHooks(current, workInProgress) { var componentName = getComponentNameFromFiber(workInProgress) || "Unknown"; - if (!didWarnAboutUseWrappedInTryCatch.has(componentName)) { + if ( + !didWarnAboutUseWrappedInTryCatch.has(componentName) && // This warning also fires if you suspend with `use` inside an + // async component. Since we warn for that above, we'll silence this + // second warning by checking here. + !didWarnAboutAsyncClientComponent.has(componentName) + ) { didWarnAboutUseWrappedInTryCatch.add(componentName); error( @@ -10669,7 +10748,7 @@ function replaySuspendedComponentWithHooks( props, secondArg ); - finishRenderingHooks(current, workInProgress); + finishRenderingHooks(current, workInProgress, Component); return children; } @@ -26942,7 +27021,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-canary-8fa97b4d"; +var ReactVersion = "18.3.0-canary-87dd5675"; function createPortal$1( children, diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js index 8a8ee498fe3e3..f03dc14e86417 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<23a36138dca05b18c63f619db0604fe8>> */ "use strict"; @@ -940,7 +940,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_238 = { +var injectedNamesToPlugins$jscomp$inline_239 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -986,32 +986,32 @@ var injectedNamesToPlugins$jscomp$inline_238 = { } } }, - isOrderingDirty$jscomp$inline_239 = !1, - pluginName$jscomp$inline_240; -for (pluginName$jscomp$inline_240 in injectedNamesToPlugins$jscomp$inline_238) + isOrderingDirty$jscomp$inline_240 = !1, + pluginName$jscomp$inline_241; +for (pluginName$jscomp$inline_241 in injectedNamesToPlugins$jscomp$inline_239) if ( - injectedNamesToPlugins$jscomp$inline_238.hasOwnProperty( - pluginName$jscomp$inline_240 + injectedNamesToPlugins$jscomp$inline_239.hasOwnProperty( + pluginName$jscomp$inline_241 ) ) { - var pluginModule$jscomp$inline_241 = - injectedNamesToPlugins$jscomp$inline_238[pluginName$jscomp$inline_240]; + var pluginModule$jscomp$inline_242 = + injectedNamesToPlugins$jscomp$inline_239[pluginName$jscomp$inline_241]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_240) || - namesToPlugins[pluginName$jscomp$inline_240] !== - pluginModule$jscomp$inline_241 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_241) || + namesToPlugins[pluginName$jscomp$inline_241] !== + pluginModule$jscomp$inline_242 ) { - if (namesToPlugins[pluginName$jscomp$inline_240]) + if (namesToPlugins[pluginName$jscomp$inline_241]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_240 + "`.") + (pluginName$jscomp$inline_241 + "`.") ); - namesToPlugins[pluginName$jscomp$inline_240] = - pluginModule$jscomp$inline_241; - isOrderingDirty$jscomp$inline_239 = !0; + namesToPlugins[pluginName$jscomp$inline_241] = + pluginModule$jscomp$inline_242; + isOrderingDirty$jscomp$inline_240 = !0; } } -isOrderingDirty$jscomp$inline_239 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_240 && recomputePluginOrdering(); var emptyObject$1 = {}, removedKeys = null, removedKeyCount = 0, @@ -2442,7 +2442,11 @@ function trackUsedThenable(thenableState, thenable, index) { case "fulfilled": return thenable.value; case "rejected": - throw thenable.reason; + throw ( + ((thenableState = thenable.reason), + checkIfUseWrappedInAsyncCatch(thenableState), + thenableState) + ); default: if ("string" === typeof thenable.status) thenable.then(noop, noop); else { @@ -2469,12 +2473,16 @@ function trackUsedThenable(thenableState, thenable, index) { } } ); - } - switch (thenable.status) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw ( + ((thenableState = thenable.reason), + checkIfUseWrappedInAsyncCatch(thenableState), + thenableState) + ); + } } suspendedThenable = thenable; throw SuspenseException; @@ -2490,6 +2498,12 @@ function getSuspendedThenable() { suspendedThenable = null; return thenable; } +function checkIfUseWrappedInAsyncCatch(rejectedReason) { + if (rejectedReason === SuspenseException) + throw Error( + "Hooks are not supported inside an async component. This error is often caused by accidentally adding `'use client'` to a module that was originally written for the server." + ); +} var thenableState$1 = null, thenableIndexCounter$1 = 0; function unwrapThenable(thenable) { @@ -5855,14 +5869,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$63 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$63 = lastTailNode), + for (var lastTailNode$64 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$64 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$63 + null === lastTailNode$64 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$63.sibling = null); + : (lastTailNode$64.sibling = null); } } function bubbleProperties(completedWork) { @@ -5872,19 +5886,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$64 = completedWork.child; null !== child$64; ) - (newChildLanes |= child$64.lanes | child$64.childLanes), - (subtreeFlags |= child$64.subtreeFlags & 31457280), - (subtreeFlags |= child$64.flags & 31457280), - (child$64.return = completedWork), - (child$64 = child$64.sibling); + for (var child$65 = completedWork.child; null !== child$65; ) + (newChildLanes |= child$65.lanes | child$65.childLanes), + (subtreeFlags |= child$65.subtreeFlags & 31457280), + (subtreeFlags |= child$65.flags & 31457280), + (child$65.return = completedWork), + (child$65 = child$65.sibling); else - for (child$64 = completedWork.child; null !== child$64; ) - (newChildLanes |= child$64.lanes | child$64.childLanes), - (subtreeFlags |= child$64.subtreeFlags), - (subtreeFlags |= child$64.flags), - (child$64.return = completedWork), - (child$64 = child$64.sibling); + for (child$65 = completedWork.child; null !== child$65; ) + (newChildLanes |= child$65.lanes | child$65.childLanes), + (subtreeFlags |= child$65.subtreeFlags), + (subtreeFlags |= child$65.flags), + (child$65.return = completedWork), + (child$65 = child$65.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -6364,8 +6378,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { else if ("function" === typeof ref) try { ref(null); - } catch (error$79) { - captureCommitPhaseError(current, nearestMountedAncestor, error$79); + } catch (error$80) { + captureCommitPhaseError(current, nearestMountedAncestor, error$80); } else ref.current = null; } @@ -6469,10 +6483,10 @@ function commitHookEffectListMount(flags, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & flags) === flags) { - var create$80 = effect.create, + var create$81 = effect.create, inst = effect.inst; - create$80 = create$80(); - inst.destroy = create$80; + create$81 = create$81(); + inst.destroy = create$81; } effect = effect.next; } while (effect !== finishedWork); @@ -6535,11 +6549,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$81) { + } catch (error$82) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$81 + error$82 ); } } @@ -6859,8 +6873,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$83) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$83); + } catch (error$84) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$84); } } break; @@ -7517,16 +7531,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { exitStatus = renderRootSync(root, lanes); if (2 === exitStatus) { errorRetryLanes = lanes; - var errorRetryLanes$92 = getLanesToRetrySynchronouslyOnError( + var errorRetryLanes$93 = getLanesToRetrySynchronouslyOnError( root, errorRetryLanes ); - 0 !== errorRetryLanes$92 && - ((lanes = errorRetryLanes$92), + 0 !== errorRetryLanes$93 && + ((lanes = errorRetryLanes$93), (exitStatus = recoverFromConcurrentError( root, errorRetryLanes, - errorRetryLanes$92 + errorRetryLanes$93 ))); } if (1 === exitStatus) @@ -7809,8 +7823,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$94) { - handleThrow(root, thrownValue$94); + } catch (thrownValue$95) { + handleThrow(root, thrownValue$95); } while (1); lanes && root.shellSuspendCounter++; @@ -7916,8 +7930,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$96) { - handleThrow(root, thrownValue$96); + } catch (thrownValue$97) { + handleThrow(root, thrownValue$97); } while (1); resetContextDependencies(); @@ -8085,10 +8099,10 @@ function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var retryQueue$31 = offscreenQueue.retryQueue; - null === retryQueue$31 + var retryQueue$32 = offscreenQueue.retryQueue; + null === retryQueue$32 ? (offscreenQueue.retryQueue = new Set([wakeable])) - : retryQueue$31.add(wakeable); + : retryQueue$32.add(wakeable); } } break; @@ -9420,10 +9434,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1042 = { + devToolsConfig$jscomp$inline_1043 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "18.3.0-canary-e7a561cd", + version: "18.3.0-canary-2909dc0f", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -9439,11 +9453,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1284 = { - bundleType: devToolsConfig$jscomp$inline_1042.bundleType, - version: devToolsConfig$jscomp$inline_1042.version, - rendererPackageName: devToolsConfig$jscomp$inline_1042.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1042.rendererConfig, +var internals$jscomp$inline_1285 = { + bundleType: devToolsConfig$jscomp$inline_1043.bundleType, + version: devToolsConfig$jscomp$inline_1043.version, + rendererPackageName: devToolsConfig$jscomp$inline_1043.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1043.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -9459,26 +9473,26 @@ var internals$jscomp$inline_1284 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1042.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1043.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-e7a561cd" + reconcilerVersion: "18.3.0-canary-2909dc0f" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1285 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1286 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1285.isDisabled && - hook$jscomp$inline_1285.supportsFiber + !hook$jscomp$inline_1286.isDisabled && + hook$jscomp$inline_1286.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1285.inject( - internals$jscomp$inline_1284 + (rendererID = hook$jscomp$inline_1286.inject( + internals$jscomp$inline_1285 )), - (injectedHook = hook$jscomp$inline_1285); + (injectedHook = hook$jscomp$inline_1286); } catch (err) {} } exports.createPortal = function (children, containerTag) { diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js index e182d161e0b44..12d41d372884e 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<8b7b7e906b3a95d73c3194256ec30353>> + * @generated SignedSource<<8be594306336f0dfd259c6d9967213f6>> */ @@ -951,7 +951,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_254 = { +var injectedNamesToPlugins$jscomp$inline_255 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -997,32 +997,32 @@ var injectedNamesToPlugins$jscomp$inline_254 = { } } }, - isOrderingDirty$jscomp$inline_255 = !1, - pluginName$jscomp$inline_256; -for (pluginName$jscomp$inline_256 in injectedNamesToPlugins$jscomp$inline_254) + isOrderingDirty$jscomp$inline_256 = !1, + pluginName$jscomp$inline_257; +for (pluginName$jscomp$inline_257 in injectedNamesToPlugins$jscomp$inline_255) if ( - injectedNamesToPlugins$jscomp$inline_254.hasOwnProperty( - pluginName$jscomp$inline_256 + injectedNamesToPlugins$jscomp$inline_255.hasOwnProperty( + pluginName$jscomp$inline_257 ) ) { - var pluginModule$jscomp$inline_257 = - injectedNamesToPlugins$jscomp$inline_254[pluginName$jscomp$inline_256]; + var pluginModule$jscomp$inline_258 = + injectedNamesToPlugins$jscomp$inline_255[pluginName$jscomp$inline_257]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_256) || - namesToPlugins[pluginName$jscomp$inline_256] !== - pluginModule$jscomp$inline_257 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_257) || + namesToPlugins[pluginName$jscomp$inline_257] !== + pluginModule$jscomp$inline_258 ) { - if (namesToPlugins[pluginName$jscomp$inline_256]) + if (namesToPlugins[pluginName$jscomp$inline_257]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_256 + "`.") + (pluginName$jscomp$inline_257 + "`.") ); - namesToPlugins[pluginName$jscomp$inline_256] = - pluginModule$jscomp$inline_257; - isOrderingDirty$jscomp$inline_255 = !0; + namesToPlugins[pluginName$jscomp$inline_257] = + pluginModule$jscomp$inline_258; + isOrderingDirty$jscomp$inline_256 = !0; } } -isOrderingDirty$jscomp$inline_255 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_256 && recomputePluginOrdering(); var emptyObject$1 = {}, removedKeys = null, removedKeyCount = 0, @@ -2570,7 +2570,11 @@ function trackUsedThenable(thenableState, thenable, index) { case "fulfilled": return thenable.value; case "rejected": - throw thenable.reason; + throw ( + ((thenableState = thenable.reason), + checkIfUseWrappedInAsyncCatch(thenableState), + thenableState) + ); default: if ("string" === typeof thenable.status) thenable.then(noop, noop); else { @@ -2597,12 +2601,16 @@ function trackUsedThenable(thenableState, thenable, index) { } } ); - } - switch (thenable.status) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw ( + ((thenableState = thenable.reason), + checkIfUseWrappedInAsyncCatch(thenableState), + thenableState) + ); + } } suspendedThenable = thenable; throw SuspenseException; @@ -2618,6 +2626,12 @@ function getSuspendedThenable() { suspendedThenable = null; return thenable; } +function checkIfUseWrappedInAsyncCatch(rejectedReason) { + if (rejectedReason === SuspenseException) + throw Error( + "Hooks are not supported inside an async component. This error is often caused by accidentally adding `'use client'` to a module that was originally written for the server." + ); +} var thenableState$1 = null, thenableIndexCounter$1 = 0; function unwrapThenable(thenable) { @@ -6085,14 +6099,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$67 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$67 = lastTailNode), + for (var lastTailNode$68 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$68 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$67 + null === lastTailNode$68 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$67.sibling = null); + : (lastTailNode$68.sibling = null); } } function bubbleProperties(completedWork) { @@ -6104,53 +6118,53 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$69 = completedWork.selfBaseDuration, - child$70 = completedWork.child; - null !== child$70; + var treeBaseDuration$70 = completedWork.selfBaseDuration, + child$71 = completedWork.child; + null !== child$71; ) - (newChildLanes |= child$70.lanes | child$70.childLanes), - (subtreeFlags |= child$70.subtreeFlags & 31457280), - (subtreeFlags |= child$70.flags & 31457280), - (treeBaseDuration$69 += child$70.treeBaseDuration), - (child$70 = child$70.sibling); - completedWork.treeBaseDuration = treeBaseDuration$69; + (newChildLanes |= child$71.lanes | child$71.childLanes), + (subtreeFlags |= child$71.subtreeFlags & 31457280), + (subtreeFlags |= child$71.flags & 31457280), + (treeBaseDuration$70 += child$71.treeBaseDuration), + (child$71 = child$71.sibling); + completedWork.treeBaseDuration = treeBaseDuration$70; } else for ( - treeBaseDuration$69 = completedWork.child; - null !== treeBaseDuration$69; + treeBaseDuration$70 = completedWork.child; + null !== treeBaseDuration$70; ) (newChildLanes |= - treeBaseDuration$69.lanes | treeBaseDuration$69.childLanes), - (subtreeFlags |= treeBaseDuration$69.subtreeFlags & 31457280), - (subtreeFlags |= treeBaseDuration$69.flags & 31457280), - (treeBaseDuration$69.return = completedWork), - (treeBaseDuration$69 = treeBaseDuration$69.sibling); + treeBaseDuration$70.lanes | treeBaseDuration$70.childLanes), + (subtreeFlags |= treeBaseDuration$70.subtreeFlags & 31457280), + (subtreeFlags |= treeBaseDuration$70.flags & 31457280), + (treeBaseDuration$70.return = completedWork), + (treeBaseDuration$70 = treeBaseDuration$70.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$69 = completedWork.actualDuration; - child$70 = completedWork.selfBaseDuration; + treeBaseDuration$70 = completedWork.actualDuration; + child$71 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$69 += child.actualDuration), - (child$70 += child.treeBaseDuration), + (treeBaseDuration$70 += child.actualDuration), + (child$71 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$69; - completedWork.treeBaseDuration = child$70; + completedWork.actualDuration = treeBaseDuration$70; + completedWork.treeBaseDuration = child$71; } else for ( - treeBaseDuration$69 = completedWork.child; - null !== treeBaseDuration$69; + treeBaseDuration$70 = completedWork.child; + null !== treeBaseDuration$70; ) (newChildLanes |= - treeBaseDuration$69.lanes | treeBaseDuration$69.childLanes), - (subtreeFlags |= treeBaseDuration$69.subtreeFlags), - (subtreeFlags |= treeBaseDuration$69.flags), - (treeBaseDuration$69.return = completedWork), - (treeBaseDuration$69 = treeBaseDuration$69.sibling); + treeBaseDuration$70.lanes | treeBaseDuration$70.childLanes), + (subtreeFlags |= treeBaseDuration$70.subtreeFlags), + (subtreeFlags |= treeBaseDuration$70.flags), + (treeBaseDuration$70.return = completedWork), + (treeBaseDuration$70 = treeBaseDuration$70.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -6689,8 +6703,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { recordLayoutEffectDuration(current); } else ref(null); - } catch (error$88) { - captureCommitPhaseError(current, nearestMountedAncestor, error$88); + } catch (error$89) { + captureCommitPhaseError(current, nearestMountedAncestor, error$89); } else ref.current = null; } @@ -6823,10 +6837,10 @@ function commitHookEffectListMount(flags, finishedWork) { injectedProfilingHooks.markComponentLayoutEffectMountStarted( finishedWork ); - var create$89 = effect.create, + var create$90 = effect.create, inst = effect.inst; - create$89 = create$89(); - inst.destroy = create$89; + create$90 = create$90(); + inst.destroy = create$90; 0 !== (flags & 8) ? null !== injectedProfilingHooks && "function" === @@ -6854,8 +6868,8 @@ function commitHookLayoutEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$91) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$91); + } catch (error$92) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$92); } } function commitClassCallbacks(finishedWork) { @@ -6944,11 +6958,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { } else try { finishedRoot.componentDidMount(); - } catch (error$92) { + } catch (error$93) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$92 + error$93 ); } else { @@ -6965,11 +6979,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$93) { + } catch (error$94) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$93 + error$94 ); } recordLayoutEffectDuration(finishedWork); @@ -6980,11 +6994,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$94) { + } catch (error$95) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$94 + error$95 ); } } @@ -7331,22 +7345,22 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { startLayoutEffectTimer(), commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$97) { + } catch (error$98) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$97 + error$98 ); } recordLayoutEffectDuration(finishedWork); } else try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$98) { + } catch (error$99) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$98 + error$99 ); } } @@ -7643,8 +7657,8 @@ function commitHookPassiveMountEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$106) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$106); + } catch (error$107) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$107); } } function recursivelyTraversePassiveMountEffects(root, parentFiber) { @@ -8048,16 +8062,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { exitStatus = renderRootSync(root, lanes); if (2 === exitStatus) { errorRetryLanes = lanes; - var errorRetryLanes$108 = getLanesToRetrySynchronouslyOnError( + var errorRetryLanes$109 = getLanesToRetrySynchronouslyOnError( root, errorRetryLanes ); - 0 !== errorRetryLanes$108 && - ((lanes = errorRetryLanes$108), + 0 !== errorRetryLanes$109 && + ((lanes = errorRetryLanes$109), (exitStatus = recoverFromConcurrentError( root, errorRetryLanes, - errorRetryLanes$108 + errorRetryLanes$109 ))); } if (1 === exitStatus) @@ -8378,8 +8392,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$110) { - handleThrow(root, thrownValue$110); + } catch (thrownValue$111) { + handleThrow(root, thrownValue$111); } while (1); lanes && root.shellSuspendCounter++; @@ -8496,8 +8510,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$112) { - handleThrow(root, thrownValue$112); + } catch (thrownValue$113) { + handleThrow(root, thrownValue$113); } while (1); resetContextDependencies(); @@ -8683,10 +8697,10 @@ function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var retryQueue$34 = offscreenQueue.retryQueue; - null === retryQueue$34 + var retryQueue$35 = offscreenQueue.retryQueue; + null === retryQueue$35 ? (offscreenQueue.retryQueue = new Set([wakeable])) - : retryQueue$34.add(wakeable); + : retryQueue$35.add(wakeable); } } break; @@ -8971,11 +8985,11 @@ function flushPassiveEffects() { _finishedWork$memoize = finishedWork.memoizedProps, id = _finishedWork$memoize.id, onPostCommit = _finishedWork$memoize.onPostCommit, - commitTime$90 = commitTime, + commitTime$91 = commitTime, phase = null === finishedWork.alternate ? "mount" : "update"; currentUpdateIsNested && (phase = "nested-update"); "function" === typeof onPostCommit && - onPostCommit(id, phase, passiveEffectDuration, commitTime$90); + onPostCommit(id, phase, passiveEffectDuration, commitTime$91); var parentFiber = finishedWork.return; b: for (; null !== parentFiber; ) { switch (parentFiber.tag) { @@ -10128,10 +10142,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1120 = { + devToolsConfig$jscomp$inline_1121 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "18.3.0-canary-c583a14d", + version: "18.3.0-canary-c0169ce2", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10161,10 +10175,10 @@ var roots = new Map(), } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1120.bundleType, - version: devToolsConfig$jscomp$inline_1120.version, - rendererPackageName: devToolsConfig$jscomp$inline_1120.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1120.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1121.bundleType, + version: devToolsConfig$jscomp$inline_1121.version, + rendererPackageName: devToolsConfig$jscomp$inline_1121.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1121.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10180,14 +10194,14 @@ var roots = new Map(), return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1120.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1121.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-c583a14d" + reconcilerVersion: "18.3.0-canary-c0169ce2" }); exports.createPortal = function (children, containerTag) { return createPortal$1( diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index 052aaaa620af6..ae1ee5e67b358 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<4e59c498f8eb265d99f2ae58b112b171>> + * @generated SignedSource<<545e4301f5f214515ca8cb0638f36c59>> */ 'use strict'; @@ -8154,6 +8154,7 @@ function trackUsedThenable(thenableState, thenable, index) { case "rejected": { var rejectedError = thenable.reason; + checkIfUseWrappedInAsyncCatch(rejectedError); throw rejectedError; } @@ -8209,18 +8210,20 @@ function trackUsedThenable(thenableState, thenable, index) { rejectedThenable.reason = error; } } - ); - } // Check one more time in case the thenable resolved synchronously. + ); // Check one more time in case the thenable resolved synchronously. - switch (thenable.status) { - case "fulfilled": { - var fulfilledThenable = thenable; - return fulfilledThenable.value; - } + switch (thenable.status) { + case "fulfilled": { + var fulfilledThenable = thenable; + return fulfilledThenable.value; + } - case "rejected": { - var rejectedThenable = thenable; - throw rejectedThenable.reason; + case "rejected": { + var rejectedThenable = thenable; + var _rejectedError = rejectedThenable.reason; + checkIfUseWrappedInAsyncCatch(_rejectedError); + throw _rejectedError; + } } } // Suspend. // @@ -8279,6 +8282,22 @@ function checkIfUseWrappedInTryCatch() { return false; } +function checkIfUseWrappedInAsyncCatch(rejectedReason) { + // This check runs in prod, too, because it prevents a more confusing + // downstream error, where SuspenseException is caught by a promise and + // thrown asynchronously. + // TODO: Another way to prevent SuspenseException from leaking into an async + // execution context is to check the dispatcher every time `use` is called, + // or some equivalent. That might be preferable for other reasons, too, since + // it matches how we prevent similar mistakes for other hooks. + if (rejectedReason === SuspenseException) { + throw new Error( + "Hooks are not supported inside an async component. This " + + "error is often caused by accidentally adding `'use client'` " + + "to a module that was originally written for the server." + ); + } +} var thenableState$1 = null; var thenableIndexCounter$1 = 0; @@ -10571,10 +10590,12 @@ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, var didWarnAboutMismatchedHooksForComponent; var didWarnUncachedGetSnapshot; var didWarnAboutUseWrappedInTryCatch; +var didWarnAboutAsyncClientComponent; { didWarnAboutMismatchedHooksForComponent = new Set(); didWarnAboutUseWrappedInTryCatch = new Set(); + didWarnAboutAsyncClientComponent = new Set(); } // The effect "instance" is a shared object that remains the same for the entire // lifetime of an effect. In Rust terms, a RefCell. We use it to store the // "destroy" function that is returned from an effect, because that is stateful. @@ -10715,6 +10736,57 @@ function warnOnHookMismatchInDev(currentHookName) { } } +function warnIfAsyncClientComponent(Component, componentDoesIncludeHooks) { + { + // This dev-only check only works for detecting native async functions, + // not transpiled ones. There's also a prod check that we use to prevent + // async client components from crashing the app; the prod one works even + // for transpiled async functions. Neither mechanism is completely + // bulletproof but together they cover the most common cases. + var isAsyncFunction = // $FlowIgnore[method-unbinding] + Object.prototype.toString.call(Component) === "[object AsyncFunction]"; + + if (isAsyncFunction) { + // Encountered an async Client Component. This is not yet supported, + // except in certain constrained cases, like during a route navigation. + var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1); + + if (!didWarnAboutAsyncClientComponent.has(componentName)) { + didWarnAboutAsyncClientComponent.add(componentName); // Check if this is a sync update. We use the "root" render lanes here + // because the "subtree" render lanes may include additional entangled + // lanes related to revealing previously hidden content. + + var root = getWorkInProgressRoot(); + var rootRenderLanes = getWorkInProgressRootRenderLanes(); + + if (root !== null && includesBlockingLane(root, rootRenderLanes)) { + error( + "async/await is not yet supported in Client Components, only " + + "Server Components. This error is often caused by accidentally " + + "adding `'use client'` to a module that was originally written " + + "for the server." + ); + } else { + // This is a concurrent (Transition, Retry, etc) render. We don't + // warn in these cases. + // + // However, Async Components are forbidden to include hooks, even + // during a transition, so let's check for that here. + // + // TODO: Add a corresponding warning to Server Components runtime. + if (componentDoesIncludeHooks) { + error( + "Hooks are not supported inside an async component. This " + + "error is often caused by accidentally adding `'use client'` " + + "to a module that was originally written for the server." + ); + } + } + } + } + } +} + function throwInvalidHookError() { throw new Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for" + @@ -10884,18 +10956,20 @@ function renderWithHooks( } } - finishRenderingHooks(current, workInProgress); + finishRenderingHooks(current, workInProgress, Component); return children; } -function finishRenderingHooks(current, workInProgress) { - // We can assume the previous dispatcher is always this one, since we set it - // at the beginning of the render phase and there's no re-entrance. - ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; - +function finishRenderingHooks(current, workInProgress, Component) { { workInProgress._debugHookTypes = hookTypesDev; - } // This check uses currentHook so that it works the same in DEV and prod bundles. + var componentDoesIncludeHooks = + workInProgressHook !== null || thenableIndexCounter !== 0; + warnIfAsyncClientComponent(Component, componentDoesIncludeHooks); + } // We can assume the previous dispatcher is always this one, since we set it + // at the beginning of the render phase and there's no re-entrance. + + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; // This check uses currentHook so that it works the same in DEV and prod bundles. // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles. var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; @@ -10946,7 +11020,12 @@ function finishRenderingHooks(current, workInProgress) { var componentName = getComponentNameFromFiber(workInProgress) || "Unknown"; - if (!didWarnAboutUseWrappedInTryCatch.has(componentName)) { + if ( + !didWarnAboutUseWrappedInTryCatch.has(componentName) && // This warning also fires if you suspend with `use` inside an + // async component. Since we warn for that above, we'll silence this + // second warning by checking here. + !didWarnAboutAsyncClientComponent.has(componentName) + ) { didWarnAboutUseWrappedInTryCatch.add(componentName); error( @@ -10986,7 +11065,7 @@ function replaySuspendedComponentWithHooks( props, secondArg ); - finishRenderingHooks(current, workInProgress); + finishRenderingHooks(current, workInProgress, Component); return children; } @@ -27456,7 +27535,7 @@ function createFiberRoot( return root; } -var ReactVersion = "18.3.0-canary-93e339dc"; +var ReactVersion = "18.3.0-canary-bc0efd98"; function createPortal$1( children, diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js index 8c218849ca0b8..ebfbec15296e3 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<61fc501bd9deba1069fab61c2cbd0d6e>> + * @generated SignedSource<<3335b1ac142aefffdb7b1c801c3c37e8>> */ "use strict"; @@ -940,7 +940,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_244 = { +var injectedNamesToPlugins$jscomp$inline_245 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -986,32 +986,32 @@ var injectedNamesToPlugins$jscomp$inline_244 = { } } }, - isOrderingDirty$jscomp$inline_245 = !1, - pluginName$jscomp$inline_246; -for (pluginName$jscomp$inline_246 in injectedNamesToPlugins$jscomp$inline_244) + isOrderingDirty$jscomp$inline_246 = !1, + pluginName$jscomp$inline_247; +for (pluginName$jscomp$inline_247 in injectedNamesToPlugins$jscomp$inline_245) if ( - injectedNamesToPlugins$jscomp$inline_244.hasOwnProperty( - pluginName$jscomp$inline_246 + injectedNamesToPlugins$jscomp$inline_245.hasOwnProperty( + pluginName$jscomp$inline_247 ) ) { - var pluginModule$jscomp$inline_247 = - injectedNamesToPlugins$jscomp$inline_244[pluginName$jscomp$inline_246]; + var pluginModule$jscomp$inline_248 = + injectedNamesToPlugins$jscomp$inline_245[pluginName$jscomp$inline_247]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_246) || - namesToPlugins[pluginName$jscomp$inline_246] !== - pluginModule$jscomp$inline_247 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_247) || + namesToPlugins[pluginName$jscomp$inline_247] !== + pluginModule$jscomp$inline_248 ) { - if (namesToPlugins[pluginName$jscomp$inline_246]) + if (namesToPlugins[pluginName$jscomp$inline_247]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_246 + "`.") + (pluginName$jscomp$inline_247 + "`.") ); - namesToPlugins[pluginName$jscomp$inline_246] = - pluginModule$jscomp$inline_247; - isOrderingDirty$jscomp$inline_245 = !0; + namesToPlugins[pluginName$jscomp$inline_247] = + pluginModule$jscomp$inline_248; + isOrderingDirty$jscomp$inline_246 = !0; } } -isOrderingDirty$jscomp$inline_245 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_246 && recomputePluginOrdering(); var instanceCache = new Map(), instanceProps = new Map(); function getInstanceFromTag(tag) { @@ -2532,7 +2532,11 @@ function trackUsedThenable(thenableState, thenable, index) { case "fulfilled": return thenable.value; case "rejected": - throw thenable.reason; + throw ( + ((thenableState = thenable.reason), + checkIfUseWrappedInAsyncCatch(thenableState), + thenableState) + ); default: if ("string" === typeof thenable.status) thenable.then(noop, noop); else { @@ -2559,12 +2563,16 @@ function trackUsedThenable(thenableState, thenable, index) { } } ); - } - switch (thenable.status) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw ( + ((thenableState = thenable.reason), + checkIfUseWrappedInAsyncCatch(thenableState), + thenableState) + ); + } } suspendedThenable = thenable; throw SuspenseException; @@ -2580,6 +2588,12 @@ function getSuspendedThenable() { suspendedThenable = null; return thenable; } +function checkIfUseWrappedInAsyncCatch(rejectedReason) { + if (rejectedReason === SuspenseException) + throw Error( + "Hooks are not supported inside an async component. This error is often caused by accidentally adding `'use client'` to a module that was originally written for the server." + ); +} var thenableState$1 = null, thenableIndexCounter$1 = 0; function unwrapThenable(thenable) { @@ -5832,14 +5846,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$63 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$63 = lastTailNode), + for (var lastTailNode$64 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$64 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$63 + null === lastTailNode$64 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$63.sibling = null); + : (lastTailNode$64.sibling = null); } } function bubbleProperties(completedWork) { @@ -5849,19 +5863,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$64 = completedWork.child; null !== child$64; ) - (newChildLanes |= child$64.lanes | child$64.childLanes), - (subtreeFlags |= child$64.subtreeFlags & 31457280), - (subtreeFlags |= child$64.flags & 31457280), - (child$64.return = completedWork), - (child$64 = child$64.sibling); + for (var child$65 = completedWork.child; null !== child$65; ) + (newChildLanes |= child$65.lanes | child$65.childLanes), + (subtreeFlags |= child$65.subtreeFlags & 31457280), + (subtreeFlags |= child$65.flags & 31457280), + (child$65.return = completedWork), + (child$65 = child$65.sibling); else - for (child$64 = completedWork.child; null !== child$64; ) - (newChildLanes |= child$64.lanes | child$64.childLanes), - (subtreeFlags |= child$64.subtreeFlags), - (subtreeFlags |= child$64.flags), - (child$64.return = completedWork), - (child$64 = child$64.sibling); + for (child$65 = completedWork.child; null !== child$65; ) + (newChildLanes |= child$65.lanes | child$65.childLanes), + (subtreeFlags |= child$65.subtreeFlags), + (subtreeFlags |= child$65.flags), + (child$65.return = completedWork), + (child$65 = child$65.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -6313,8 +6327,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { else if ("function" === typeof ref) try { ref(null); - } catch (error$79) { - captureCommitPhaseError(current, nearestMountedAncestor, error$79); + } catch (error$80) { + captureCommitPhaseError(current, nearestMountedAncestor, error$80); } else ref.current = null; } @@ -6418,10 +6432,10 @@ function commitHookEffectListMount(flags, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & flags) === flags) { - var create$80 = effect.create, + var create$81 = effect.create, inst = effect.inst; - create$80 = create$80(); - inst.destroy = create$80; + create$81 = create$81(); + inst.destroy = create$81; } effect = effect.next; } while (effect !== finishedWork); @@ -6475,11 +6489,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$81) { + } catch (error$82) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$81 + error$82 ); } } @@ -6968,8 +6982,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$89) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$89); + } catch (error$90) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$90); } } break; @@ -7016,8 +7030,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { viewConfig.uiViewClassName, updatePayload ); - } catch (error$92) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$92); + } catch (error$93) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$93); } } break; @@ -7037,8 +7051,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { "RCTRawText", { text: current } ); - } catch (error$93) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$93); + } catch (error$94) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$94); } } break; @@ -7150,11 +7164,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === current) try { throw Error("Not yet implemented."); - } catch (error$83) { + } catch (error$84) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$83 + error$84 ); } } else if ( @@ -7228,12 +7242,12 @@ function commitReconciliationEffects(finishedWork) { break; case 3: case 4: - var parent$84 = JSCompiler_inline_result.stateNode.containerInfo, - before$85 = getHostSibling(finishedWork); + var parent$85 = JSCompiler_inline_result.stateNode.containerInfo, + before$86 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$85, - parent$84 + before$86, + parent$85 ); break; default: @@ -7766,16 +7780,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { exitStatus = renderRootSync(root, lanes); if (2 === exitStatus) { errorRetryLanes = lanes; - var errorRetryLanes$98 = getLanesToRetrySynchronouslyOnError( + var errorRetryLanes$99 = getLanesToRetrySynchronouslyOnError( root, errorRetryLanes ); - 0 !== errorRetryLanes$98 && - ((lanes = errorRetryLanes$98), + 0 !== errorRetryLanes$99 && + ((lanes = errorRetryLanes$99), (exitStatus = recoverFromConcurrentError( root, errorRetryLanes, - errorRetryLanes$98 + errorRetryLanes$99 ))); } if (1 === exitStatus) @@ -8058,8 +8072,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$100) { - handleThrow(root, thrownValue$100); + } catch (thrownValue$101) { + handleThrow(root, thrownValue$101); } while (1); lanes && root.shellSuspendCounter++; @@ -8165,8 +8179,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$102) { - handleThrow(root, thrownValue$102); + } catch (thrownValue$103) { + handleThrow(root, thrownValue$103); } while (1); resetContextDependencies(); @@ -8334,10 +8348,10 @@ function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var retryQueue$33 = offscreenQueue.retryQueue; - null === retryQueue$33 + var retryQueue$34 = offscreenQueue.retryQueue; + null === retryQueue$34 ? (offscreenQueue.retryQueue = new Set([wakeable])) - : retryQueue$33.add(wakeable); + : retryQueue$34.add(wakeable); } } break; @@ -9676,10 +9690,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1097 = { + devToolsConfig$jscomp$inline_1098 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.3.0-canary-03bab863", + version: "18.3.0-canary-85b40236", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -9695,11 +9709,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1353 = { - bundleType: devToolsConfig$jscomp$inline_1097.bundleType, - version: devToolsConfig$jscomp$inline_1097.version, - rendererPackageName: devToolsConfig$jscomp$inline_1097.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1097.rendererConfig, +var internals$jscomp$inline_1354 = { + bundleType: devToolsConfig$jscomp$inline_1098.bundleType, + version: devToolsConfig$jscomp$inline_1098.version, + rendererPackageName: devToolsConfig$jscomp$inline_1098.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1098.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -9715,26 +9729,26 @@ var internals$jscomp$inline_1353 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1097.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1098.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-03bab863" + reconcilerVersion: "18.3.0-canary-85b40236" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1354 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1355 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1354.isDisabled && - hook$jscomp$inline_1354.supportsFiber + !hook$jscomp$inline_1355.isDisabled && + hook$jscomp$inline_1355.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1354.inject( - internals$jscomp$inline_1353 + (rendererID = hook$jscomp$inline_1355.inject( + internals$jscomp$inline_1354 )), - (injectedHook = hook$jscomp$inline_1354); + (injectedHook = hook$jscomp$inline_1355); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js index c542a3603cc7a..856ca70fb5a4e 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<35758cdaeff2792977f1364e737d847f>> + * @generated SignedSource<<228060d251b47b2b0be7969dec80e0a0>> */ @@ -951,7 +951,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_260 = { +var injectedNamesToPlugins$jscomp$inline_261 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -997,32 +997,32 @@ var injectedNamesToPlugins$jscomp$inline_260 = { } } }, - isOrderingDirty$jscomp$inline_261 = !1, - pluginName$jscomp$inline_262; -for (pluginName$jscomp$inline_262 in injectedNamesToPlugins$jscomp$inline_260) + isOrderingDirty$jscomp$inline_262 = !1, + pluginName$jscomp$inline_263; +for (pluginName$jscomp$inline_263 in injectedNamesToPlugins$jscomp$inline_261) if ( - injectedNamesToPlugins$jscomp$inline_260.hasOwnProperty( - pluginName$jscomp$inline_262 + injectedNamesToPlugins$jscomp$inline_261.hasOwnProperty( + pluginName$jscomp$inline_263 ) ) { - var pluginModule$jscomp$inline_263 = - injectedNamesToPlugins$jscomp$inline_260[pluginName$jscomp$inline_262]; + var pluginModule$jscomp$inline_264 = + injectedNamesToPlugins$jscomp$inline_261[pluginName$jscomp$inline_263]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_262) || - namesToPlugins[pluginName$jscomp$inline_262] !== - pluginModule$jscomp$inline_263 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_263) || + namesToPlugins[pluginName$jscomp$inline_263] !== + pluginModule$jscomp$inline_264 ) { - if (namesToPlugins[pluginName$jscomp$inline_262]) + if (namesToPlugins[pluginName$jscomp$inline_263]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_262 + "`.") + (pluginName$jscomp$inline_263 + "`.") ); - namesToPlugins[pluginName$jscomp$inline_262] = - pluginModule$jscomp$inline_263; - isOrderingDirty$jscomp$inline_261 = !0; + namesToPlugins[pluginName$jscomp$inline_263] = + pluginModule$jscomp$inline_264; + isOrderingDirty$jscomp$inline_262 = !0; } } -isOrderingDirty$jscomp$inline_261 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_262 && recomputePluginOrdering(); var instanceCache = new Map(), instanceProps = new Map(); function getInstanceFromTag(tag) { @@ -2660,7 +2660,11 @@ function trackUsedThenable(thenableState, thenable, index) { case "fulfilled": return thenable.value; case "rejected": - throw thenable.reason; + throw ( + ((thenableState = thenable.reason), + checkIfUseWrappedInAsyncCatch(thenableState), + thenableState) + ); default: if ("string" === typeof thenable.status) thenable.then(noop, noop); else { @@ -2687,12 +2691,16 @@ function trackUsedThenable(thenableState, thenable, index) { } } ); - } - switch (thenable.status) { - case "fulfilled": - return thenable.value; - case "rejected": - throw thenable.reason; + switch (thenable.status) { + case "fulfilled": + return thenable.value; + case "rejected": + throw ( + ((thenableState = thenable.reason), + checkIfUseWrappedInAsyncCatch(thenableState), + thenableState) + ); + } } suspendedThenable = thenable; throw SuspenseException; @@ -2708,6 +2716,12 @@ function getSuspendedThenable() { suspendedThenable = null; return thenable; } +function checkIfUseWrappedInAsyncCatch(rejectedReason) { + if (rejectedReason === SuspenseException) + throw Error( + "Hooks are not supported inside an async component. This error is often caused by accidentally adding `'use client'` to a module that was originally written for the server." + ); +} var thenableState$1 = null, thenableIndexCounter$1 = 0; function unwrapThenable(thenable) { @@ -6062,14 +6076,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$67 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$67 = lastTailNode), + for (var lastTailNode$68 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$68 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$67 + null === lastTailNode$68 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$67.sibling = null); + : (lastTailNode$68.sibling = null); } } function bubbleProperties(completedWork) { @@ -6081,53 +6095,53 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$69 = completedWork.selfBaseDuration, - child$70 = completedWork.child; - null !== child$70; + var treeBaseDuration$70 = completedWork.selfBaseDuration, + child$71 = completedWork.child; + null !== child$71; ) - (newChildLanes |= child$70.lanes | child$70.childLanes), - (subtreeFlags |= child$70.subtreeFlags & 31457280), - (subtreeFlags |= child$70.flags & 31457280), - (treeBaseDuration$69 += child$70.treeBaseDuration), - (child$70 = child$70.sibling); - completedWork.treeBaseDuration = treeBaseDuration$69; + (newChildLanes |= child$71.lanes | child$71.childLanes), + (subtreeFlags |= child$71.subtreeFlags & 31457280), + (subtreeFlags |= child$71.flags & 31457280), + (treeBaseDuration$70 += child$71.treeBaseDuration), + (child$71 = child$71.sibling); + completedWork.treeBaseDuration = treeBaseDuration$70; } else for ( - treeBaseDuration$69 = completedWork.child; - null !== treeBaseDuration$69; + treeBaseDuration$70 = completedWork.child; + null !== treeBaseDuration$70; ) (newChildLanes |= - treeBaseDuration$69.lanes | treeBaseDuration$69.childLanes), - (subtreeFlags |= treeBaseDuration$69.subtreeFlags & 31457280), - (subtreeFlags |= treeBaseDuration$69.flags & 31457280), - (treeBaseDuration$69.return = completedWork), - (treeBaseDuration$69 = treeBaseDuration$69.sibling); + treeBaseDuration$70.lanes | treeBaseDuration$70.childLanes), + (subtreeFlags |= treeBaseDuration$70.subtreeFlags & 31457280), + (subtreeFlags |= treeBaseDuration$70.flags & 31457280), + (treeBaseDuration$70.return = completedWork), + (treeBaseDuration$70 = treeBaseDuration$70.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$69 = completedWork.actualDuration; - child$70 = completedWork.selfBaseDuration; + treeBaseDuration$70 = completedWork.actualDuration; + child$71 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$69 += child.actualDuration), - (child$70 += child.treeBaseDuration), + (treeBaseDuration$70 += child.actualDuration), + (child$71 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$69; - completedWork.treeBaseDuration = child$70; + completedWork.actualDuration = treeBaseDuration$70; + completedWork.treeBaseDuration = child$71; } else for ( - treeBaseDuration$69 = completedWork.child; - null !== treeBaseDuration$69; + treeBaseDuration$70 = completedWork.child; + null !== treeBaseDuration$70; ) (newChildLanes |= - treeBaseDuration$69.lanes | treeBaseDuration$69.childLanes), - (subtreeFlags |= treeBaseDuration$69.subtreeFlags), - (subtreeFlags |= treeBaseDuration$69.flags), - (treeBaseDuration$69.return = completedWork), - (treeBaseDuration$69 = treeBaseDuration$69.sibling); + treeBaseDuration$70.lanes | treeBaseDuration$70.childLanes), + (subtreeFlags |= treeBaseDuration$70.subtreeFlags), + (subtreeFlags |= treeBaseDuration$70.flags), + (treeBaseDuration$70.return = completedWork), + (treeBaseDuration$70 = treeBaseDuration$70.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -6637,8 +6651,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { recordLayoutEffectDuration(current); } else ref(null); - } catch (error$88) { - captureCommitPhaseError(current, nearestMountedAncestor, error$88); + } catch (error$89) { + captureCommitPhaseError(current, nearestMountedAncestor, error$89); } else ref.current = null; } @@ -6771,10 +6785,10 @@ function commitHookEffectListMount(flags, finishedWork) { injectedProfilingHooks.markComponentLayoutEffectMountStarted( finishedWork ); - var create$89 = effect.create, + var create$90 = effect.create, inst = effect.inst; - create$89 = create$89(); - inst.destroy = create$89; + create$90 = create$90(); + inst.destroy = create$90; 0 !== (flags & 8) ? null !== injectedProfilingHooks && "function" === @@ -6802,8 +6816,8 @@ function commitHookLayoutEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$91) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$91); + } catch (error$92) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$92); } } function commitClassCallbacks(finishedWork) { @@ -6883,11 +6897,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { } else try { finishedRoot.componentDidMount(); - } catch (error$92) { + } catch (error$93) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$92 + error$93 ); } else { @@ -6904,11 +6918,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$93) { + } catch (error$94) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$93 + error$94 ); } recordLayoutEffectDuration(finishedWork); @@ -6919,11 +6933,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$94) { + } catch (error$95) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$94 + error$95 ); } } @@ -7439,22 +7453,22 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { startLayoutEffectTimer(), commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$103) { + } catch (error$104) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$103 + error$104 ); } recordLayoutEffectDuration(finishedWork); } else try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$104) { + } catch (error$105) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$104 + error$105 ); } } @@ -7502,8 +7516,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { viewConfig.uiViewClassName, updatePayload ); - } catch (error$107) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$107); + } catch (error$108) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$108); } } break; @@ -7523,8 +7537,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { "RCTRawText", { text: current } ); - } catch (error$108) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$108); + } catch (error$109) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$109); } } break; @@ -7636,11 +7650,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === current) try { throw Error("Not yet implemented."); - } catch (error$97) { + } catch (error$98) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$97 + error$98 ); } } else if ( @@ -7714,12 +7728,12 @@ function commitReconciliationEffects(finishedWork) { break; case 3: case 4: - var parent$98 = JSCompiler_inline_result.stateNode.containerInfo, - before$99 = getHostSibling(finishedWork); + var parent$99 = JSCompiler_inline_result.stateNode.containerInfo, + before$100 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$99, - parent$98 + before$100, + parent$99 ); break; default: @@ -7905,8 +7919,8 @@ function commitHookPassiveMountEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$112) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$112); + } catch (error$113) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$113); } } function recursivelyTraversePassiveMountEffects(root, parentFiber) { @@ -8297,16 +8311,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { exitStatus = renderRootSync(root, lanes); if (2 === exitStatus) { errorRetryLanes = lanes; - var errorRetryLanes$114 = getLanesToRetrySynchronouslyOnError( + var errorRetryLanes$115 = getLanesToRetrySynchronouslyOnError( root, errorRetryLanes ); - 0 !== errorRetryLanes$114 && - ((lanes = errorRetryLanes$114), + 0 !== errorRetryLanes$115 && + ((lanes = errorRetryLanes$115), (exitStatus = recoverFromConcurrentError( root, errorRetryLanes, - errorRetryLanes$114 + errorRetryLanes$115 ))); } if (1 === exitStatus) @@ -8627,8 +8641,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$116) { - handleThrow(root, thrownValue$116); + } catch (thrownValue$117) { + handleThrow(root, thrownValue$117); } while (1); lanes && root.shellSuspendCounter++; @@ -8745,8 +8759,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$118) { - handleThrow(root, thrownValue$118); + } catch (thrownValue$119) { + handleThrow(root, thrownValue$119); } while (1); resetContextDependencies(); @@ -8932,10 +8946,10 @@ function throwAndUnwindWorkLoop(unitOfWork, thrownValue) { }; suspenseBoundary.updateQueue = newOffscreenQueue; } else { - var retryQueue$36 = offscreenQueue.retryQueue; - null === retryQueue$36 + var retryQueue$37 = offscreenQueue.retryQueue; + null === retryQueue$37 ? (offscreenQueue.retryQueue = new Set([wakeable])) - : retryQueue$36.add(wakeable); + : retryQueue$37.add(wakeable); } } break; @@ -9220,11 +9234,11 @@ function flushPassiveEffects() { _finishedWork$memoize = finishedWork.memoizedProps, id = _finishedWork$memoize.id, onPostCommit = _finishedWork$memoize.onPostCommit, - commitTime$90 = commitTime, + commitTime$91 = commitTime, phase = null === finishedWork.alternate ? "mount" : "update"; currentUpdateIsNested && (phase = "nested-update"); "function" === typeof onPostCommit && - onPostCommit(id, phase, passiveEffectDuration, commitTime$90); + onPostCommit(id, phase, passiveEffectDuration, commitTime$91); var parentFiber = finishedWork.return; b: for (; null !== parentFiber; ) { switch (parentFiber.tag) { @@ -10384,10 +10398,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1175 = { + devToolsConfig$jscomp$inline_1176 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.3.0-canary-45030907", + version: "18.3.0-canary-bf9a1c5f", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10417,10 +10431,10 @@ var roots = new Map(), } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1175.bundleType, - version: devToolsConfig$jscomp$inline_1175.version, - rendererPackageName: devToolsConfig$jscomp$inline_1175.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1175.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1176.bundleType, + version: devToolsConfig$jscomp$inline_1176.version, + rendererPackageName: devToolsConfig$jscomp$inline_1176.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1176.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10436,14 +10450,14 @@ var roots = new Map(), return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1175.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1176.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-45030907" + reconcilerVersion: "18.3.0-canary-bf9a1c5f" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { computeComponentStackForErrorReporting: function (reactTag) {