From 4ec05827d4c568358010a5559c68266a89ac4f19 Mon Sep 17 00:00:00 2001 From: sebmarkbage Date: Wed, 27 Mar 2024 03:48:45 +0000 Subject: [PATCH] [Fiber] Don't Rethrow Errors at the Root (#28627) Stacked on top of #28498 for test fixes. ### Don't Rethrow When we started React it was 1:1 setState calls a series of renders and if they error, it errors where the setState was called. Simple. However, then batching came and the error actually got thrown somewhere else. With concurrent mode, it's not even possible to get setState itself to throw anymore. In fact, all APIs that can rethrow out of React are executed either at the root of the scheduler or inside a DOM event handler. If you throw inside a React.startTransition callback that's sync, then that will bubble out of the startTransition but if you throw inside an async callback or a useTransition we now need to handle it at the hook site. So in 19 we need to make all React.startTransition swallow the error (and report them to reportError). The only one remaining that can throw is flushSync but it doesn't really make sense for it to throw at the callsite neither because batching. Just because something rendered in this flush doesn't mean it was rendered due to what was just scheduled and doesn't mean that it should abort any of the remaining code afterwards. setState is fire and forget. It's send an instruction elsewhere, it's not part of the current imperative code. Error boundaries never rethrow. Since you should really always have error boundaries, most of the time, it wouldn't rethrow anyway. Rethrowing also actually currently drops errors on the floor since we can only rethrow the first error, so to avoid that we'd need to call reportError anyway. This happens in RN events. The other issue with rethrowing is that it logs an extra console.error. Since we're not sure that user code will actually log it anywhere we still log it too just like we do with errors inside error boundaries which leads all of these to log twice. The goal of this PR is to never rethrow out of React instead, errors outside of error boundaries get logged to reportError. Event system errors too. ### Breaking Changes The main thing this affects is testing where you want to inspect the errors thrown. To make it easier to port, if you're inside `act` we track the error into act in an aggregate error and then rethrow it at the root of `act`. Unlike before though, if you flush synchronously inside of act it'll still continue until the end of act before rethrowing. I expect most user code breakages would be to migrate from `flushSync` to `act` if you assert on throwing. However, in the React repo we also have `internalAct` and the `waitForThrow` helpers. Since these have to use public production implementations we track these using the global onerror or process uncaughtException. Unlike regular act, includes both event handler errors and onRecoverableError by default too. Not just render/commit errors. So I had to account for that in our tests. We restore logging an extra log for uncaught errors after the main log with the component stack in it. We use `console.warn`. This is not yet ignorable if you preventDefault to the main error event. To avoid confusion if you don't end up logging the error to console I just added `An error occurred`. ### Polyfill All browsers we support really supports `reportError` but not all test and server environments do, so I implemented a polyfill for browser and node in `shared/reportGlobalError`. I don't love that this is included in all builds and gets duplicated into isomorphic even though it's not actually needed in production. Maybe in the future we can require a polyfill for this. ### Follow Ups In a follow up, I'll make caught vs uncaught error handling be configurable too. --------- Co-authored-by: Ricky Hanlon DiffTrain build for commit https://github.com/facebook/react/commit/6786563f3cbbc9b16d5a8187207b5bd904386e53. --- .../cjs/ReactTestRenderer-dev.js | 255 ++++----- .../cjs/ReactTestRenderer-prod.js | 410 ++++++++------- .../cjs/ReactTestRenderer-profiling.js | 478 +++++++++-------- .../RKJSModules/vendor/react/cjs/React-dev.js | 126 ++++- .../vendor/react/cjs/React-prod.js | 35 +- .../vendor/react/cjs/React-profiling.js | 35 +- .../Libraries/Renderer/REVISION | 2 +- .../implementations/ReactFabric-dev.fb.js | 255 ++++----- .../implementations/ReactFabric-prod.fb.js | 408 +++++++-------- .../ReactFabric-profiling.fb.js | 467 ++++++++--------- .../ReactNativeRenderer-dev.fb.js | 255 ++++----- .../ReactNativeRenderer-prod.fb.js | 429 ++++++++------- .../ReactNativeRenderer-profiling.fb.js | 488 +++++++++--------- 13 files changed, 1903 insertions(+), 1740 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 eea066d0f85bd..4b47b08995115 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<> */ "use strict"; @@ -3636,7 +3636,7 @@ if (__DEV__) { } } - var ReactCurrentActQueue$3 = ReactSharedInternals.ReactCurrentActQueue; // A linked list of all the roots with pending work. In an idiomatic app, + var ReactCurrentActQueue$4 = ReactSharedInternals.ReactCurrentActQueue; // A linked list of all the roots with pending work. In an idiomatic app, // there's only a single root, but we do support multi root apps, hence this // extra complexity. But this module is optimized for the single root case. @@ -3675,7 +3675,7 @@ if (__DEV__) { mightHavePendingSyncWork = true; // At the end of the current event, go through each of the roots and ensure // there's a task scheduled for each one at the correct priority. - if (ReactCurrentActQueue$3.current !== null) { + if (ReactCurrentActQueue$4.current !== null) { // We're inside an `act` scope. if (!didScheduleMicrotask_act) { didScheduleMicrotask_act = true; @@ -3696,9 +3696,9 @@ if (__DEV__) { scheduleTaskForRootDuringMicrotask(root, now$1()); } - if (ReactCurrentActQueue$3.isBatchingLegacy && root.tag === LegacyRoot) { + if (ReactCurrentActQueue$4.isBatchingLegacy && root.tag === LegacyRoot) { // Special `act` case: Record whenever a legacy update is scheduled. - ReactCurrentActQueue$3.didScheduleLegacyUpdate = true; + ReactCurrentActQueue$4.didScheduleLegacyUpdate = true; } } function flushSyncWorkOnAllRoots() { @@ -3726,7 +3726,6 @@ if (__DEV__) { } // There may or may not be synchronous work scheduled. Let's check. var didPerformSomeWork; - var errors = null; isFlushingWork = true; do { @@ -3748,17 +3747,8 @@ if (__DEV__) { if (includesSyncLane(nextLanes)) { // This root has pending sync work. Flush it now. - try { - didPerformSomeWork = true; - performSyncWorkOnRoot(root, nextLanes); - } catch (error) { - // Collect errors so we can rethrow them at the end - if (errors === null) { - errors = [error]; - } else { - errors.push(error); - } - } + didPerformSomeWork = true; + performSyncWorkOnRoot(root, nextLanes); } } @@ -3766,32 +3756,7 @@ if (__DEV__) { } } while (didPerformSomeWork); - isFlushingWork = false; // If any errors were thrown, rethrow them right before exiting. - // TODO: Consider returning these to the caller, to allow them to decide - // how/when to rethrow. - - if (errors !== null) { - if (errors.length > 1) { - if (typeof AggregateError === "function") { - // eslint-disable-next-line no-undef - throw new AggregateError(errors); - } else { - for (var i = 1; i < errors.length; i++) { - scheduleImmediateTask(throwError.bind(null, errors[i])); - } - - var firstError = errors[0]; - throw firstError; - } - } else { - var error = errors[0]; - throw error; - } - } - } - - function throwError(error) { - throw error; + isFlushingWork = false; } function processRootScheduleInMicrotask() { @@ -3922,7 +3887,7 @@ if (__DEV__) { // Scheduler task, rather than an `act` task, cancel it and re-schedule // on the `act` queue. !( - ReactCurrentActQueue$3.current !== null && + ReactCurrentActQueue$4.current !== null && existingCallbackNode !== fakeActCallbackNode$1 ) ) { @@ -3989,11 +3954,11 @@ if (__DEV__) { var fakeActCallbackNode$1 = {}; function scheduleCallback$2(priorityLevel, callback) { - if (ReactCurrentActQueue$3.current !== null) { + if (ReactCurrentActQueue$4.current !== null) { // Special case: We're inside an `act` scope (a testing utility). // Instead of scheduling work in the host environment, add it to a // fake internal queue that's managed by the `act` implementation. - ReactCurrentActQueue$3.current.push(callback); + ReactCurrentActQueue$4.current.push(callback); return fakeActCallbackNode$1; } else { return scheduleCallback$3(priorityLevel, callback); @@ -4008,13 +3973,13 @@ if (__DEV__) { } function scheduleImmediateTask(cb) { - if (ReactCurrentActQueue$3.current !== null) { + if (ReactCurrentActQueue$4.current !== null) { // Special case: Inside an `act` scope, we push microtasks to the fake `act` // callback queue. This is because we currently support calling `act` // without awaiting the result. The plan is to deprecate that, and require // that you always await the result so that the microtasks have a chance to // run. But it hasn't happened yet. - ReactCurrentActQueue$3.current.push(function () { + ReactCurrentActQueue$4.current.push(function () { cb(); return null; }); @@ -5396,7 +5361,7 @@ if (__DEV__) { } } - var ReactCurrentActQueue$2 = ReactSharedInternals.ReactCurrentActQueue; + var ReactCurrentActQueue$3 = ReactSharedInternals.ReactCurrentActQueue; function getThenablesFromState(state) { { @@ -5451,8 +5416,8 @@ if (__DEV__) { function noop() {} function trackUsedThenable(thenableState, thenable, index) { - if (ReactCurrentActQueue$2.current !== null) { - ReactCurrentActQueue$2.didUsePromise = true; + if (ReactCurrentActQueue$3.current !== null) { + ReactCurrentActQueue$3.didUsePromise = true; } var trackedThenables = getThenablesFromState(thenableState); @@ -12866,6 +12831,46 @@ if (__DEV__) { return true; } + var reportGlobalError = + typeof reportError === "function" // In modern browsers, reportError will dispatch an error event, + ? // emulating an uncaught JavaScript error. + reportError + : function (error) { + if ( + typeof window === "object" && + typeof window.ErrorEvent === "function" + ) { + // Browser Polyfill + var message = + typeof error === "object" && + error !== null && + typeof error.message === "string" // eslint-disable-next-line react-internal/safe-string-coercion + ? String(error.message) // eslint-disable-next-line react-internal/safe-string-coercion + : String(error); + var event = new window.ErrorEvent("error", { + bubbles: true, + cancelable: true, + message: message, + error: error + }); + var shouldLog = window.dispatchEvent(event); + + if (!shouldLog) { + return; + } + } else if ( + typeof process === "object" && // $FlowFixMe[method-unbinding] + typeof process.emit === "function" + ) { + // Node Polyfill + process.emit("uncaughtException", error); + return; + } // eslint-disable-next-line react-internal/no-production-logging + + console["error"](error); + }; + + var ReactCurrentActQueue$2 = ReactSharedInternals.ReactCurrentActQueue; function logCapturedError(boundary, errorInfo) { try { var logError = showErrorDialog(boundary, errorInfo); // Allow injected showErrorDialog() to prevent default console.error logging. @@ -12877,43 +12882,73 @@ if (__DEV__) { var error = errorInfo.value; - if (true) { - var source = errorInfo.source; - var stack = errorInfo.stack; - var componentStack = stack !== null ? stack : ""; // TODO: There's no longer a way to silence these warnings e.g. for tests. - // See https://github.com/facebook/react/pull/13384 - - var componentName = source ? getComponentNameFromFiber(source) : null; - var componentNameMessage = componentName - ? "The above error occurred in the <" + - componentName + - "> component:" - : "The above error occurred in one of your React components:"; - var errorBoundaryMessage; - - if (boundary.tag === HostRoot) { - errorBoundaryMessage = + if (boundary.tag === HostRoot) { + if (true && ReactCurrentActQueue$2.current !== null) { + // For uncaught errors inside act, we track them on the act and then + // rethrow them into the test. + ReactCurrentActQueue$2.thrownErrors.push(error); + return; + } // For uncaught root errors we report them as uncaught to the browser's + // onerror callback. This won't have component stacks and the error addendum. + // So we add those into a separate console.warn. + + reportGlobalError(error); + + if (true) { + var source = errorInfo.source; + var stack = errorInfo.stack; + var componentStack = stack !== null ? stack : ""; // TODO: There's no longer a way to silence these warnings e.g. for tests. + // See https://github.com/facebook/react/pull/13384 + + var componentName = source + ? getComponentNameFromFiber(source) + : null; + var componentNameMessage = componentName + ? "An error occurred in the <" + componentName + "> component:" + : "An error occurred in one of your React components:"; + console["warn"]( + "%s\n%s\n\n%s", + componentNameMessage, + componentStack, "Consider adding an error boundary to your tree to customize error handling behavior.\n" + - "Visit https://react.dev/link/error-boundaries to learn more about error boundaries."; - } else { - var errorBoundaryName = - getComponentNameFromFiber(boundary) || "Anonymous"; - errorBoundaryMessage = - "React will try to recreate this component tree from scratch " + - ("using the error boundary you provided, " + - errorBoundaryName + - "."); - } // In development, we provide our own message which includes the component stack - // in addition to the error. + "Visit https://react.dev/link/error-boundaries to learn more about error boundaries." + ); + } + } else { + // Caught by error boundary + if (true) { + var _source = errorInfo.source; + var _stack = errorInfo.stack; + + var _componentStack = _stack !== null ? _stack : ""; // TODO: There's no longer a way to silence these warnings e.g. for tests. + // See https://github.com/facebook/react/pull/13384 - console["error"]( + var _componentName = _source + ? getComponentNameFromFiber(_source) + : null; + + var _componentNameMessage = _componentName + ? "The above error occurred in the <" + + _componentName + + "> component:" + : "The above error occurred in one of your React components:"; + + var errorBoundaryName = + getComponentNameFromFiber(boundary) || "Anonymous"; // In development, we provide our own message which includes the component stack + // in addition to the error. // Don't transform to our wrapper - "%o\n\n%s\n%s\n\n%s", - error, - componentNameMessage, - componentStack, - errorBoundaryMessage - ); + + console["error"]( + "%o\n\n%s\n%s\n\n%s", + error, + _componentNameMessage, + _componentStack, + "React will try to recreate this component tree from scratch " + + ("using the error boundary you provided, " + + errorBoundaryName + + ".") + ); + } } } catch (e) { // This method must not throw, or React internal state will get messed up. @@ -12935,10 +12970,8 @@ if (__DEV__) { update.payload = { element: null }; - var error = errorInfo.value; update.callback = function () { - onUncaughtError(error); logCapturedError(fiber, errorInfo); }; @@ -22064,9 +22097,7 @@ if (__DEV__) { var entangledRenderLanes = NoLanes; // Whether to root completed, errored, suspended, etc. - var workInProgressRootExitStatus = RootInProgress; // A fatal error, if one is thrown - - var workInProgressRootFatalError = null; // The work left over by components that were visited during this render. Only + var workInProgressRootExitStatus = RootInProgress; // The work left over by components that were visited during this render. Only // includes unprocessed updates, not work in bailed out children. var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an interleaved event) during this render. @@ -22104,8 +22135,6 @@ if (__DEV__) { function getRenderTargetTime() { return workInProgressRootRenderTargetTime; } - var hasUncaughtError = false; - var firstUncaughtError = null; var legacyErrorBoundariesThatAlreadyFailed = null; var rootDoesHavePassiveEffects = false; var rootWithPendingPassiveEffects = null; @@ -22446,11 +22475,9 @@ if (__DEV__) { } if (exitStatus === RootFatalErrored) { - var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); markRootSuspended(root, lanes, NoLane); - ensureRootIsScheduled(root); - throw fatalError; + break; } // We now have a consistent tree. The next step is either to commit it, // or, if something suspended, wait to commit it after a timeout. @@ -22813,11 +22840,10 @@ if (__DEV__) { } if (exitStatus === RootFatalErrored) { - var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); - throw fatalError; + return null; } if (exitStatus === RootDidNotComplete) { @@ -22976,7 +23002,6 @@ if (__DEV__) { workInProgressThrownValue = null; workInProgressRootDidAttachPingListener = false; workInProgressRootExitStatus = RootInProgress; - workInProgressRootFatalError = null; workInProgressRootSkippedLanes = NoLanes; workInProgressRootInterleavedUpdatedLanes = NoLanes; workInProgressRootPingedLanes = NoLanes; @@ -23079,7 +23104,10 @@ if (__DEV__) { if (erroredWork === null) { // This is a fatal error workInProgressRootExitStatus = RootFatalErrored; - workInProgressRootFatalError = thrownValue; + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); return; } @@ -23756,7 +23784,7 @@ if (__DEV__) { ); if (didFatal) { - panicOnRootError(thrownValue); + panicOnRootError(root, thrownValue); return; } } catch (error) { @@ -23768,7 +23796,7 @@ if (__DEV__) { workInProgress = returnFiber; throw error; } else { - panicOnRootError(thrownValue); + panicOnRootError(root, thrownValue); return; } } @@ -23790,13 +23818,16 @@ if (__DEV__) { } } - function panicOnRootError(error) { + function panicOnRootError(root, error) { // There's no ancestor that can handle this exception. This should never // happen because the root is supposed to capture all errors that weren't // caught by an error boundary. This is a fatal error, or panic condition, // because we've run out of ways to recover. workInProgressRootExitStatus = RootFatalErrored; - workInProgressRootFatalError = error; // Set `workInProgress` to null. This represents advancing to the next + logCapturedError( + root.current, + createCapturedValueAtFiber(error, root.current) + ); // Set `workInProgress` to null. This represents advancing to the next // sibling, or the parent if there are no siblings. But since the root // has no siblings nor a parent, we set it to null. Usually this is // handled by `completeUnitOfWork` or `unwindWork`, but since we're @@ -24187,13 +24218,6 @@ if (__DEV__) { ); onRecoverableError(recoverableError.value, errorInfo); } - } - - if (hasUncaughtError) { - hasUncaughtError = false; - var error$1 = firstUncaughtError; - firstUncaughtError = null; - throw error$1; } // If the passive effects are the result of a discrete render, flush them // synchronously at the end of the current task so that the result is // immediately observable. Otherwise, we assume that they are not @@ -24425,15 +24449,6 @@ if (__DEV__) { } } - function prepareToThrowUncaughtError(error) { - if (!hasUncaughtError) { - hasUncaughtError = true; - firstUncaughtError = error; - } - } - - var onUncaughtError = prepareToThrowUncaughtError; - function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { var errorInfo = createCapturedValueAtFiber(error, sourceFiber); var update = createRootErrorUpdate(rootFiber, errorInfo, SyncLane); @@ -26175,7 +26190,7 @@ if (__DEV__) { return root; } - var ReactVersion = "19.0.0-canary-0a1d14e5"; + var ReactVersion = "19.0.0-canary-f1360d33"; // 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 3be3fc41a8a0b..ced629d768a42 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<<078314ad2b64a452a5faeecab26ced6f>> + * @generated SignedSource<<1e5591c75165c8a5b012cfc0f1a68f85>> */ "use strict"; @@ -799,98 +799,26 @@ function ensureRootIsScheduled(root) { } function flushSyncWorkAcrossRoots_impl(onlyLegacy) { if (!isFlushingWork && mightHavePendingSyncWork) { - var errors = null; isFlushingWork = !0; do { var didPerformSomeWork = !1; for (var root = firstScheduledRoot; null !== root; ) { if (!onlyLegacy || 0 === root.tag) { - var workInProgressRootRenderLanes$7 = workInProgressRootRenderLanes, - nextLanes = getNextLanes( - root, - root === workInProgressRoot ? workInProgressRootRenderLanes$7 : 0 - ); - if (0 !== (nextLanes & 3)) - try { - didPerformSomeWork = !0; - workInProgressRootRenderLanes$7 = root; - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - if (!flushPassiveEffects()) { - var exitStatus = renderRootSync( - workInProgressRootRenderLanes$7, - nextLanes - ); - if ( - 0 !== workInProgressRootRenderLanes$7.tag && - 2 === exitStatus - ) { - var originallyAttemptedLanes = nextLanes, - errorRetryLanes = getLanesToRetrySynchronouslyOnError( - workInProgressRootRenderLanes$7, - originallyAttemptedLanes - ); - 0 !== errorRetryLanes && - ((nextLanes = errorRetryLanes), - (exitStatus = recoverFromConcurrentError( - workInProgressRootRenderLanes$7, - originallyAttemptedLanes, - errorRetryLanes - ))); - } - if (1 === exitStatus) - throw ( - ((originallyAttemptedLanes = workInProgressRootFatalError), - prepareFreshStack(workInProgressRootRenderLanes$7, 0), - markRootSuspended( - workInProgressRootRenderLanes$7, - nextLanes, - 0 - ), - ensureRootIsScheduled(workInProgressRootRenderLanes$7), - originallyAttemptedLanes) - ); - 6 === exitStatus - ? markRootSuspended( - workInProgressRootRenderLanes$7, - nextLanes, - workInProgressDeferredLane - ) - : ((workInProgressRootRenderLanes$7.finishedWork = - workInProgressRootRenderLanes$7.current.alternate), - (workInProgressRootRenderLanes$7.finishedLanes = nextLanes), - commitRoot( - workInProgressRootRenderLanes$7, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - workInProgressDeferredLane - )); - } - ensureRootIsScheduled(workInProgressRootRenderLanes$7); - } catch (error) { - null === errors ? (errors = [error]) : errors.push(error); - } + var workInProgressRootRenderLanes$7 = workInProgressRootRenderLanes; + workInProgressRootRenderLanes$7 = getNextLanes( + root, + root === workInProgressRoot ? workInProgressRootRenderLanes$7 : 0 + ); + 0 !== (workInProgressRootRenderLanes$7 & 3) && + ((didPerformSomeWork = !0), + performSyncWorkOnRoot(root, workInProgressRootRenderLanes$7)); } root = root.next; } } while (didPerformSomeWork); isFlushingWork = !1; - if (null !== errors) { - if (1 < errors.length) { - if ("function" === typeof AggregateError) - throw new AggregateError(errors); - for (onlyLegacy = 1; onlyLegacy < errors.length; onlyLegacy++) - (didPerformSomeWork = throwError.bind(null, errors[onlyLegacy])), - scheduleCallback$3(ImmediatePriority, didPerformSomeWork); - } - throw errors[0]; - } } } -function throwError(error) { - throw error; -} function processRootScheduleInMicrotask() { mightHavePendingSyncWork = didScheduleMicrotask = !1; for ( @@ -2510,7 +2438,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$26 = !1; + didReadFromEntangledAsyncAction$25 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -2531,11 +2459,11 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$26 = !0); + (didReadFromEntangledAsyncAction$25 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$26 = !0); + (didReadFromEntangledAsyncAction$25 = !0); continue; } else (updateLane = { @@ -2581,7 +2509,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$26 && + didReadFromEntangledAsyncAction$25 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -3615,9 +3543,39 @@ function createCapturedValueFromError(value, digest, stack) { digest: null != digest ? digest : null }; } +var reportGlobalError = + "function" === typeof reportError + ? reportError + : function (error) { + if ( + "object" === typeof window && + "function" === typeof window.ErrorEvent + ) { + var event = new window.ErrorEvent("error", { + bubbles: !0, + cancelable: !0, + message: + "object" === typeof error && + null !== error && + "string" === typeof error.message + ? String(error.message) + : String(error), + error: error + }); + if (!window.dispatchEvent(event)) return; + } else if ( + "object" === typeof process && + "function" === typeof process.emit + ) { + process.emit("uncaughtException", error); + return; + } + console.error(error); + }; function logCapturedError(boundary, errorInfo) { try { - console.error(errorInfo.value); + var error = errorInfo.value; + 3 === boundary.tag ? reportGlobalError(error) : console.error(error); } catch (e) { setTimeout(function () { throw e; @@ -3628,9 +3586,7 @@ function createRootErrorUpdate(fiber, errorInfo, lane) { lane = createUpdate(lane); lane.tag = 3; lane.payload = { element: null }; - var error = errorInfo.value; lane.callback = function () { - hasUncaughtError || ((hasUncaughtError = !0), (firstUncaughtError = error)); logCapturedError(fiber, errorInfo); }; return lane; @@ -5521,14 +5477,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$62 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$62 = lastTailNode), + for (var lastTailNode$61 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$61 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$62 + null === lastTailNode$61 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$62.sibling = null); + : (lastTailNode$61.sibling = null); } } function bubbleProperties(completedWork) { @@ -5538,19 +5494,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$63 = completedWork.child; null !== child$63; ) - (newChildLanes |= child$63.lanes | child$63.childLanes), - (subtreeFlags |= child$63.subtreeFlags & 31457280), - (subtreeFlags |= child$63.flags & 31457280), - (child$63.return = completedWork), - (child$63 = child$63.sibling); + for (var child$62 = completedWork.child; null !== child$62; ) + (newChildLanes |= child$62.lanes | child$62.childLanes), + (subtreeFlags |= child$62.subtreeFlags & 31457280), + (subtreeFlags |= child$62.flags & 31457280), + (child$62.return = completedWork), + (child$62 = child$62.sibling); else - for (child$63 = completedWork.child; null !== child$63; ) - (newChildLanes |= child$63.lanes | child$63.childLanes), - (subtreeFlags |= child$63.subtreeFlags), - (subtreeFlags |= child$63.flags), - (child$63.return = completedWork), - (child$63 = child$63.sibling); + for (child$62 = completedWork.child; null !== child$62; ) + (newChildLanes |= child$62.lanes | child$62.childLanes), + (subtreeFlags |= child$62.subtreeFlags), + (subtreeFlags |= child$62.flags), + (child$62.return = completedWork), + (child$62 = child$62.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -5713,11 +5669,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (index = newProps.alternate.memoizedState.cachePool.pool); - var cache$67 = null; + var cache$66 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$67 = newProps.memoizedState.cachePool.pool); - cache$67 !== index && (newProps.flags |= 2048); + (cache$66 = newProps.memoizedState.cachePool.pool); + cache$66 !== index && (newProps.flags |= 2048); } renderLanes !== current && renderLanes && @@ -5744,8 +5700,8 @@ function completeWork(current, workInProgress, renderLanes) { index = workInProgress.memoizedState; if (null === index) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$67 = index.rendering; - if (null === cache$67) + cache$66 = index.rendering; + if (null === cache$66) if (newProps) cutOffTailIfNeeded(index, !1); else { if ( @@ -5753,11 +5709,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$67 = findFirstSuspended(current); - if (null !== cache$67) { + cache$66 = findFirstSuspended(current); + if (null !== cache$66) { workInProgress.flags |= 128; cutOffTailIfNeeded(index, !1); - current = cache$67.updateQueue; + current = cache$66.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -5782,7 +5738,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$67)), null !== current)) { + if (((current = findFirstSuspended(cache$66)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -5792,7 +5748,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(index, !0), null === index.tail && "hidden" === index.tailMode && - !cache$67.alternate) + !cache$66.alternate) ) return bubbleProperties(workInProgress), null; } else @@ -5804,13 +5760,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(index, !1), (workInProgress.lanes = 4194304)); index.isBackwards - ? ((cache$67.sibling = workInProgress.child), - (workInProgress.child = cache$67)) + ? ((cache$66.sibling = workInProgress.child), + (workInProgress.child = cache$66)) : ((current = index.last), null !== current - ? (current.sibling = cache$67) - : (workInProgress.child = cache$67), - (index.last = cache$67)); + ? (current.sibling = cache$66) + : (workInProgress.child = cache$66), + (index.last = cache$66)); } if (null !== index.tail) return ( @@ -6023,8 +5979,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { else if ("function" === typeof ref) try { ref(null); - } catch (error$83) { - captureCommitPhaseError(current, nearestMountedAncestor, error$83); + } catch (error$82) { + captureCommitPhaseError(current, nearestMountedAncestor, error$82); } else ref.current = null; } @@ -6130,10 +6086,10 @@ function commitHookEffectListMount(flags, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & flags) === flags) { - var create$84 = effect.create, + var create$83 = effect.create, inst = effect.inst; - create$84 = create$84(); - inst.destroy = create$84; + create$83 = create$83(); + inst.destroy = create$83; } effect = effect.next; } while (effect !== finishedWork); @@ -6187,11 +6143,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$85) { + } catch (error$84) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$85 + error$84 ); } } @@ -6568,8 +6524,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$93) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$93); + } catch (error$92) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$92); } } break; @@ -6607,8 +6563,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { finishedWork.updateQueue = null; try { (flags.type = type), (flags.props = existingHiddenCallbacks); - } catch (error$96) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$96); + } catch (error$95) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$95); } } break; @@ -6624,8 +6580,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { existingHiddenCallbacks = finishedWork.memoizedProps; try { flags.text = existingHiddenCallbacks; - } catch (error$97) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$97); + } catch (error$96) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$96); } } break; @@ -6709,11 +6665,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { wasHidden.stateNode.isHidden = existingHiddenCallbacks ? !0 : !1; - } catch (error$87) { + } catch (error$86) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$87 + error$86 ); } } else if ( @@ -6791,12 +6747,12 @@ function commitReconciliationEffects(finishedWork) { break; case 3: case 4: - var parent$88 = JSCompiler_inline_result.stateNode.containerInfo, - before$89 = getHostSibling(finishedWork); + var parent$87 = JSCompiler_inline_result.stateNode.containerInfo, + before$88 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$89, - parent$88 + before$88, + parent$87 ); break; default: @@ -7420,7 +7376,6 @@ var DefaultCacheDispatcher = { workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = 0, - workInProgressRootFatalError = null, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, workInProgressRootPingedLanes = 0, @@ -7431,8 +7386,6 @@ var DefaultCacheDispatcher = { globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, workInProgressTransitions = null, - hasUncaughtError = !1, - firstUncaughtError = null, legacyErrorBoundariesThatAlreadyFailed = null, rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = null, @@ -7538,14 +7491,11 @@ function performConcurrentWorkOnRoot(root, didTimeout) { errorRetryLanes ))); } - if (1 === didTimeout) - throw ( - ((originalCallbackNode = workInProgressRootFatalError), - prepareFreshStack(root, 0), - markRootSuspended(root, lanes, 0), - ensureRootIsScheduled(root), - originalCallbackNode) - ); + if (1 === didTimeout) { + prepareFreshStack(root, 0); + markRootSuspended(root, lanes, 0); + break; + } root.finishedWork = shouldTimeSlice; root.finishedLanes = lanes; a: { @@ -7717,6 +7667,50 @@ function markRootSuspended(root, suspendedLanes, spawnedLane) { 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } +function performSyncWorkOnRoot(root, lanes) { + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + if (flushPassiveEffects()) return ensureRootIsScheduled(root), null; + var exitStatus = renderRootSync(root, lanes); + if (0 !== root.tag && 2 === exitStatus) { + var originallyAttemptedLanes = lanes, + errorRetryLanes = getLanesToRetrySynchronouslyOnError( + root, + originallyAttemptedLanes + ); + 0 !== errorRetryLanes && + ((lanes = errorRetryLanes), + (exitStatus = recoverFromConcurrentError( + root, + originallyAttemptedLanes, + errorRetryLanes + ))); + } + if (1 === exitStatus) + return ( + prepareFreshStack(root, 0), + markRootSuspended(root, lanes, 0), + ensureRootIsScheduled(root), + null + ); + if (6 === exitStatus) + return ( + markRootSuspended(root, lanes, workInProgressDeferredLane), + ensureRootIsScheduled(root), + null + ); + root.finishedWork = root.current.alternate; + root.finishedLanes = lanes; + commitRoot( + root, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + workInProgressDeferredLane + ); + ensureRootIsScheduled(root); + return null; +} function flushSync(fn) { null !== rootWithPendingPassiveEffects && 0 === rootWithPendingPassiveEffects.tag && @@ -7773,12 +7767,11 @@ function prepareFreshStack(root, lanes) { workInProgressSuspendedReason = 0; workInProgressThrownValue = null; workInProgressRootDidAttachPingListener = !1; - workInProgressRootExitStatus = 0; - workInProgressRootFatalError = null; workInProgressDeferredLane = workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = + workInProgressRootExitStatus = 0; workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null; @@ -7804,37 +7797,41 @@ function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; ReactCurrentOwner.current = null; - thrownValue === SuspenseException - ? ((thrownValue = getSuspendedThenable()), - (root = suspenseHandlerStackCursor.current), - (workInProgressSuspendedReason = - (null !== root && - ((workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null !== shellBoundary - : ((workInProgressRootRenderLanes & 62914560) !== - workInProgressRootRenderLanes && - 0 === (workInProgressRootRenderLanes & 536870912)) || - root !== shellBoundary)) || - 0 !== (workInProgressRootSkippedLanes & 134217727) || - 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 3 - : 2)) - : thrownValue === SuspenseyCommitException - ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = 4)) - : (workInProgressSuspendedReason = - thrownValue === SelectiveHydrationException - ? 8 - : null !== thrownValue && - "object" === typeof thrownValue && - "function" === typeof thrownValue.then - ? 6 - : 1); + if (thrownValue === SuspenseException) { + thrownValue = getSuspendedThenable(); + var handler = suspenseHandlerStackCursor.current; + workInProgressSuspendedReason = + (null !== handler && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + handler !== shellBoundary)) || + 0 !== (workInProgressRootSkippedLanes & 134217727) || + 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) + ? 3 + : 2; + } else + thrownValue === SuspenseyCommitException + ? ((thrownValue = getSuspendedThenable()), + (workInProgressSuspendedReason = 4)) + : (workInProgressSuspendedReason = + thrownValue === SelectiveHydrationException + ? 8 + : null !== thrownValue && + "object" === typeof thrownValue && + "function" === typeof thrownValue.then + ? 6 + : 1); workInProgressThrownValue = thrownValue; null === workInProgress && ((workInProgressRootExitStatus = 1), - (workInProgressRootFatalError = thrownValue)); + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + )); } function pushDispatcher() { var prevDispatcher = ReactCurrentDispatcher.current; @@ -7888,8 +7885,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$105) { - handleThrow(root, thrownValue$105); + } catch (thrownValue$104) { + handleThrow(root, thrownValue$104); } while (1); lanes && root.shellSuspendCounter++; @@ -7997,8 +7994,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$107) { - handleThrow(root, thrownValue$107); + } catch (thrownValue$106) { + handleThrow(root, thrownValue$106); } while (1); resetContextDependencies(); @@ -8094,14 +8091,20 @@ function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { ) ) { workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); workInProgress = null; return; } } catch (error) { if (null !== returnFiber) throw ((workInProgress = returnFiber), error); workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); workInProgress = null; return; } @@ -8254,13 +8257,6 @@ function commitRootImpl( componentStack: remainingLanes.stack }), renderPriorityLevel(remainingLanes.value, transitions); - if (hasUncaughtError) - throw ( - ((hasUncaughtError = !1), - (root = firstUncaughtError), - (firstUncaughtError = null), - root) - ); 0 !== (pendingPassiveEffectsLanes & 3) && 0 !== root.tag && flushPassiveEffects(); @@ -9151,19 +9147,19 @@ function wrapFiber(fiber) { fiberToWrapper.set(fiber, wrapper)); return wrapper; } -var devToolsConfig$jscomp$inline_1019 = { +var devToolsConfig$jscomp$inline_1009 = { findFiberByHostInstance: function () { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "19.0.0-canary-bd6c6cc2", + version: "19.0.0-canary-def247f9", rendererPackageName: "react-test-renderer" }; -var internals$jscomp$inline_1209 = { - bundleType: devToolsConfig$jscomp$inline_1019.bundleType, - version: devToolsConfig$jscomp$inline_1019.version, - rendererPackageName: devToolsConfig$jscomp$inline_1019.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1019.rendererConfig, +var internals$jscomp$inline_1197 = { + bundleType: devToolsConfig$jscomp$inline_1009.bundleType, + version: devToolsConfig$jscomp$inline_1009.version, + rendererPackageName: devToolsConfig$jscomp$inline_1009.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1009.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -9180,26 +9176,26 @@ var internals$jscomp$inline_1209 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1019.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1009.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-bd6c6cc2" + reconcilerVersion: "19.0.0-canary-def247f9" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1210 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1198 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1210.isDisabled && - hook$jscomp$inline_1210.supportsFiber + !hook$jscomp$inline_1198.isDisabled && + hook$jscomp$inline_1198.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1210.inject( - internals$jscomp$inline_1209 + (rendererID = hook$jscomp$inline_1198.inject( + internals$jscomp$inline_1197 )), - (injectedHook = hook$jscomp$inline_1210); + (injectedHook = hook$jscomp$inline_1198); } 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 0f2c0a86d110a..810500784b70a 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<> + * @generated SignedSource<<6fe0ba4b0b79a2cd2ec329261f75134d>> */ "use strict"; @@ -817,100 +817,26 @@ function ensureRootIsScheduled(root) { } function flushSyncWorkAcrossRoots_impl(onlyLegacy) { if (!isFlushingWork && mightHavePendingSyncWork) { - var errors = null; isFlushingWork = !0; do { var didPerformSomeWork = !1; for (var root = firstScheduledRoot; null !== root; ) { if (!onlyLegacy || 0 === root.tag) { - var workInProgressRootRenderLanes$7 = workInProgressRootRenderLanes, - nextLanes = getNextLanes( - root, - root === workInProgressRoot ? workInProgressRootRenderLanes$7 : 0 - ); - if (0 !== (nextLanes & 3)) - try { - didPerformSomeWork = !0; - workInProgressRootRenderLanes$7 = root; - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - if (!flushPassiveEffects()) { - currentUpdateIsNested = nestedUpdateScheduled; - nestedUpdateScheduled = !1; - var exitStatus = renderRootSync( - workInProgressRootRenderLanes$7, - nextLanes - ); - if ( - 0 !== workInProgressRootRenderLanes$7.tag && - 2 === exitStatus - ) { - var originallyAttemptedLanes = nextLanes, - errorRetryLanes = getLanesToRetrySynchronouslyOnError( - workInProgressRootRenderLanes$7, - originallyAttemptedLanes - ); - 0 !== errorRetryLanes && - ((nextLanes = errorRetryLanes), - (exitStatus = recoverFromConcurrentError( - workInProgressRootRenderLanes$7, - originallyAttemptedLanes, - errorRetryLanes - ))); - } - if (1 === exitStatus) - throw ( - ((originallyAttemptedLanes = workInProgressRootFatalError), - prepareFreshStack(workInProgressRootRenderLanes$7, 0), - markRootSuspended( - workInProgressRootRenderLanes$7, - nextLanes, - 0 - ), - ensureRootIsScheduled(workInProgressRootRenderLanes$7), - originallyAttemptedLanes) - ); - 6 === exitStatus - ? markRootSuspended( - workInProgressRootRenderLanes$7, - nextLanes, - workInProgressDeferredLane - ) - : ((workInProgressRootRenderLanes$7.finishedWork = - workInProgressRootRenderLanes$7.current.alternate), - (workInProgressRootRenderLanes$7.finishedLanes = nextLanes), - commitRoot( - workInProgressRootRenderLanes$7, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - workInProgressDeferredLane - )); - } - ensureRootIsScheduled(workInProgressRootRenderLanes$7); - } catch (error) { - null === errors ? (errors = [error]) : errors.push(error); - } + var workInProgressRootRenderLanes$7 = workInProgressRootRenderLanes; + workInProgressRootRenderLanes$7 = getNextLanes( + root, + root === workInProgressRoot ? workInProgressRootRenderLanes$7 : 0 + ); + 0 !== (workInProgressRootRenderLanes$7 & 3) && + ((didPerformSomeWork = !0), + performSyncWorkOnRoot(root, workInProgressRootRenderLanes$7)); } root = root.next; } } while (didPerformSomeWork); isFlushingWork = !1; - if (null !== errors) { - if (1 < errors.length) { - if ("function" === typeof AggregateError) - throw new AggregateError(errors); - for (onlyLegacy = 1; onlyLegacy < errors.length; onlyLegacy++) - (didPerformSomeWork = throwError.bind(null, errors[onlyLegacy])), - scheduleCallback$3(ImmediatePriority, didPerformSomeWork); - } - throw errors[0]; - } } } -function throwError(error) { - throw error; -} function processRootScheduleInMicrotask() { mightHavePendingSyncWork = didScheduleMicrotask = !1; for ( @@ -2530,7 +2456,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$26 = !1; + didReadFromEntangledAsyncAction$25 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -2551,11 +2477,11 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$26 = !0); + (didReadFromEntangledAsyncAction$25 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$26 = !0); + (didReadFromEntangledAsyncAction$25 = !0); continue; } else (updateLane = { @@ -2601,7 +2527,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$26 && + didReadFromEntangledAsyncAction$25 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -3697,9 +3623,39 @@ function createCapturedValueFromError(value, digest, stack) { digest: null != digest ? digest : null }; } +var reportGlobalError = + "function" === typeof reportError + ? reportError + : function (error) { + if ( + "object" === typeof window && + "function" === typeof window.ErrorEvent + ) { + var event = new window.ErrorEvent("error", { + bubbles: !0, + cancelable: !0, + message: + "object" === typeof error && + null !== error && + "string" === typeof error.message + ? String(error.message) + : String(error), + error: error + }); + if (!window.dispatchEvent(event)) return; + } else if ( + "object" === typeof process && + "function" === typeof process.emit + ) { + process.emit("uncaughtException", error); + return; + } + console.error(error); + }; function logCapturedError(boundary, errorInfo) { try { - console.error(errorInfo.value); + var error = errorInfo.value; + 3 === boundary.tag ? reportGlobalError(error) : console.error(error); } catch (e) { setTimeout(function () { throw e; @@ -3710,9 +3666,7 @@ function createRootErrorUpdate(fiber, errorInfo, lane) { lane = createUpdate(lane); lane.tag = 3; lane.payload = { element: null }; - var error = errorInfo.value; lane.callback = function () { - hasUncaughtError || ((hasUncaughtError = !0), (firstUncaughtError = error)); logCapturedError(fiber, errorInfo); }; return lane; @@ -5629,14 +5583,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$62 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$62 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$63 + null === lastTailNode$62 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$63.sibling = null); + : (lastTailNode$62.sibling = null); } } function bubbleProperties(completedWork) { @@ -5648,53 +5602,53 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$65 = completedWork.selfBaseDuration, - child$66 = completedWork.child; - null !== child$66; + var treeBaseDuration$64 = completedWork.selfBaseDuration, + child$65 = completedWork.child; + null !== child$65; ) - (newChildLanes |= child$66.lanes | child$66.childLanes), - (subtreeFlags |= child$66.subtreeFlags & 31457280), - (subtreeFlags |= child$66.flags & 31457280), - (treeBaseDuration$65 += child$66.treeBaseDuration), - (child$66 = child$66.sibling); - completedWork.treeBaseDuration = treeBaseDuration$65; + (newChildLanes |= child$65.lanes | child$65.childLanes), + (subtreeFlags |= child$65.subtreeFlags & 31457280), + (subtreeFlags |= child$65.flags & 31457280), + (treeBaseDuration$64 += child$65.treeBaseDuration), + (child$65 = child$65.sibling); + completedWork.treeBaseDuration = treeBaseDuration$64; } else for ( - treeBaseDuration$65 = completedWork.child; - null !== treeBaseDuration$65; + treeBaseDuration$64 = completedWork.child; + null !== treeBaseDuration$64; ) (newChildLanes |= - treeBaseDuration$65.lanes | treeBaseDuration$65.childLanes), - (subtreeFlags |= treeBaseDuration$65.subtreeFlags & 31457280), - (subtreeFlags |= treeBaseDuration$65.flags & 31457280), - (treeBaseDuration$65.return = completedWork), - (treeBaseDuration$65 = treeBaseDuration$65.sibling); + treeBaseDuration$64.lanes | treeBaseDuration$64.childLanes), + (subtreeFlags |= treeBaseDuration$64.subtreeFlags & 31457280), + (subtreeFlags |= treeBaseDuration$64.flags & 31457280), + (treeBaseDuration$64.return = completedWork), + (treeBaseDuration$64 = treeBaseDuration$64.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$65 = completedWork.actualDuration; - child$66 = completedWork.selfBaseDuration; + treeBaseDuration$64 = completedWork.actualDuration; + child$65 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$65 += child.actualDuration), - (child$66 += child.treeBaseDuration), + (treeBaseDuration$64 += child.actualDuration), + (child$65 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$65; - completedWork.treeBaseDuration = child$66; + completedWork.actualDuration = treeBaseDuration$64; + completedWork.treeBaseDuration = child$65; } else for ( - treeBaseDuration$65 = completedWork.child; - null !== treeBaseDuration$65; + treeBaseDuration$64 = completedWork.child; + null !== treeBaseDuration$64; ) (newChildLanes |= - treeBaseDuration$65.lanes | treeBaseDuration$65.childLanes), - (subtreeFlags |= treeBaseDuration$65.subtreeFlags), - (subtreeFlags |= treeBaseDuration$65.flags), - (treeBaseDuration$65.return = completedWork), - (treeBaseDuration$65 = treeBaseDuration$65.sibling); + treeBaseDuration$64.lanes | treeBaseDuration$64.childLanes), + (subtreeFlags |= treeBaseDuration$64.subtreeFlags), + (subtreeFlags |= treeBaseDuration$64.flags), + (treeBaseDuration$64.return = completedWork), + (treeBaseDuration$64 = treeBaseDuration$64.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -5867,11 +5821,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (index = newProps.alternate.memoizedState.cachePool.pool); - var cache$73 = null; + var cache$72 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$73 = newProps.memoizedState.cachePool.pool); - cache$73 !== index && (newProps.flags |= 2048); + (cache$72 = newProps.memoizedState.cachePool.pool); + cache$72 !== index && (newProps.flags |= 2048); } renderLanes !== current && renderLanes && @@ -5903,8 +5857,8 @@ function completeWork(current, workInProgress, renderLanes) { index = workInProgress.memoizedState; if (null === index) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$73 = index.rendering; - if (null === cache$73) + cache$72 = index.rendering; + if (null === cache$72) if (newProps) cutOffTailIfNeeded(index, !1); else { if ( @@ -5912,11 +5866,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$73 = findFirstSuspended(current); - if (null !== cache$73) { + cache$72 = findFirstSuspended(current); + if (null !== cache$72) { workInProgress.flags |= 128; cutOffTailIfNeeded(index, !1); - current = cache$73.updateQueue; + current = cache$72.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -5941,7 +5895,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$73)), null !== current)) { + if (((current = findFirstSuspended(cache$72)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -5951,7 +5905,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(index, !0), null === index.tail && "hidden" === index.tailMode && - !cache$73.alternate) + !cache$72.alternate) ) return bubbleProperties(workInProgress), null; } else @@ -5963,13 +5917,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(index, !1), (workInProgress.lanes = 4194304)); index.isBackwards - ? ((cache$73.sibling = workInProgress.child), - (workInProgress.child = cache$73)) + ? ((cache$72.sibling = workInProgress.child), + (workInProgress.child = cache$72)) : ((current = index.last), null !== current - ? (current.sibling = cache$73) - : (workInProgress.child = cache$73), - (index.last = cache$73)); + ? (current.sibling = cache$72) + : (workInProgress.child = cache$72), + (index.last = cache$72)); } if (null !== index.tail) return ( @@ -6223,8 +6177,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { recordLayoutEffectDuration(current); } else ref(null); - } catch (error$89) { - captureCommitPhaseError(current, nearestMountedAncestor, error$89); + } catch (error$88) { + captureCommitPhaseError(current, nearestMountedAncestor, error$88); } else ref.current = null; } @@ -6330,10 +6284,10 @@ function commitHookEffectListMount(flags, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & flags) === flags) { - var create$90 = effect.create, + var create$89 = effect.create, inst = effect.inst; - create$90 = create$90(); - inst.destroy = create$90; + create$89 = create$89(); + inst.destroy = create$89; } effect = effect.next; } while (effect !== finishedWork); @@ -6351,8 +6305,8 @@ function commitHookLayoutEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$92) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$92); + } catch (error$91) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$91); } } function commitClassCallbacks(finishedWork) { @@ -6432,11 +6386,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { } else try { finishedRoot.componentDidMount(); - } catch (error$93) { + } catch (error$92) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$93 + error$92 ); } else { @@ -6453,11 +6407,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$94) { + } catch (error$93) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$94 + error$93 ); } recordLayoutEffectDuration(finishedWork); @@ -6468,11 +6422,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$95) { + } catch (error$94) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$95 + error$94 ); } } @@ -6859,22 +6813,22 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { startLayoutEffectTimer(), commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$104) { + } catch (error$103) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$104 + error$103 ); } recordLayoutEffectDuration(finishedWork); } else try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$105) { + } catch (error$104) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$105 + error$104 ); } } @@ -6913,8 +6867,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { finishedWork.updateQueue = null; try { (flags.type = type), (flags.props = existingHiddenCallbacks); - } catch (error$108) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$108); + } catch (error$107) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$107); } } break; @@ -6930,8 +6884,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { existingHiddenCallbacks = finishedWork.memoizedProps; try { flags.text = existingHiddenCallbacks; - } catch (error$109) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$109); + } catch (error$108) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$108); } } break; @@ -7015,11 +6969,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { wasHidden.stateNode.isHidden = existingHiddenCallbacks ? !0 : !1; - } catch (error$98) { + } catch (error$97) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$98 + error$97 ); } } else if ( @@ -7097,12 +7051,12 @@ function commitReconciliationEffects(finishedWork) { break; case 3: case 4: - var parent$99 = JSCompiler_inline_result.stateNode.containerInfo, - before$100 = getHostSibling(finishedWork); + var parent$98 = JSCompiler_inline_result.stateNode.containerInfo, + before$99 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$100, - parent$99 + before$99, + parent$98 ); break; default: @@ -7282,8 +7236,8 @@ function commitHookPassiveMountEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$113) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$113); + } catch (error$112) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$112); } } function commitOffscreenPassiveMountEffects(current, finishedWork) { @@ -7762,7 +7716,6 @@ var DefaultCacheDispatcher = { workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = 0, - workInProgressRootFatalError = null, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, workInProgressRootPingedLanes = 0, @@ -7773,8 +7726,6 @@ var DefaultCacheDispatcher = { globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, workInProgressTransitions = null, - hasUncaughtError = !1, - firstUncaughtError = null, legacyErrorBoundariesThatAlreadyFailed = null, rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = null, @@ -7882,14 +7833,11 @@ function performConcurrentWorkOnRoot(root, didTimeout) { errorRetryLanes ))); } - if (1 === didTimeout) - throw ( - ((originalCallbackNode = workInProgressRootFatalError), - prepareFreshStack(root, 0), - markRootSuspended(root, lanes, 0), - ensureRootIsScheduled(root), - originalCallbackNode) - ); + if (1 === didTimeout) { + prepareFreshStack(root, 0); + markRootSuspended(root, lanes, 0); + break; + } root.finishedWork = shouldTimeSlice; root.finishedLanes = lanes; a: { @@ -8061,6 +8009,52 @@ function markRootSuspended(root, suspendedLanes, spawnedLane) { 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } +function performSyncWorkOnRoot(root, lanes) { + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + if (flushPassiveEffects()) return ensureRootIsScheduled(root), null; + currentUpdateIsNested = nestedUpdateScheduled; + nestedUpdateScheduled = !1; + var exitStatus = renderRootSync(root, lanes); + if (0 !== root.tag && 2 === exitStatus) { + var originallyAttemptedLanes = lanes, + errorRetryLanes = getLanesToRetrySynchronouslyOnError( + root, + originallyAttemptedLanes + ); + 0 !== errorRetryLanes && + ((lanes = errorRetryLanes), + (exitStatus = recoverFromConcurrentError( + root, + originallyAttemptedLanes, + errorRetryLanes + ))); + } + if (1 === exitStatus) + return ( + prepareFreshStack(root, 0), + markRootSuspended(root, lanes, 0), + ensureRootIsScheduled(root), + null + ); + if (6 === exitStatus) + return ( + markRootSuspended(root, lanes, workInProgressDeferredLane), + ensureRootIsScheduled(root), + null + ); + root.finishedWork = root.current.alternate; + root.finishedLanes = lanes; + commitRoot( + root, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + workInProgressDeferredLane + ); + ensureRootIsScheduled(root); + return null; +} function flushSync(fn) { null !== rootWithPendingPassiveEffects && 0 === rootWithPendingPassiveEffects.tag && @@ -8117,12 +8111,11 @@ function prepareFreshStack(root, lanes) { workInProgressSuspendedReason = 0; workInProgressThrownValue = null; workInProgressRootDidAttachPingListener = !1; - workInProgressRootExitStatus = 0; - workInProgressRootFatalError = null; workInProgressDeferredLane = workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = + workInProgressRootExitStatus = 0; workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null; @@ -8148,39 +8141,43 @@ function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; ReactCurrentOwner.current = null; - thrownValue === SuspenseException - ? ((thrownValue = getSuspendedThenable()), - (root = suspenseHandlerStackCursor.current), - (workInProgressSuspendedReason = - (null !== root && - ((workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null !== shellBoundary - : ((workInProgressRootRenderLanes & 62914560) !== - workInProgressRootRenderLanes && - 0 === (workInProgressRootRenderLanes & 536870912)) || - root !== shellBoundary)) || - 0 !== (workInProgressRootSkippedLanes & 134217727) || - 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 3 - : 2)) - : thrownValue === SuspenseyCommitException - ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = 4)) - : (workInProgressSuspendedReason = - thrownValue === SelectiveHydrationException - ? 8 - : null !== thrownValue && - "object" === typeof thrownValue && - "function" === typeof thrownValue.then - ? 6 - : 1); + if (thrownValue === SuspenseException) { + thrownValue = getSuspendedThenable(); + var handler = suspenseHandlerStackCursor.current; + workInProgressSuspendedReason = + (null !== handler && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + handler !== shellBoundary)) || + 0 !== (workInProgressRootSkippedLanes & 134217727) || + 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) + ? 3 + : 2; + } else + thrownValue === SuspenseyCommitException + ? ((thrownValue = getSuspendedThenable()), + (workInProgressSuspendedReason = 4)) + : (workInProgressSuspendedReason = + thrownValue === SelectiveHydrationException + ? 8 + : null !== thrownValue && + "object" === typeof thrownValue && + "function" === typeof thrownValue.then + ? 6 + : 1); workInProgressThrownValue = thrownValue; - root = workInProgress; - null === root + handler = workInProgress; + null === handler ? ((workInProgressRootExitStatus = 1), - (workInProgressRootFatalError = thrownValue)) - : root.mode & 2 && stopProfilerTimerIfRunningAndRecordDelta(root, !0); + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + )) + : handler.mode & 2 && stopProfilerTimerIfRunningAndRecordDelta(handler, !0); } function pushDispatcher() { var prevDispatcher = ReactCurrentDispatcher.current; @@ -8234,8 +8231,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$118) { - handleThrow(root, thrownValue$118); + } catch (thrownValue$117) { + handleThrow(root, thrownValue$117); } while (1); lanes && root.shellSuspendCounter++; @@ -8343,8 +8340,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$120) { - handleThrow(root, thrownValue$120); + } catch (thrownValue$119) { + handleThrow(root, thrownValue$119); } while (1); resetContextDependencies(); @@ -8450,14 +8447,20 @@ function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { ) ) { workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); workInProgress = null; return; } } catch (error) { if (null !== returnFiber) throw ((workInProgress = returnFiber), error); workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); workInProgress = null; return; } @@ -8620,13 +8623,6 @@ function commitRootImpl( componentStack: remainingLanes.stack }), renderPriorityLevel(remainingLanes.value, transitions); - if (hasUncaughtError) - throw ( - ((hasUncaughtError = !1), - (root = firstUncaughtError), - (firstUncaughtError = null), - root) - ); 0 !== (pendingPassiveEffectsLanes & 3) && 0 !== root.tag && flushPassiveEffects(); @@ -8690,11 +8686,11 @@ function flushPassiveEffects() { _finishedWork$memoize = finishedWork.memoizedProps, id = _finishedWork$memoize.id, onPostCommit = _finishedWork$memoize.onPostCommit, - commitTime$91 = commitTime, + commitTime$90 = commitTime, phase = null === finishedWork.alternate ? "mount" : "update"; currentUpdateIsNested && (phase = "nested-update"); "function" === typeof onPostCommit && - onPostCommit(id, phase, passiveEffectDuration, commitTime$91); + onPostCommit(id, phase, passiveEffectDuration, commitTime$90); var parentFiber = finishedWork.return; b: for (; null !== parentFiber; ) { switch (parentFiber.tag) { @@ -9577,19 +9573,19 @@ function wrapFiber(fiber) { fiberToWrapper.set(fiber, wrapper)); return wrapper; } -var devToolsConfig$jscomp$inline_1061 = { +var devToolsConfig$jscomp$inline_1052 = { findFiberByHostInstance: function () { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "19.0.0-canary-1f27a620", + version: "19.0.0-canary-616c31a4", rendererPackageName: "react-test-renderer" }; -var internals$jscomp$inline_1250 = { - bundleType: devToolsConfig$jscomp$inline_1061.bundleType, - version: devToolsConfig$jscomp$inline_1061.version, - rendererPackageName: devToolsConfig$jscomp$inline_1061.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1061.rendererConfig, +var internals$jscomp$inline_1238 = { + bundleType: devToolsConfig$jscomp$inline_1052.bundleType, + version: devToolsConfig$jscomp$inline_1052.version, + rendererPackageName: devToolsConfig$jscomp$inline_1052.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1052.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -9606,26 +9602,26 @@ var internals$jscomp$inline_1250 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1061.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1052.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-1f27a620" + reconcilerVersion: "19.0.0-canary-616c31a4" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1251 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1239 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1251.isDisabled && - hook$jscomp$inline_1251.supportsFiber + !hook$jscomp$inline_1239.isDisabled && + hook$jscomp$inline_1239.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1251.inject( - internals$jscomp$inline_1250 + (rendererID = hook$jscomp$inline_1239.inject( + internals$jscomp$inline_1238 )), - (injectedHook = hook$jscomp$inline_1251); + (injectedHook = hook$jscomp$inline_1239); } 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 5046987e892a3..e9c62101d9376 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 @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<389738660a4f2ab62588a2951e5a2988>> + * @generated SignedSource<> */ "use strict"; @@ -26,7 +26,7 @@ if (__DEV__) { } var dynamicFlagsUntyped = require("ReactNativeInternalFeatureFlags"); - var ReactVersion = "19.0.0-canary-4322682e"; + var ReactVersion = "19.0.0-canary-66632b76"; // ATTENTION // When adding new symbols to this file, @@ -100,7 +100,9 @@ if (__DEV__) { // Tracks whether something called `use` during the current batch of work. // Determines whether we should yield to microtasks to unwrap already resolved // promises without suspending. - didUsePromise: false + didUsePromise: false, + // Track first uncaught error within this act + thrownErrors: [] }; /** @@ -3133,6 +3135,45 @@ if (__DEV__) { } } + var reportGlobalError = + typeof reportError === "function" // In modern browsers, reportError will dispatch an error event, + ? // emulating an uncaught JavaScript error. + reportError + : function (error) { + if ( + typeof window === "object" && + typeof window.ErrorEvent === "function" + ) { + // Browser Polyfill + var message = + typeof error === "object" && + error !== null && + typeof error.message === "string" // eslint-disable-next-line react-internal/safe-string-coercion + ? String(error.message) // eslint-disable-next-line react-internal/safe-string-coercion + : String(error); + var event = new window.ErrorEvent("error", { + bubbles: true, + cancelable: true, + message: message, + error: error + }); + var shouldLog = window.dispatchEvent(event); + + if (!shouldLog) { + return; + } + } else if ( + typeof process === "object" && // $FlowFixMe[method-unbinding] + typeof process.emit === "function" + ) { + // Node Polyfill + process.emit("uncaughtException", error); + return; + } // eslint-disable-next-line react-internal/no-production-logging + + console["error"](error); + }; + function startTransition(scope, options) { var prevTransition = ReactCurrentBatchConfig.transition; // Each renderer registers a callback to receive the return value of // the scope function. This is used to implement async actions. @@ -3160,10 +3201,10 @@ if (__DEV__) { callbacks.forEach(function (callback) { return callback(currentTransition, returnValue); }); - returnValue.then(noop, onError); + returnValue.then(noop, reportGlobalError); } } catch (error) { - onError(error); + reportGlobalError(error); } finally { warnAboutTransitionSubscriptions(prevTransition, currentTransition); ReactCurrentBatchConfig.transition = prevTransition; @@ -3201,18 +3242,7 @@ if (__DEV__) { } } - function noop() {} // Use reportError, if it exists. Otherwise console.error. This is the same as - // the default for onRecoverableError. - - var onError = - typeof reportError === "function" // In modern browsers, reportError will dispatch an error event, - ? // emulating an uncaught JavaScript error. - reportError - : function (error) { - // In older browsers and test environments, fallback to console.error. - // eslint-disable-next-line react-internal/no-production-logging - console["error"](error); - }; + function noop() {} var didWarnAboutMessageChannel = false; var enqueueTaskImpl = null; @@ -3261,6 +3291,16 @@ if (__DEV__) { var actScopeDepth = 0; // We only warn the first time you neglect to await an async `act` scope. var didWarnNoAwaitAct = false; + + function aggregateErrors(errors) { + if (errors.length > 1 && typeof AggregateError === "function") { + // eslint-disable-next-line no-undef + return new AggregateError(errors); + } + + return errors[0]; + } + function act(callback) { { // When ReactCurrentActQueue.current is not null, it signals to React that @@ -3312,9 +3352,15 @@ if (__DEV__) { // one used to track `act` scopes. Why, you may be wondering? Because // that's how it worked before version 18. Yes, it's confusing! We should // delete legacy mode!! + ReactCurrentActQueue.thrownErrors.push(error); + } + + if (ReactCurrentActQueue.thrownErrors.length > 0) { ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy; popActScope(prevActQueue, prevActScopeDepth); - throw error; + var thrownError = aggregateErrors(ReactCurrentActQueue.thrownErrors); + ReactCurrentActQueue.thrownErrors.length = 0; + throw thrownError; } if ( @@ -3369,7 +3415,16 @@ if (__DEV__) { // `thenable` might not be a real promise, and `flushActQueue` // might throw, so we need to wrap `flushActQueue` in a // try/catch. - reject(error); + ReactCurrentActQueue.thrownErrors.push(error); + } + + if (ReactCurrentActQueue.thrownErrors.length > 0) { + var _thrownError = aggregateErrors( + ReactCurrentActQueue.thrownErrors + ); + + ReactCurrentActQueue.thrownErrors.length = 0; + reject(_thrownError); } } else { resolve(returnValue); @@ -3377,7 +3432,17 @@ if (__DEV__) { }, function (error) { popActScope(prevActQueue, prevActScopeDepth); - reject(error); + + if (ReactCurrentActQueue.thrownErrors.length > 0) { + var _thrownError2 = aggregateErrors( + ReactCurrentActQueue.thrownErrors + ); + + ReactCurrentActQueue.thrownErrors.length = 0; + reject(_thrownError2); + } else { + reject(error); + } } ); } @@ -3430,6 +3495,15 @@ if (__DEV__) { ReactCurrentActQueue.current = null; } + if (ReactCurrentActQueue.thrownErrors.length > 0) { + var _thrownError3 = aggregateErrors( + ReactCurrentActQueue.thrownErrors + ); + + ReactCurrentActQueue.thrownErrors.length = 0; + throw _thrownError3; + } + return { then: function (resolve, reject) { didAwaitActCall = true; @@ -3486,15 +3560,21 @@ if (__DEV__) { reject ); }); + return; } catch (error) { // Leave remaining tasks on the queue if something throws. - reject(error); + ReactCurrentActQueue.thrownErrors.push(error); } } else { // The queue is empty. We can finish. ReactCurrentActQueue.current = null; - resolve(returnValue); } + } + + if (ReactCurrentActQueue.thrownErrors.length > 0) { + var thrownError = aggregateErrors(ReactCurrentActQueue.thrownErrors); + ReactCurrentActQueue.thrownErrors.length = 0; + reject(thrownError); } else { resolve(returnValue); } @@ -3539,7 +3619,7 @@ if (__DEV__) { } catch (error) { // If something throws, leave the remaining callbacks on the queue. queue.splice(0, i + 1); - throw error; + ReactCurrentActQueue.thrownErrors.push(error); } finally { isFlushing = false; } 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 7966680072d50..8a93e574c908c 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 @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "use strict"; @@ -372,13 +372,36 @@ function lazyInitializer(payload) { if (1 === payload._status) return payload._result.default; throw payload._result; } -function noop() {} -var onError = +var reportGlobalError = "function" === typeof reportError ? reportError : function (error) { + if ( + "object" === typeof window && + "function" === typeof window.ErrorEvent + ) { + var event = new window.ErrorEvent("error", { + bubbles: !0, + cancelable: !0, + message: + "object" === typeof error && + null !== error && + "string" === typeof error.message + ? String(error.message) + : String(error), + error: error + }); + if (!window.dispatchEvent(event)) return; + } else if ( + "object" === typeof process && + "function" === typeof process.emit + ) { + process.emit("uncaughtException", error); + return; + } console.error(error); }; +function noop() {} exports.Children = { map: mapChildren, forEach: function (children, forEachFunc, forEachContext) { @@ -532,9 +555,9 @@ exports.startTransition = function (scope) { (callbacks.forEach(function (callback) { return callback(currentTransition, returnValue); }), - returnValue.then(noop, onError)); + returnValue.then(noop, reportGlobalError)); } catch (error) { - onError(error); + reportGlobalError(error); } finally { ReactCurrentBatchConfig.transition = prevTransition; } @@ -640,4 +663,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "19.0.0-canary-b3b89a7e"; +exports.version = "19.0.0-canary-bd294150"; 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 0106917b74cb3..ac31360b4e279 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 @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<111d124bf374c5bbae728fb7f4d17857>> + * @generated SignedSource<<50a5378f60ee29fee7964f02f5243965>> */ "use strict"; @@ -339,13 +339,36 @@ function lazyInitializer(payload) { if (1 === payload._status) return payload._result.default; throw payload._result; } -function noop() {} -var onError = +var reportGlobalError = "function" === typeof reportError ? reportError : function (error) { + if ( + "object" === typeof window && + "function" === typeof window.ErrorEvent + ) { + var event = new window.ErrorEvent("error", { + bubbles: !0, + cancelable: !0, + message: + "object" === typeof error && + null !== error && + "string" === typeof error.message + ? String(error.message) + : String(error), + error: error + }); + if (!window.dispatchEvent(event)) return; + } else if ( + "object" === typeof process && + "function" === typeof process.emit + ) { + process.emit("uncaughtException", error); + return; + } console.error(error); }; +function noop() {} exports.Children = { map: mapChildren, forEach: function (children, forEachFunc, forEachContext) { @@ -529,9 +552,9 @@ exports.startTransition = function (scope) { (callbacks.forEach(function (callback) { return callback(currentTransition, returnValue); }), - returnValue.then(noop, onError)); + returnValue.then(noop, reportGlobalError)); } catch (error) { - onError(error); + reportGlobalError(error); } finally { ReactCurrentBatchConfig.transition = prevTransition; } @@ -636,7 +659,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "19.0.0-canary-4b9ba4bc"; +exports.version = "19.0.0-canary-5f0b765f"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && 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 a8a00743cbb02..66772c12329bb 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 @@ -2ec2aaea98588178525f83495669e11e96815a00 +6786563f3cbbc9b16d5a8187207b5bd904386e53 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 454236cf062a8..8e0b780f8bfd9 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<<568017e8e24b2dea5b43ded8a0a3558c>> + * @generated SignedSource<> */ "use strict"; @@ -7116,7 +7116,7 @@ to return true:wantsResponderID| | } } - var ReactCurrentActQueue$3 = ReactSharedInternals.ReactCurrentActQueue; // A linked list of all the roots with pending work. In an idiomatic app, + var ReactCurrentActQueue$4 = ReactSharedInternals.ReactCurrentActQueue; // A linked list of all the roots with pending work. In an idiomatic app, // there's only a single root, but we do support multi root apps, hence this // extra complexity. But this module is optimized for the single root case. @@ -7155,7 +7155,7 @@ to return true:wantsResponderID| | mightHavePendingSyncWork = true; // At the end of the current event, go through each of the roots and ensure // there's a task scheduled for each one at the correct priority. - if (ReactCurrentActQueue$3.current !== null) { + if (ReactCurrentActQueue$4.current !== null) { // We're inside an `act` scope. if (!didScheduleMicrotask_act) { didScheduleMicrotask_act = true; @@ -7176,9 +7176,9 @@ to return true:wantsResponderID| | scheduleTaskForRootDuringMicrotask(root, now$1()); } - if (ReactCurrentActQueue$3.isBatchingLegacy && root.tag === LegacyRoot) { + if (ReactCurrentActQueue$4.isBatchingLegacy && root.tag === LegacyRoot) { // Special `act` case: Record whenever a legacy update is scheduled. - ReactCurrentActQueue$3.didScheduleLegacyUpdate = true; + ReactCurrentActQueue$4.didScheduleLegacyUpdate = true; } } function flushSyncWorkOnAllRoots() { @@ -7206,7 +7206,6 @@ to return true:wantsResponderID| | } // There may or may not be synchronous work scheduled. Let's check. var didPerformSomeWork; - var errors = null; isFlushingWork = true; do { @@ -7228,17 +7227,8 @@ to return true:wantsResponderID| | if (includesSyncLane(nextLanes)) { // This root has pending sync work. Flush it now. - try { - didPerformSomeWork = true; - performSyncWorkOnRoot(root, nextLanes); - } catch (error) { - // Collect errors so we can rethrow them at the end - if (errors === null) { - errors = [error]; - } else { - errors.push(error); - } - } + didPerformSomeWork = true; + performSyncWorkOnRoot(root, nextLanes); } } @@ -7246,32 +7236,7 @@ to return true:wantsResponderID| | } } while (didPerformSomeWork); - isFlushingWork = false; // If any errors were thrown, rethrow them right before exiting. - // TODO: Consider returning these to the caller, to allow them to decide - // how/when to rethrow. - - if (errors !== null) { - if (errors.length > 1) { - if (typeof AggregateError === "function") { - // eslint-disable-next-line no-undef - throw new AggregateError(errors); - } else { - for (var i = 1; i < errors.length; i++) { - scheduleImmediateTask(throwError.bind(null, errors[i])); - } - - var firstError = errors[0]; - throw firstError; - } - } else { - var error = errors[0]; - throw error; - } - } - } - - function throwError(error) { - throw error; + isFlushingWork = false; } function processRootScheduleInMicrotask() { @@ -7402,7 +7367,7 @@ to return true:wantsResponderID| | // Scheduler task, rather than an `act` task, cancel it and re-schedule // on the `act` queue. !( - ReactCurrentActQueue$3.current !== null && + ReactCurrentActQueue$4.current !== null && existingCallbackNode !== fakeActCallbackNode$1 ) ) { @@ -7469,11 +7434,11 @@ to return true:wantsResponderID| | var fakeActCallbackNode$1 = {}; function scheduleCallback$2(priorityLevel, callback) { - if (ReactCurrentActQueue$3.current !== null) { + if (ReactCurrentActQueue$4.current !== null) { // Special case: We're inside an `act` scope (a testing utility). // Instead of scheduling work in the host environment, add it to a // fake internal queue that's managed by the `act` implementation. - ReactCurrentActQueue$3.current.push(callback); + ReactCurrentActQueue$4.current.push(callback); return fakeActCallbackNode$1; } else { return scheduleCallback$3(priorityLevel, callback); @@ -7488,13 +7453,13 @@ to return true:wantsResponderID| | } function scheduleImmediateTask(cb) { - if (ReactCurrentActQueue$3.current !== null) { + if (ReactCurrentActQueue$4.current !== null) { // Special case: Inside an `act` scope, we push microtasks to the fake `act` // callback queue. This is because we currently support calling `act` // without awaiting the result. The plan is to deprecate that, and require // that you always await the result so that the microtasks have a chance to // run. But it hasn't happened yet. - ReactCurrentActQueue$3.current.push(function () { + ReactCurrentActQueue$4.current.push(function () { cb(); return null; }); @@ -9200,7 +9165,7 @@ to return true:wantsResponderID| | } } - var ReactCurrentActQueue$2 = ReactSharedInternals.ReactCurrentActQueue; + var ReactCurrentActQueue$3 = ReactSharedInternals.ReactCurrentActQueue; function getThenablesFromState(state) { { @@ -9255,8 +9220,8 @@ to return true:wantsResponderID| | function noop() {} function trackUsedThenable(thenableState, thenable, index) { - if (ReactCurrentActQueue$2.current !== null) { - ReactCurrentActQueue$2.didUsePromise = true; + if (ReactCurrentActQueue$3.current !== null) { + ReactCurrentActQueue$3.didUsePromise = true; } var trackedThenables = getThenablesFromState(thenableState); @@ -16886,6 +16851,46 @@ to return true:wantsResponderID| | ); } + var reportGlobalError = + typeof reportError === "function" // In modern browsers, reportError will dispatch an error event, + ? // emulating an uncaught JavaScript error. + reportError + : function (error) { + if ( + typeof window === "object" && + typeof window.ErrorEvent === "function" + ) { + // Browser Polyfill + var message = + typeof error === "object" && + error !== null && + typeof error.message === "string" // eslint-disable-next-line react-internal/safe-string-coercion + ? String(error.message) // eslint-disable-next-line react-internal/safe-string-coercion + : String(error); + var event = new window.ErrorEvent("error", { + bubbles: true, + cancelable: true, + message: message, + error: error + }); + var shouldLog = window.dispatchEvent(event); + + if (!shouldLog) { + return; + } + } else if ( + typeof process === "object" && // $FlowFixMe[method-unbinding] + typeof process.emit === "function" + ) { + // Node Polyfill + process.emit("uncaughtException", error); + return; + } // eslint-disable-next-line react-internal/no-production-logging + + console["error"](error); + }; + + var ReactCurrentActQueue$2 = ReactSharedInternals.ReactCurrentActQueue; function logCapturedError(boundary, errorInfo) { try { var logError = showErrorDialog(boundary, errorInfo); // Allow injected showErrorDialog() to prevent default console.error logging. @@ -16897,43 +16902,73 @@ to return true:wantsResponderID| | var error = errorInfo.value; - if (true) { - var source = errorInfo.source; - var stack = errorInfo.stack; - var componentStack = stack !== null ? stack : ""; // TODO: There's no longer a way to silence these warnings e.g. for tests. - // See https://github.com/facebook/react/pull/13384 - - var componentName = source ? getComponentNameFromFiber(source) : null; - var componentNameMessage = componentName - ? "The above error occurred in the <" + - componentName + - "> component:" - : "The above error occurred in one of your React components:"; - var errorBoundaryMessage; - - if (boundary.tag === HostRoot) { - errorBoundaryMessage = + if (boundary.tag === HostRoot) { + if (true && ReactCurrentActQueue$2.current !== null) { + // For uncaught errors inside act, we track them on the act and then + // rethrow them into the test. + ReactCurrentActQueue$2.thrownErrors.push(error); + return; + } // For uncaught root errors we report them as uncaught to the browser's + // onerror callback. This won't have component stacks and the error addendum. + // So we add those into a separate console.warn. + + reportGlobalError(error); + + if (true) { + var source = errorInfo.source; + var stack = errorInfo.stack; + var componentStack = stack !== null ? stack : ""; // TODO: There's no longer a way to silence these warnings e.g. for tests. + // See https://github.com/facebook/react/pull/13384 + + var componentName = source + ? getComponentNameFromFiber(source) + : null; + var componentNameMessage = componentName + ? "An error occurred in the <" + componentName + "> component:" + : "An error occurred in one of your React components:"; + console["warn"]( + "%s\n%s\n\n%s", + componentNameMessage, + componentStack, "Consider adding an error boundary to your tree to customize error handling behavior.\n" + - "Visit https://react.dev/link/error-boundaries to learn more about error boundaries."; - } else { - var errorBoundaryName = - getComponentNameFromFiber(boundary) || "Anonymous"; - errorBoundaryMessage = - "React will try to recreate this component tree from scratch " + - ("using the error boundary you provided, " + - errorBoundaryName + - "."); - } // In development, we provide our own message which includes the component stack - // in addition to the error. + "Visit https://react.dev/link/error-boundaries to learn more about error boundaries." + ); + } + } else { + // Caught by error boundary + if (true) { + var _source = errorInfo.source; + var _stack = errorInfo.stack; + + var _componentStack = _stack !== null ? _stack : ""; // TODO: There's no longer a way to silence these warnings e.g. for tests. + // See https://github.com/facebook/react/pull/13384 - console["error"]( + var _componentName = _source + ? getComponentNameFromFiber(_source) + : null; + + var _componentNameMessage = _componentName + ? "The above error occurred in the <" + + _componentName + + "> component:" + : "The above error occurred in one of your React components:"; + + var errorBoundaryName = + getComponentNameFromFiber(boundary) || "Anonymous"; // In development, we provide our own message which includes the component stack + // in addition to the error. // Don't transform to our wrapper - "%o\n\n%s\n%s\n\n%s", - error, - componentNameMessage, - componentStack, - errorBoundaryMessage - ); + + console["error"]( + "%o\n\n%s\n%s\n\n%s", + error, + _componentNameMessage, + _componentStack, + "React will try to recreate this component tree from scratch " + + ("using the error boundary you provided, " + + errorBoundaryName + + ".") + ); + } } } catch (e) { // This method must not throw, or React internal state will get messed up. @@ -16955,10 +16990,8 @@ to return true:wantsResponderID| | update.payload = { element: null }; - var error = errorInfo.value; update.callback = function () { - onUncaughtError(error); logCapturedError(fiber, errorInfo); }; @@ -26099,9 +26132,7 @@ to return true:wantsResponderID| | var entangledRenderLanes = NoLanes; // Whether to root completed, errored, suspended, etc. - var workInProgressRootExitStatus = RootInProgress; // A fatal error, if one is thrown - - var workInProgressRootFatalError = null; // The work left over by components that were visited during this render. Only + var workInProgressRootExitStatus = RootInProgress; // The work left over by components that were visited during this render. Only // includes unprocessed updates, not work in bailed out children. var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an interleaved event) during this render. @@ -26143,8 +26174,6 @@ to return true:wantsResponderID| | function getRenderTargetTime() { return workInProgressRootRenderTargetTime; } - var hasUncaughtError = false; - var firstUncaughtError = null; var legacyErrorBoundariesThatAlreadyFailed = null; var rootDoesHavePassiveEffects = false; var rootWithPendingPassiveEffects = null; @@ -26493,11 +26522,9 @@ to return true:wantsResponderID| | } if (exitStatus === RootFatalErrored) { - var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); markRootSuspended(root, lanes, NoLane); - ensureRootIsScheduled(root); - throw fatalError; + break; } // We now have a consistent tree. The next step is either to commit it, // or, if something suspended, wait to commit it after a timeout. @@ -26889,11 +26916,10 @@ to return true:wantsResponderID| | } if (exitStatus === RootFatalErrored) { - var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); - throw fatalError; + return null; } if (exitStatus === RootDidNotComplete) { @@ -27052,7 +27078,6 @@ to return true:wantsResponderID| | workInProgressThrownValue = null; workInProgressRootDidAttachPingListener = false; workInProgressRootExitStatus = RootInProgress; - workInProgressRootFatalError = null; workInProgressRootSkippedLanes = NoLanes; workInProgressRootInterleavedUpdatedLanes = NoLanes; workInProgressRootPingedLanes = NoLanes; @@ -27155,7 +27180,10 @@ to return true:wantsResponderID| | if (erroredWork === null) { // This is a fatal error workInProgressRootExitStatus = RootFatalErrored; - workInProgressRootFatalError = thrownValue; + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); return; } @@ -27914,7 +27942,7 @@ to return true:wantsResponderID| | ); if (didFatal) { - panicOnRootError(thrownValue); + panicOnRootError(root, thrownValue); return; } } catch (error) { @@ -27926,7 +27954,7 @@ to return true:wantsResponderID| | workInProgress = returnFiber; throw error; } else { - panicOnRootError(thrownValue); + panicOnRootError(root, thrownValue); return; } } @@ -27948,13 +27976,16 @@ to return true:wantsResponderID| | } } - function panicOnRootError(error) { + function panicOnRootError(root, error) { // There's no ancestor that can handle this exception. This should never // happen because the root is supposed to capture all errors that weren't // caught by an error boundary. This is a fatal error, or panic condition, // because we've run out of ways to recover. workInProgressRootExitStatus = RootFatalErrored; - workInProgressRootFatalError = error; // Set `workInProgress` to null. This represents advancing to the next + logCapturedError( + root.current, + createCapturedValueAtFiber(error, root.current) + ); // Set `workInProgress` to null. This represents advancing to the next // sibling, or the parent if there are no siblings. But since the root // has no siblings nor a parent, we set it to null. Usually this is // handled by `completeUnitOfWork` or `unwindWork`, but since we're @@ -28369,13 +28400,6 @@ to return true:wantsResponderID| | ); onRecoverableError(recoverableError.value, errorInfo); } - } - - if (hasUncaughtError) { - hasUncaughtError = false; - var error$1 = firstUncaughtError; - firstUncaughtError = null; - throw error$1; } // If the passive effects are the result of a discrete render, flush them // synchronously at the end of the current task so that the result is // immediately observable. Otherwise, we assume that they are not @@ -28620,15 +28644,6 @@ to return true:wantsResponderID| | } } - function prepareToThrowUncaughtError(error) { - if (!hasUncaughtError) { - hasUncaughtError = true; - firstUncaughtError = error; - } - } - - var onUncaughtError = prepareToThrowUncaughtError; - function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { var errorInfo = createCapturedValueAtFiber(error, sourceFiber); var update = createRootErrorUpdate(rootFiber, errorInfo, SyncLane); @@ -30522,7 +30537,7 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "19.0.0-canary-4c904091"; + var ReactVersion = "19.0.0-canary-03795b47"; 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 fc11a6013d13d..27a8e0023af62 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<<2f9f76dba92f0b9810618046d106e3f7>> + * @generated SignedSource<<372bfe47b8470c856b9d18cd09af1e2d>> */ "use strict"; @@ -893,7 +893,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_248 = { +var injectedNamesToPlugins$jscomp$inline_247 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -939,32 +939,32 @@ var injectedNamesToPlugins$jscomp$inline_248 = { } } }, - isOrderingDirty$jscomp$inline_249 = !1, - pluginName$jscomp$inline_250; -for (pluginName$jscomp$inline_250 in injectedNamesToPlugins$jscomp$inline_248) + isOrderingDirty$jscomp$inline_248 = !1, + pluginName$jscomp$inline_249; +for (pluginName$jscomp$inline_249 in injectedNamesToPlugins$jscomp$inline_247) if ( - injectedNamesToPlugins$jscomp$inline_248.hasOwnProperty( - pluginName$jscomp$inline_250 + injectedNamesToPlugins$jscomp$inline_247.hasOwnProperty( + pluginName$jscomp$inline_249 ) ) { - var pluginModule$jscomp$inline_251 = - injectedNamesToPlugins$jscomp$inline_248[pluginName$jscomp$inline_250]; + var pluginModule$jscomp$inline_250 = + injectedNamesToPlugins$jscomp$inline_247[pluginName$jscomp$inline_249]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_250) || - namesToPlugins[pluginName$jscomp$inline_250] !== - pluginModule$jscomp$inline_251 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_249) || + namesToPlugins[pluginName$jscomp$inline_249] !== + pluginModule$jscomp$inline_250 ) { - if (namesToPlugins[pluginName$jscomp$inline_250]) + if (namesToPlugins[pluginName$jscomp$inline_249]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_250 + "`.") + (pluginName$jscomp$inline_249 + "`.") ); - namesToPlugins[pluginName$jscomp$inline_250] = - pluginModule$jscomp$inline_251; - isOrderingDirty$jscomp$inline_249 = !0; + namesToPlugins[pluginName$jscomp$inline_249] = + pluginModule$jscomp$inline_250; + isOrderingDirty$jscomp$inline_248 = !0; } } -isOrderingDirty$jscomp$inline_249 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_248 && recomputePluginOrdering(); var emptyObject$1 = {}, removedKeys = null, removedKeyCount = 0, @@ -2148,98 +2148,26 @@ function ensureRootIsScheduled(root) { } function flushSyncWorkAcrossRoots_impl(onlyLegacy) { if (!isFlushingWork && mightHavePendingSyncWork) { - var errors = null; isFlushingWork = !0; do { var didPerformSomeWork = !1; for (var root = firstScheduledRoot; null !== root; ) { if (!onlyLegacy || 0 === root.tag) { - var workInProgressRootRenderLanes$10 = workInProgressRootRenderLanes, - nextLanes = getNextLanes( - root, - root === workInProgressRoot ? workInProgressRootRenderLanes$10 : 0 - ); - if (0 !== (nextLanes & 3)) - try { - didPerformSomeWork = !0; - workInProgressRootRenderLanes$10 = root; - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - if (!flushPassiveEffects()) { - var exitStatus = renderRootSync( - workInProgressRootRenderLanes$10, - nextLanes - ); - if ( - 0 !== workInProgressRootRenderLanes$10.tag && - 2 === exitStatus - ) { - var originallyAttemptedLanes = nextLanes, - errorRetryLanes = getLanesToRetrySynchronouslyOnError( - workInProgressRootRenderLanes$10, - originallyAttemptedLanes - ); - 0 !== errorRetryLanes && - ((nextLanes = errorRetryLanes), - (exitStatus = recoverFromConcurrentError( - workInProgressRootRenderLanes$10, - originallyAttemptedLanes, - errorRetryLanes - ))); - } - if (1 === exitStatus) - throw ( - ((originallyAttemptedLanes = workInProgressRootFatalError), - prepareFreshStack(workInProgressRootRenderLanes$10, 0), - markRootSuspended( - workInProgressRootRenderLanes$10, - nextLanes, - 0 - ), - ensureRootIsScheduled(workInProgressRootRenderLanes$10), - originallyAttemptedLanes) - ); - 6 === exitStatus - ? markRootSuspended( - workInProgressRootRenderLanes$10, - nextLanes, - workInProgressDeferredLane - ) - : ((workInProgressRootRenderLanes$10.finishedWork = - workInProgressRootRenderLanes$10.current.alternate), - (workInProgressRootRenderLanes$10.finishedLanes = - nextLanes), - commitRoot( - workInProgressRootRenderLanes$10, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - workInProgressDeferredLane - )); - } - ensureRootIsScheduled(workInProgressRootRenderLanes$10); - } catch (error) { - null === errors ? (errors = [error]) : errors.push(error); - } + var workInProgressRootRenderLanes$10 = workInProgressRootRenderLanes; + workInProgressRootRenderLanes$10 = getNextLanes( + root, + root === workInProgressRoot ? workInProgressRootRenderLanes$10 : 0 + ); + 0 !== (workInProgressRootRenderLanes$10 & 3) && + ((didPerformSomeWork = !0), + performSyncWorkOnRoot(root, workInProgressRootRenderLanes$10)); } root = root.next; } } while (didPerformSomeWork); isFlushingWork = !1; - if (null !== errors) { - if (1 < errors.length) { - if ("function" === typeof AggregateError) - throw new AggregateError(errors); - for (onlyLegacy = 1; onlyLegacy < errors.length; onlyLegacy++) - scheduleImmediateTask(throwError.bind(null, errors[onlyLegacy])); - } - throw errors[0]; - } } } -function throwError(error) { - throw error; -} function processRootScheduleInMicrotask() { mightHavePendingSyncWork = didScheduleMicrotask = !1; for ( @@ -2717,16 +2645,16 @@ function describeNativeComponentFrame(fn, construct) { } else { try { Fake.call(); - } catch (x$16) { - control = x$16; + } catch (x$15) { + control = x$15; } fn.call(Fake.prototype); } } else { try { throw Error(); - } catch (x$17) { - control = x$17; + } catch (x$16) { + control = x$16; } (Fake = fn()) && "function" === typeof Fake.catch && @@ -4027,7 +3955,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$31 = !1; + didReadFromEntangledAsyncAction$30 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -4040,7 +3968,7 @@ function updateReducerImpl(hook, current, reducer) { if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$31 = !0); + (didReadFromEntangledAsyncAction$30 = !0); continue; } else (updateLane = { @@ -4069,7 +3997,7 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$31 = !0); + (didReadFromEntangledAsyncAction$30 = !0); updateLane = update.action; shouldDoubleInvokeUserFnsInHooksDEV && reducer(pendingQueue, updateLane); @@ -4099,7 +4027,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$31 && + didReadFromEntangledAsyncAction$30 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -5175,15 +5103,49 @@ if ( throw Error( "Expected ReactFiberErrorDialog.showErrorDialog to be a function." ); +var reportGlobalError = + "function" === typeof reportError + ? reportError + : function (error) { + if ( + "object" === typeof window && + "function" === typeof window.ErrorEvent + ) { + var event = new window.ErrorEvent("error", { + bubbles: !0, + cancelable: !0, + message: + "object" === typeof error && + null !== error && + "string" === typeof error.message + ? String(error.message) + : String(error), + error: error + }); + if (!window.dispatchEvent(event)) return; + } else if ( + "object" === typeof process && + "function" === typeof process.emit + ) { + process.emit("uncaughtException", error); + return; + } + console.error(error); + }; function logCapturedError(boundary, errorInfo) { try { - !1 !== + if ( + !1 !== ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog({ componentStack: null !== errorInfo.stack ? errorInfo.stack : "", error: errorInfo.value, errorBoundary: null !== boundary && 1 === boundary.tag ? boundary.stateNode : null - }) && console.error(errorInfo.value); + }) + ) { + var error = errorInfo.value; + 3 === boundary.tag ? reportGlobalError(error) : console.error(error); + } } catch (e) { setTimeout(function () { throw e; @@ -5194,9 +5156,7 @@ function createRootErrorUpdate(fiber, errorInfo, lane) { lane = createUpdate(lane); lane.tag = 3; lane.payload = { element: null }; - var error = errorInfo.value; lane.callback = function () { - hasUncaughtError || ((hasUncaughtError = !0), (firstUncaughtError = error)); logCapturedError(fiber, errorInfo); }; return lane; @@ -7237,14 +7197,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$72 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$72 = lastTailNode), + for (var lastTailNode$71 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$71 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$72 + null === lastTailNode$71 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$72.sibling = null); + : (lastTailNode$71.sibling = null); } } function bubbleProperties(completedWork) { @@ -7254,19 +7214,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$73 = completedWork.child; null !== child$73; ) - (newChildLanes |= child$73.lanes | child$73.childLanes), - (subtreeFlags |= child$73.subtreeFlags & 31457280), - (subtreeFlags |= child$73.flags & 31457280), - (child$73.return = completedWork), - (child$73 = child$73.sibling); + for (var child$72 = completedWork.child; null !== child$72; ) + (newChildLanes |= child$72.lanes | child$72.childLanes), + (subtreeFlags |= child$72.subtreeFlags & 31457280), + (subtreeFlags |= child$72.flags & 31457280), + (child$72.return = completedWork), + (child$72 = child$72.sibling); else - for (child$73 = completedWork.child; null !== child$73; ) - (newChildLanes |= child$73.lanes | child$73.childLanes), - (subtreeFlags |= child$73.subtreeFlags), - (subtreeFlags |= child$73.flags), - (child$73.return = completedWork), - (child$73 = child$73.sibling); + for (child$72 = completedWork.child; null !== child$72; ) + (newChildLanes |= child$72.lanes | child$72.childLanes), + (subtreeFlags |= child$72.subtreeFlags), + (subtreeFlags |= child$72.flags), + (child$72.return = completedWork), + (child$72 = child$72.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -7817,8 +7777,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { else if ("function" === typeof ref) try { ref(null); - } catch (error$95) { - captureCommitPhaseError(current, nearestMountedAncestor, error$95); + } catch (error$94) { + captureCommitPhaseError(current, nearestMountedAncestor, error$94); } else ref.current = null; } @@ -7922,10 +7882,10 @@ function commitHookEffectListMount(flags, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & flags) === flags) { - var create$96 = effect.create, + var create$95 = effect.create, inst = effect.inst; - create$96 = create$96(); - inst.destroy = create$96; + create$95 = create$95(); + inst.destroy = create$95; } effect = effect.next; } while (effect !== finishedWork); @@ -7988,11 +7948,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$97) { + } catch (error$96) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$97 + error$96 ); } } @@ -8286,8 +8246,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$99) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$99); + } catch (error$98) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$98); } } break; @@ -9022,7 +8982,6 @@ var DefaultCacheDispatcher = { workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = 0, - workInProgressRootFatalError = null, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, workInProgressRootPingedLanes = 0, @@ -9034,8 +8993,6 @@ var DefaultCacheDispatcher = { globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, workInProgressTransitions = null, - hasUncaughtError = !1, - firstUncaughtError = null, legacyErrorBoundariesThatAlreadyFailed = null, rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = null, @@ -9151,14 +9108,11 @@ function performConcurrentWorkOnRoot(root, didTimeout) { errorRetryLanes ))); } - if (1 === exitStatus) - throw ( - ((originalCallbackNode = workInProgressRootFatalError), - prepareFreshStack(root, 0), - markRootSuspended(root, lanes, 0), - ensureRootIsScheduled(root), - originalCallbackNode) - ); + if (1 === exitStatus) { + prepareFreshStack(root, 0); + markRootSuspended(root, lanes, 0); + break; + } root.finishedWork = didTimeout; root.finishedLanes = lanes; a: { @@ -9341,6 +9295,50 @@ function markRootSuspended(root, suspendedLanes, spawnedLane) { 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } +function performSyncWorkOnRoot(root, lanes) { + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + if (flushPassiveEffects()) return ensureRootIsScheduled(root), null; + var exitStatus = renderRootSync(root, lanes); + if (0 !== root.tag && 2 === exitStatus) { + var originallyAttemptedLanes = lanes, + errorRetryLanes = getLanesToRetrySynchronouslyOnError( + root, + originallyAttemptedLanes + ); + 0 !== errorRetryLanes && + ((lanes = errorRetryLanes), + (exitStatus = recoverFromConcurrentError( + root, + originallyAttemptedLanes, + errorRetryLanes + ))); + } + if (1 === exitStatus) + return ( + prepareFreshStack(root, 0), + markRootSuspended(root, lanes, 0), + ensureRootIsScheduled(root), + null + ); + if (6 === exitStatus) + return ( + markRootSuspended(root, lanes, workInProgressDeferredLane), + ensureRootIsScheduled(root), + null + ); + root.finishedWork = root.current.alternate; + root.finishedLanes = lanes; + commitRoot( + root, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + workInProgressDeferredLane + ); + ensureRootIsScheduled(root); + return null; +} function resetWorkInProgressStack() { if (null !== workInProgress) { if (0 === workInProgressSuspendedReason) @@ -9374,12 +9372,11 @@ function prepareFreshStack(root, lanes) { workInProgressSuspendedReason = 0; workInProgressThrownValue = null; workInProgressRootDidAttachPingListener = !1; - workInProgressRootExitStatus = 0; - workInProgressRootFatalError = null; workInProgressDeferredLane = workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = + workInProgressRootExitStatus = 0; workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null; @@ -9405,37 +9402,41 @@ function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; ReactCurrentOwner.current = null; - thrownValue === SuspenseException - ? ((thrownValue = getSuspendedThenable()), - (root = suspenseHandlerStackCursor.current), - (workInProgressSuspendedReason = - (null !== root && - ((workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null !== shellBoundary - : ((workInProgressRootRenderLanes & 62914560) !== - workInProgressRootRenderLanes && - 0 === (workInProgressRootRenderLanes & 536870912)) || - root !== shellBoundary)) || - 0 !== (workInProgressRootSkippedLanes & 134217727) || - 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 3 - : 2)) - : thrownValue === SuspenseyCommitException - ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = 4)) - : (workInProgressSuspendedReason = - thrownValue === SelectiveHydrationException - ? 8 - : null !== thrownValue && - "object" === typeof thrownValue && - "function" === typeof thrownValue.then - ? 6 - : 1); + if (thrownValue === SuspenseException) { + thrownValue = getSuspendedThenable(); + var handler = suspenseHandlerStackCursor.current; + workInProgressSuspendedReason = + (null !== handler && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + handler !== shellBoundary)) || + 0 !== (workInProgressRootSkippedLanes & 134217727) || + 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) + ? 3 + : 2; + } else + thrownValue === SuspenseyCommitException + ? ((thrownValue = getSuspendedThenable()), + (workInProgressSuspendedReason = 4)) + : (workInProgressSuspendedReason = + thrownValue === SelectiveHydrationException + ? 8 + : null !== thrownValue && + "object" === typeof thrownValue && + "function" === typeof thrownValue.then + ? 6 + : 1); workInProgressThrownValue = thrownValue; null === workInProgress && ((workInProgressRootExitStatus = 1), - (workInProgressRootFatalError = thrownValue)); + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + )); } function pushDispatcher() { var prevDispatcher = ReactCurrentDispatcher.current; @@ -9489,8 +9490,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$111) { - handleThrow(root, thrownValue$111); + } catch (thrownValue$110) { + handleThrow(root, thrownValue$110); } while (1); lanes && root.shellSuspendCounter++; @@ -9598,8 +9599,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$113) { - handleThrow(root, thrownValue$113); + } catch (thrownValue$112) { + handleThrow(root, thrownValue$112); } while (1); resetContextDependencies(); @@ -9695,14 +9696,20 @@ function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { ) ) { workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); workInProgress = null; return; } } catch (error) { if (null !== returnFiber) throw ((workInProgress = returnFiber), error); workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); workInProgress = null; return; } @@ -9856,13 +9863,6 @@ function commitRootImpl( componentStack: remainingLanes.stack }), renderPriorityLevel(remainingLanes.value, transitions); - if (hasUncaughtError) - throw ( - ((hasUncaughtError = !1), - (root = firstUncaughtError), - (firstUncaughtError = null), - root) - ); 0 !== (pendingPassiveEffectsLanes & 3) && 0 !== root.tag && flushPassiveEffects(); @@ -10604,10 +10604,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1106 = { + devToolsConfig$jscomp$inline_1098 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "19.0.0-canary-c33a3e4b", + version: "19.0.0-canary-b1980c9c", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10623,11 +10623,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1345 = { - bundleType: devToolsConfig$jscomp$inline_1106.bundleType, - version: devToolsConfig$jscomp$inline_1106.version, - rendererPackageName: devToolsConfig$jscomp$inline_1106.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1106.rendererConfig, +var internals$jscomp$inline_1335 = { + 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, @@ -10643,26 +10643,26 @@ var internals$jscomp$inline_1345 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1106.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1098.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-c33a3e4b" + reconcilerVersion: "19.0.0-canary-b1980c9c" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1346 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1336 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1346.isDisabled && - hook$jscomp$inline_1346.supportsFiber + !hook$jscomp$inline_1336.isDisabled && + hook$jscomp$inline_1336.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1346.inject( - internals$jscomp$inline_1345 + (rendererID = hook$jscomp$inline_1336.inject( + internals$jscomp$inline_1335 )), - (injectedHook = hook$jscomp$inline_1346); + (injectedHook = hook$jscomp$inline_1336); } 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 d6f090608033f..4ad7f6185de42 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<<743c9f41bbf30802f4e6db73f8dc863d>> + * @generated SignedSource<<90a64fc32ca07a75e597ef55736f43ed>> */ "use strict"; @@ -897,7 +897,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_264 = { +var injectedNamesToPlugins$jscomp$inline_263 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -943,32 +943,32 @@ var injectedNamesToPlugins$jscomp$inline_264 = { } } }, - isOrderingDirty$jscomp$inline_265 = !1, - pluginName$jscomp$inline_266; -for (pluginName$jscomp$inline_266 in injectedNamesToPlugins$jscomp$inline_264) + isOrderingDirty$jscomp$inline_264 = !1, + pluginName$jscomp$inline_265; +for (pluginName$jscomp$inline_265 in injectedNamesToPlugins$jscomp$inline_263) if ( - injectedNamesToPlugins$jscomp$inline_264.hasOwnProperty( - pluginName$jscomp$inline_266 + injectedNamesToPlugins$jscomp$inline_263.hasOwnProperty( + pluginName$jscomp$inline_265 ) ) { - var pluginModule$jscomp$inline_267 = - injectedNamesToPlugins$jscomp$inline_264[pluginName$jscomp$inline_266]; + var pluginModule$jscomp$inline_266 = + injectedNamesToPlugins$jscomp$inline_263[pluginName$jscomp$inline_265]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_266) || - namesToPlugins[pluginName$jscomp$inline_266] !== - pluginModule$jscomp$inline_267 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_265) || + namesToPlugins[pluginName$jscomp$inline_265] !== + pluginModule$jscomp$inline_266 ) { - if (namesToPlugins[pluginName$jscomp$inline_266]) + if (namesToPlugins[pluginName$jscomp$inline_265]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_266 + "`.") + (pluginName$jscomp$inline_265 + "`.") ); - namesToPlugins[pluginName$jscomp$inline_266] = - pluginModule$jscomp$inline_267; - isOrderingDirty$jscomp$inline_265 = !0; + namesToPlugins[pluginName$jscomp$inline_265] = + pluginModule$jscomp$inline_266; + isOrderingDirty$jscomp$inline_264 = !0; } } -isOrderingDirty$jscomp$inline_265 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_264 && recomputePluginOrdering(); var emptyObject$1 = {}, removedKeys = null, removedKeyCount = 0, @@ -2270,100 +2270,26 @@ function ensureRootIsScheduled(root) { } function flushSyncWorkAcrossRoots_impl(onlyLegacy) { if (!isFlushingWork && mightHavePendingSyncWork) { - var errors = null; isFlushingWork = !0; do { var didPerformSomeWork = !1; for (var root = firstScheduledRoot; null !== root; ) { if (!onlyLegacy || 0 === root.tag) { - var workInProgressRootRenderLanes$13 = workInProgressRootRenderLanes, - nextLanes = getNextLanes( - root, - root === workInProgressRoot ? workInProgressRootRenderLanes$13 : 0 - ); - if (0 !== (nextLanes & 3)) - try { - didPerformSomeWork = !0; - workInProgressRootRenderLanes$13 = root; - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - if (!flushPassiveEffects()) { - currentUpdateIsNested = nestedUpdateScheduled; - nestedUpdateScheduled = !1; - var exitStatus = renderRootSync( - workInProgressRootRenderLanes$13, - nextLanes - ); - if ( - 0 !== workInProgressRootRenderLanes$13.tag && - 2 === exitStatus - ) { - var originallyAttemptedLanes = nextLanes, - errorRetryLanes = getLanesToRetrySynchronouslyOnError( - workInProgressRootRenderLanes$13, - originallyAttemptedLanes - ); - 0 !== errorRetryLanes && - ((nextLanes = errorRetryLanes), - (exitStatus = recoverFromConcurrentError( - workInProgressRootRenderLanes$13, - originallyAttemptedLanes, - errorRetryLanes - ))); - } - if (1 === exitStatus) - throw ( - ((originallyAttemptedLanes = workInProgressRootFatalError), - prepareFreshStack(workInProgressRootRenderLanes$13, 0), - markRootSuspended( - workInProgressRootRenderLanes$13, - nextLanes, - 0 - ), - ensureRootIsScheduled(workInProgressRootRenderLanes$13), - originallyAttemptedLanes) - ); - 6 === exitStatus - ? markRootSuspended( - workInProgressRootRenderLanes$13, - nextLanes, - workInProgressDeferredLane - ) - : ((workInProgressRootRenderLanes$13.finishedWork = - workInProgressRootRenderLanes$13.current.alternate), - (workInProgressRootRenderLanes$13.finishedLanes = - nextLanes), - commitRoot( - workInProgressRootRenderLanes$13, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - workInProgressDeferredLane - )); - } - ensureRootIsScheduled(workInProgressRootRenderLanes$13); - } catch (error) { - null === errors ? (errors = [error]) : errors.push(error); - } + var workInProgressRootRenderLanes$13 = workInProgressRootRenderLanes; + workInProgressRootRenderLanes$13 = getNextLanes( + root, + root === workInProgressRoot ? workInProgressRootRenderLanes$13 : 0 + ); + 0 !== (workInProgressRootRenderLanes$13 & 3) && + ((didPerformSomeWork = !0), + performSyncWorkOnRoot(root, workInProgressRootRenderLanes$13)); } root = root.next; } } while (didPerformSomeWork); isFlushingWork = !1; - if (null !== errors) { - if (1 < errors.length) { - if ("function" === typeof AggregateError) - throw new AggregateError(errors); - for (onlyLegacy = 1; onlyLegacy < errors.length; onlyLegacy++) - scheduleImmediateTask(throwError.bind(null, errors[onlyLegacy])); - } - throw errors[0]; - } } } -function throwError(error) { - throw error; -} function processRootScheduleInMicrotask() { mightHavePendingSyncWork = didScheduleMicrotask = !1; for ( @@ -2841,16 +2767,16 @@ function describeNativeComponentFrame(fn, construct) { } else { try { Fake.call(); - } catch (x$19) { - control = x$19; + } catch (x$18) { + control = x$18; } fn.call(Fake.prototype); } } else { try { throw Error(); - } catch (x$20) { - control = x$20; + } catch (x$19) { + control = x$19; } (Fake = fn()) && "function" === typeof Fake.catch && @@ -4151,7 +4077,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$34 = !1; + didReadFromEntangledAsyncAction$33 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -4164,7 +4090,7 @@ function updateReducerImpl(hook, current, reducer) { if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$34 = !0); + (didReadFromEntangledAsyncAction$33 = !0); continue; } else (updateLane = { @@ -4193,7 +4119,7 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$34 = !0); + (didReadFromEntangledAsyncAction$33 = !0); updateLane = update.action; shouldDoubleInvokeUserFnsInHooksDEV && reducer(pendingQueue, updateLane); @@ -4223,7 +4149,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$34 && + didReadFromEntangledAsyncAction$33 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -5369,15 +5295,49 @@ if ( throw Error( "Expected ReactFiberErrorDialog.showErrorDialog to be a function." ); +var reportGlobalError = + "function" === typeof reportError + ? reportError + : function (error) { + if ( + "object" === typeof window && + "function" === typeof window.ErrorEvent + ) { + var event = new window.ErrorEvent("error", { + bubbles: !0, + cancelable: !0, + message: + "object" === typeof error && + null !== error && + "string" === typeof error.message + ? String(error.message) + : String(error), + error: error + }); + if (!window.dispatchEvent(event)) return; + } else if ( + "object" === typeof process && + "function" === typeof process.emit + ) { + process.emit("uncaughtException", error); + return; + } + console.error(error); + }; function logCapturedError(boundary, errorInfo) { try { - !1 !== + if ( + !1 !== ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog({ componentStack: null !== errorInfo.stack ? errorInfo.stack : "", error: errorInfo.value, errorBoundary: null !== boundary && 1 === boundary.tag ? boundary.stateNode : null - }) && console.error(errorInfo.value); + }) + ) { + var error = errorInfo.value; + 3 === boundary.tag ? reportGlobalError(error) : console.error(error); + } } catch (e) { setTimeout(function () { throw e; @@ -5388,9 +5348,7 @@ function createRootErrorUpdate(fiber, errorInfo, lane) { lane = createUpdate(lane); lane.tag = 3; lane.payload = { element: null }; - var error = errorInfo.value; lane.callback = function () { - hasUncaughtError || ((hasUncaughtError = !0), (firstUncaughtError = error)); logCapturedError(fiber, errorInfo); }; return lane; @@ -7471,14 +7429,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$76 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$76 = lastTailNode), + for (var lastTailNode$75 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$75 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$76 + null === lastTailNode$75 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$76.sibling = null); + : (lastTailNode$75.sibling = null); } } function bubbleProperties(completedWork) { @@ -7490,53 +7448,53 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$78 = completedWork.selfBaseDuration, - child$79 = completedWork.child; - null !== child$79; + var treeBaseDuration$77 = completedWork.selfBaseDuration, + child$78 = completedWork.child; + null !== child$78; ) - (newChildLanes |= child$79.lanes | child$79.childLanes), - (subtreeFlags |= child$79.subtreeFlags & 31457280), - (subtreeFlags |= child$79.flags & 31457280), - (treeBaseDuration$78 += child$79.treeBaseDuration), - (child$79 = child$79.sibling); - completedWork.treeBaseDuration = treeBaseDuration$78; + (newChildLanes |= child$78.lanes | child$78.childLanes), + (subtreeFlags |= child$78.subtreeFlags & 31457280), + (subtreeFlags |= child$78.flags & 31457280), + (treeBaseDuration$77 += child$78.treeBaseDuration), + (child$78 = child$78.sibling); + completedWork.treeBaseDuration = treeBaseDuration$77; } else for ( - treeBaseDuration$78 = completedWork.child; - null !== treeBaseDuration$78; + treeBaseDuration$77 = completedWork.child; + null !== treeBaseDuration$77; ) (newChildLanes |= - treeBaseDuration$78.lanes | treeBaseDuration$78.childLanes), - (subtreeFlags |= treeBaseDuration$78.subtreeFlags & 31457280), - (subtreeFlags |= treeBaseDuration$78.flags & 31457280), - (treeBaseDuration$78.return = completedWork), - (treeBaseDuration$78 = treeBaseDuration$78.sibling); + treeBaseDuration$77.lanes | treeBaseDuration$77.childLanes), + (subtreeFlags |= treeBaseDuration$77.subtreeFlags & 31457280), + (subtreeFlags |= treeBaseDuration$77.flags & 31457280), + (treeBaseDuration$77.return = completedWork), + (treeBaseDuration$77 = treeBaseDuration$77.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$78 = completedWork.actualDuration; - child$79 = completedWork.selfBaseDuration; + treeBaseDuration$77 = completedWork.actualDuration; + child$78 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$78 += child.actualDuration), - (child$79 += child.treeBaseDuration), + (treeBaseDuration$77 += child.actualDuration), + (child$78 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$78; - completedWork.treeBaseDuration = child$79; + completedWork.actualDuration = treeBaseDuration$77; + completedWork.treeBaseDuration = child$78; } else for ( - treeBaseDuration$78 = completedWork.child; - null !== treeBaseDuration$78; + treeBaseDuration$77 = completedWork.child; + null !== treeBaseDuration$77; ) (newChildLanes |= - treeBaseDuration$78.lanes | treeBaseDuration$78.childLanes), - (subtreeFlags |= treeBaseDuration$78.subtreeFlags), - (subtreeFlags |= treeBaseDuration$78.flags), - (treeBaseDuration$78.return = completedWork), - (treeBaseDuration$78 = treeBaseDuration$78.sibling); + treeBaseDuration$77.lanes | treeBaseDuration$77.childLanes), + (subtreeFlags |= treeBaseDuration$77.subtreeFlags), + (subtreeFlags |= treeBaseDuration$77.flags), + (treeBaseDuration$77.return = completedWork), + (treeBaseDuration$77 = treeBaseDuration$77.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -8145,8 +8103,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { recordLayoutEffectDuration(current); } else ref(null); - } catch (error$104) { - captureCommitPhaseError(current, nearestMountedAncestor, error$104); + } catch (error$103) { + captureCommitPhaseError(current, nearestMountedAncestor, error$103); } else ref.current = null; } @@ -8279,10 +8237,10 @@ function commitHookEffectListMount(flags, finishedWork) { injectedProfilingHooks.markComponentLayoutEffectMountStarted( finishedWork ); - var create$105 = effect.create, + var create$104 = effect.create, inst = effect.inst; - create$105 = create$105(); - inst.destroy = create$105; + create$104 = create$104(); + inst.destroy = create$104; 0 !== (flags & 8) ? null !== injectedProfilingHooks && "function" === @@ -8310,8 +8268,8 @@ function commitHookLayoutEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$107) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$107); + } catch (error$106) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$106); } } function commitClassCallbacks(finishedWork) { @@ -8400,11 +8358,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { } else try { finishedRoot.componentDidMount(); - } catch (error$108) { + } catch (error$107) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$108 + error$107 ); } else { @@ -8421,11 +8379,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$109) { + } catch (error$108) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$109 + error$108 ); } recordLayoutEffectDuration(finishedWork); @@ -8436,11 +8394,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$110) { + } catch (error$109) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$110 + error$109 ); } } @@ -8761,22 +8719,22 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { startLayoutEffectTimer(), commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$113) { + } catch (error$112) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$113 + error$112 ); } recordLayoutEffectDuration(finishedWork); } else try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$114) { + } catch (error$113) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$114 + error$113 ); } } @@ -9073,8 +9031,8 @@ function commitHookPassiveMountEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$122) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$122); + } catch (error$121) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$121); } } function commitOffscreenPassiveMountEffects(current, finishedWork) { @@ -9553,7 +9511,6 @@ var DefaultCacheDispatcher = { workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = 0, - workInProgressRootFatalError = null, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, workInProgressRootPingedLanes = 0, @@ -9565,8 +9522,6 @@ var DefaultCacheDispatcher = { globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, workInProgressTransitions = null, - hasUncaughtError = !1, - firstUncaughtError = null, legacyErrorBoundariesThatAlreadyFailed = null, rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = null, @@ -9685,14 +9640,11 @@ function performConcurrentWorkOnRoot(root, didTimeout) { errorRetryLanes ))); } - if (1 === exitStatus) - throw ( - ((originalCallbackNode = workInProgressRootFatalError), - prepareFreshStack(root, 0), - markRootSuspended(root, lanes, 0), - ensureRootIsScheduled(root), - originalCallbackNode) - ); + if (1 === exitStatus) { + prepareFreshStack(root, 0); + markRootSuspended(root, lanes, 0); + break; + } root.finishedWork = didTimeout; root.finishedLanes = lanes; a: { @@ -9875,6 +9827,52 @@ function markRootSuspended(root, suspendedLanes, spawnedLane) { 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } +function performSyncWorkOnRoot(root, lanes) { + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + if (flushPassiveEffects()) return ensureRootIsScheduled(root), null; + currentUpdateIsNested = nestedUpdateScheduled; + nestedUpdateScheduled = !1; + var exitStatus = renderRootSync(root, lanes); + if (0 !== root.tag && 2 === exitStatus) { + var originallyAttemptedLanes = lanes, + errorRetryLanes = getLanesToRetrySynchronouslyOnError( + root, + originallyAttemptedLanes + ); + 0 !== errorRetryLanes && + ((lanes = errorRetryLanes), + (exitStatus = recoverFromConcurrentError( + root, + originallyAttemptedLanes, + errorRetryLanes + ))); + } + if (1 === exitStatus) + return ( + prepareFreshStack(root, 0), + markRootSuspended(root, lanes, 0), + ensureRootIsScheduled(root), + null + ); + if (6 === exitStatus) + return ( + markRootSuspended(root, lanes, workInProgressDeferredLane), + ensureRootIsScheduled(root), + null + ); + root.finishedWork = root.current.alternate; + root.finishedLanes = lanes; + commitRoot( + root, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + workInProgressDeferredLane + ); + ensureRootIsScheduled(root); + return null; +} function resetWorkInProgressStack() { if (null !== workInProgress) { if (0 === workInProgressSuspendedReason) @@ -9908,12 +9906,11 @@ function prepareFreshStack(root, lanes) { workInProgressSuspendedReason = 0; workInProgressThrownValue = null; workInProgressRootDidAttachPingListener = !1; - workInProgressRootExitStatus = 0; - workInProgressRootFatalError = null; workInProgressDeferredLane = workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = + workInProgressRootExitStatus = 0; workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null; @@ -9939,41 +9936,46 @@ function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; ReactCurrentOwner.current = null; - thrownValue === SuspenseException - ? ((thrownValue = getSuspendedThenable()), - (root = suspenseHandlerStackCursor.current), - (workInProgressSuspendedReason = - (null !== root && - ((workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null !== shellBoundary - : ((workInProgressRootRenderLanes & 62914560) !== - workInProgressRootRenderLanes && - 0 === (workInProgressRootRenderLanes & 536870912)) || - root !== shellBoundary)) || - 0 !== (workInProgressRootSkippedLanes & 134217727) || - 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 3 - : 2)) - : thrownValue === SuspenseyCommitException - ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = 4)) - : (workInProgressSuspendedReason = - thrownValue === SelectiveHydrationException - ? 8 - : null !== thrownValue && - "object" === typeof thrownValue && - "function" === typeof thrownValue.then - ? 6 - : 1); + if (thrownValue === SuspenseException) { + thrownValue = getSuspendedThenable(); + var handler = suspenseHandlerStackCursor.current; + workInProgressSuspendedReason = + (null !== handler && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + handler !== shellBoundary)) || + 0 !== (workInProgressRootSkippedLanes & 134217727) || + 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) + ? 3 + : 2; + } else + thrownValue === SuspenseyCommitException + ? ((thrownValue = getSuspendedThenable()), + (workInProgressSuspendedReason = 4)) + : (workInProgressSuspendedReason = + thrownValue === SelectiveHydrationException + ? 8 + : null !== thrownValue && + "object" === typeof thrownValue && + "function" === typeof thrownValue.then + ? 6 + : 1); workInProgressThrownValue = thrownValue; - root = workInProgress; - if (null === root) + handler = workInProgress; + if (null === handler) (workInProgressRootExitStatus = 1), - (workInProgressRootFatalError = thrownValue); + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); else switch ( - (root.mode & 2 && stopProfilerTimerIfRunningAndRecordDelta(root, !0), + (handler.mode & 2 && + stopProfilerTimerIfRunningAndRecordDelta(handler, !0), markComponentRenderStopped(), workInProgressSuspendedReason) ) { @@ -9981,7 +9983,7 @@ function handleThrow(root, thrownValue) { null !== injectedProfilingHooks && "function" === typeof injectedProfilingHooks.markComponentErrored && injectedProfilingHooks.markComponentErrored( - root, + handler, thrownValue, workInProgressRootRenderLanes ); @@ -9993,7 +9995,7 @@ function handleThrow(root, thrownValue) { null !== injectedProfilingHooks && "function" === typeof injectedProfilingHooks.markComponentSuspended && injectedProfilingHooks.markComponentSuspended( - root, + handler, thrownValue, workInProgressRootRenderLanes ); @@ -10061,8 +10063,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$127) { - handleThrow(root, thrownValue$127); + } catch (thrownValue$126) { + handleThrow(root, thrownValue$126); } while (1); lanes && root.shellSuspendCounter++; @@ -10181,8 +10183,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$129) { - handleThrow(root, thrownValue$129); + } catch (thrownValue$128) { + handleThrow(root, thrownValue$128); } while (1); resetContextDependencies(); @@ -10295,14 +10297,20 @@ function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { ) ) { workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); workInProgress = null; return; } } catch (error) { if (null !== returnFiber) throw ((workInProgress = returnFiber), error); workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); workInProgress = null; return; } @@ -10476,13 +10484,6 @@ function commitRootImpl( componentStack: remainingLanes.stack }), renderPriorityLevel(remainingLanes.value, transitions); - if (hasUncaughtError) - throw ( - ((hasUncaughtError = !1), - (root = firstUncaughtError), - (firstUncaughtError = null), - root) - ); 0 !== (pendingPassiveEffectsLanes & 3) && 0 !== root.tag && flushPassiveEffects(); @@ -10553,7 +10554,7 @@ function flushPassiveEffects() { _finishedWork$memoize = finishedWork.memoizedProps, id = _finishedWork$memoize.id, onPostCommit = _finishedWork$memoize.onPostCommit, - commitTime$106 = commitTime, + commitTime$105 = commitTime, phase = null === finishedWork.alternate ? "mount" : "update"; currentUpdateIsNested && (phase = "nested-update"); "function" === typeof onPostCommit && @@ -10561,7 +10562,7 @@ function flushPassiveEffects() { id, phase, passiveEffectDuration, - commitTime$106 + commitTime$105 ); var parentFiber = finishedWork.return; b: for (; null !== parentFiber; ) { @@ -11310,10 +11311,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1187 = { + devToolsConfig$jscomp$inline_1180 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "19.0.0-canary-82127a40", + version: "19.0.0-canary-deb7c33e", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -11343,10 +11344,10 @@ var roots = new Map(), } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1187.bundleType, - version: devToolsConfig$jscomp$inline_1187.version, - rendererPackageName: devToolsConfig$jscomp$inline_1187.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1187.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1180.bundleType, + version: devToolsConfig$jscomp$inline_1180.version, + rendererPackageName: devToolsConfig$jscomp$inline_1180.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1180.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -11362,14 +11363,14 @@ var roots = new Map(), return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1187.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1180.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-82127a40" + reconcilerVersion: "19.0.0-canary-deb7c33e" }); 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 e2b3af7d2a59e..ad7c851d6d5f9 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<<320ab42e8da28c86cd4fb0d1444d0f2a>> + * @generated SignedSource<> */ "use strict"; @@ -7411,7 +7411,7 @@ to return true:wantsResponderID| | } } - var ReactCurrentActQueue$3 = ReactSharedInternals.ReactCurrentActQueue; // A linked list of all the roots with pending work. In an idiomatic app, + var ReactCurrentActQueue$4 = ReactSharedInternals.ReactCurrentActQueue; // A linked list of all the roots with pending work. In an idiomatic app, // there's only a single root, but we do support multi root apps, hence this // extra complexity. But this module is optimized for the single root case. @@ -7450,7 +7450,7 @@ to return true:wantsResponderID| | mightHavePendingSyncWork = true; // At the end of the current event, go through each of the roots and ensure // there's a task scheduled for each one at the correct priority. - if (ReactCurrentActQueue$3.current !== null) { + if (ReactCurrentActQueue$4.current !== null) { // We're inside an `act` scope. if (!didScheduleMicrotask_act) { didScheduleMicrotask_act = true; @@ -7471,9 +7471,9 @@ to return true:wantsResponderID| | scheduleTaskForRootDuringMicrotask(root, now$1()); } - if (ReactCurrentActQueue$3.isBatchingLegacy && root.tag === LegacyRoot) { + if (ReactCurrentActQueue$4.isBatchingLegacy && root.tag === LegacyRoot) { // Special `act` case: Record whenever a legacy update is scheduled. - ReactCurrentActQueue$3.didScheduleLegacyUpdate = true; + ReactCurrentActQueue$4.didScheduleLegacyUpdate = true; } } function flushSyncWorkOnAllRoots() { @@ -7501,7 +7501,6 @@ to return true:wantsResponderID| | } // There may or may not be synchronous work scheduled. Let's check. var didPerformSomeWork; - var errors = null; isFlushingWork = true; do { @@ -7523,17 +7522,8 @@ to return true:wantsResponderID| | if (includesSyncLane(nextLanes)) { // This root has pending sync work. Flush it now. - try { - didPerformSomeWork = true; - performSyncWorkOnRoot(root, nextLanes); - } catch (error) { - // Collect errors so we can rethrow them at the end - if (errors === null) { - errors = [error]; - } else { - errors.push(error); - } - } + didPerformSomeWork = true; + performSyncWorkOnRoot(root, nextLanes); } } @@ -7541,32 +7531,7 @@ to return true:wantsResponderID| | } } while (didPerformSomeWork); - isFlushingWork = false; // If any errors were thrown, rethrow them right before exiting. - // TODO: Consider returning these to the caller, to allow them to decide - // how/when to rethrow. - - if (errors !== null) { - if (errors.length > 1) { - if (typeof AggregateError === "function") { - // eslint-disable-next-line no-undef - throw new AggregateError(errors); - } else { - for (var i = 1; i < errors.length; i++) { - scheduleImmediateTask(throwError.bind(null, errors[i])); - } - - var firstError = errors[0]; - throw firstError; - } - } else { - var error = errors[0]; - throw error; - } - } - } - - function throwError(error) { - throw error; + isFlushingWork = false; } function processRootScheduleInMicrotask() { @@ -7697,7 +7662,7 @@ to return true:wantsResponderID| | // Scheduler task, rather than an `act` task, cancel it and re-schedule // on the `act` queue. !( - ReactCurrentActQueue$3.current !== null && + ReactCurrentActQueue$4.current !== null && existingCallbackNode !== fakeActCallbackNode$1 ) ) { @@ -7764,11 +7729,11 @@ to return true:wantsResponderID| | var fakeActCallbackNode$1 = {}; function scheduleCallback$2(priorityLevel, callback) { - if (ReactCurrentActQueue$3.current !== null) { + if (ReactCurrentActQueue$4.current !== null) { // Special case: We're inside an `act` scope (a testing utility). // Instead of scheduling work in the host environment, add it to a // fake internal queue that's managed by the `act` implementation. - ReactCurrentActQueue$3.current.push(callback); + ReactCurrentActQueue$4.current.push(callback); return fakeActCallbackNode$1; } else { return scheduleCallback$3(priorityLevel, callback); @@ -7783,13 +7748,13 @@ to return true:wantsResponderID| | } function scheduleImmediateTask(cb) { - if (ReactCurrentActQueue$3.current !== null) { + if (ReactCurrentActQueue$4.current !== null) { // Special case: Inside an `act` scope, we push microtasks to the fake `act` // callback queue. This is because we currently support calling `act` // without awaiting the result. The plan is to deprecate that, and require // that you always await the result so that the microtasks have a chance to // run. But it hasn't happened yet. - ReactCurrentActQueue$3.current.push(function () { + ReactCurrentActQueue$4.current.push(function () { cb(); return null; }); @@ -9471,7 +9436,7 @@ to return true:wantsResponderID| | } } - var ReactCurrentActQueue$2 = ReactSharedInternals.ReactCurrentActQueue; + var ReactCurrentActQueue$3 = ReactSharedInternals.ReactCurrentActQueue; function getThenablesFromState(state) { { @@ -9526,8 +9491,8 @@ to return true:wantsResponderID| | function noop() {} function trackUsedThenable(thenableState, thenable, index) { - if (ReactCurrentActQueue$2.current !== null) { - ReactCurrentActQueue$2.didUsePromise = true; + if (ReactCurrentActQueue$3.current !== null) { + ReactCurrentActQueue$3.didUsePromise = true; } var trackedThenables = getThenablesFromState(thenableState); @@ -17157,6 +17122,46 @@ to return true:wantsResponderID| | ); } + var reportGlobalError = + typeof reportError === "function" // In modern browsers, reportError will dispatch an error event, + ? // emulating an uncaught JavaScript error. + reportError + : function (error) { + if ( + typeof window === "object" && + typeof window.ErrorEvent === "function" + ) { + // Browser Polyfill + var message = + typeof error === "object" && + error !== null && + typeof error.message === "string" // eslint-disable-next-line react-internal/safe-string-coercion + ? String(error.message) // eslint-disable-next-line react-internal/safe-string-coercion + : String(error); + var event = new window.ErrorEvent("error", { + bubbles: true, + cancelable: true, + message: message, + error: error + }); + var shouldLog = window.dispatchEvent(event); + + if (!shouldLog) { + return; + } + } else if ( + typeof process === "object" && // $FlowFixMe[method-unbinding] + typeof process.emit === "function" + ) { + // Node Polyfill + process.emit("uncaughtException", error); + return; + } // eslint-disable-next-line react-internal/no-production-logging + + console["error"](error); + }; + + var ReactCurrentActQueue$2 = ReactSharedInternals.ReactCurrentActQueue; function logCapturedError(boundary, errorInfo) { try { var logError = showErrorDialog(boundary, errorInfo); // Allow injected showErrorDialog() to prevent default console.error logging. @@ -17168,43 +17173,73 @@ to return true:wantsResponderID| | var error = errorInfo.value; - if (true) { - var source = errorInfo.source; - var stack = errorInfo.stack; - var componentStack = stack !== null ? stack : ""; // TODO: There's no longer a way to silence these warnings e.g. for tests. - // See https://github.com/facebook/react/pull/13384 - - var componentName = source ? getComponentNameFromFiber(source) : null; - var componentNameMessage = componentName - ? "The above error occurred in the <" + - componentName + - "> component:" - : "The above error occurred in one of your React components:"; - var errorBoundaryMessage; - - if (boundary.tag === HostRoot) { - errorBoundaryMessage = + if (boundary.tag === HostRoot) { + if (true && ReactCurrentActQueue$2.current !== null) { + // For uncaught errors inside act, we track them on the act and then + // rethrow them into the test. + ReactCurrentActQueue$2.thrownErrors.push(error); + return; + } // For uncaught root errors we report them as uncaught to the browser's + // onerror callback. This won't have component stacks and the error addendum. + // So we add those into a separate console.warn. + + reportGlobalError(error); + + if (true) { + var source = errorInfo.source; + var stack = errorInfo.stack; + var componentStack = stack !== null ? stack : ""; // TODO: There's no longer a way to silence these warnings e.g. for tests. + // See https://github.com/facebook/react/pull/13384 + + var componentName = source + ? getComponentNameFromFiber(source) + : null; + var componentNameMessage = componentName + ? "An error occurred in the <" + componentName + "> component:" + : "An error occurred in one of your React components:"; + console["warn"]( + "%s\n%s\n\n%s", + componentNameMessage, + componentStack, "Consider adding an error boundary to your tree to customize error handling behavior.\n" + - "Visit https://react.dev/link/error-boundaries to learn more about error boundaries."; - } else { - var errorBoundaryName = - getComponentNameFromFiber(boundary) || "Anonymous"; - errorBoundaryMessage = - "React will try to recreate this component tree from scratch " + - ("using the error boundary you provided, " + - errorBoundaryName + - "."); - } // In development, we provide our own message which includes the component stack - // in addition to the error. + "Visit https://react.dev/link/error-boundaries to learn more about error boundaries." + ); + } + } else { + // Caught by error boundary + if (true) { + var _source = errorInfo.source; + var _stack = errorInfo.stack; + + var _componentStack = _stack !== null ? _stack : ""; // TODO: There's no longer a way to silence these warnings e.g. for tests. + // See https://github.com/facebook/react/pull/13384 - console["error"]( + var _componentName = _source + ? getComponentNameFromFiber(_source) + : null; + + var _componentNameMessage = _componentName + ? "The above error occurred in the <" + + _componentName + + "> component:" + : "The above error occurred in one of your React components:"; + + var errorBoundaryName = + getComponentNameFromFiber(boundary) || "Anonymous"; // In development, we provide our own message which includes the component stack + // in addition to the error. // Don't transform to our wrapper - "%o\n\n%s\n%s\n\n%s", - error, - componentNameMessage, - componentStack, - errorBoundaryMessage - ); + + console["error"]( + "%o\n\n%s\n%s\n\n%s", + error, + _componentNameMessage, + _componentStack, + "React will try to recreate this component tree from scratch " + + ("using the error boundary you provided, " + + errorBoundaryName + + ".") + ); + } } } catch (e) { // This method must not throw, or React internal state will get messed up. @@ -17226,10 +17261,8 @@ to return true:wantsResponderID| | update.payload = { element: null }; - var error = errorInfo.value; update.callback = function () { - onUncaughtError(error); logCapturedError(fiber, errorInfo); }; @@ -26539,9 +26572,7 @@ to return true:wantsResponderID| | var entangledRenderLanes = NoLanes; // Whether to root completed, errored, suspended, etc. - var workInProgressRootExitStatus = RootInProgress; // A fatal error, if one is thrown - - var workInProgressRootFatalError = null; // The work left over by components that were visited during this render. Only + var workInProgressRootExitStatus = RootInProgress; // The work left over by components that were visited during this render. Only // includes unprocessed updates, not work in bailed out children. var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an interleaved event) during this render. @@ -26583,8 +26614,6 @@ to return true:wantsResponderID| | function getRenderTargetTime() { return workInProgressRootRenderTargetTime; } - var hasUncaughtError = false; - var firstUncaughtError = null; var legacyErrorBoundariesThatAlreadyFailed = null; var rootDoesHavePassiveEffects = false; var rootWithPendingPassiveEffects = null; @@ -26933,11 +26962,9 @@ to return true:wantsResponderID| | } if (exitStatus === RootFatalErrored) { - var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); markRootSuspended(root, lanes, NoLane); - ensureRootIsScheduled(root); - throw fatalError; + break; } // We now have a consistent tree. The next step is either to commit it, // or, if something suspended, wait to commit it after a timeout. @@ -27329,11 +27356,10 @@ to return true:wantsResponderID| | } if (exitStatus === RootFatalErrored) { - var fatalError = workInProgressRootFatalError; prepareFreshStack(root, NoLanes); markRootSuspended(root, lanes, NoLane); ensureRootIsScheduled(root); - throw fatalError; + return null; } if (exitStatus === RootDidNotComplete) { @@ -27492,7 +27518,6 @@ to return true:wantsResponderID| | workInProgressThrownValue = null; workInProgressRootDidAttachPingListener = false; workInProgressRootExitStatus = RootInProgress; - workInProgressRootFatalError = null; workInProgressRootSkippedLanes = NoLanes; workInProgressRootInterleavedUpdatedLanes = NoLanes; workInProgressRootPingedLanes = NoLanes; @@ -27595,7 +27620,10 @@ to return true:wantsResponderID| | if (erroredWork === null) { // This is a fatal error workInProgressRootExitStatus = RootFatalErrored; - workInProgressRootFatalError = thrownValue; + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); return; } @@ -28354,7 +28382,7 @@ to return true:wantsResponderID| | ); if (didFatal) { - panicOnRootError(thrownValue); + panicOnRootError(root, thrownValue); return; } } catch (error) { @@ -28366,7 +28394,7 @@ to return true:wantsResponderID| | workInProgress = returnFiber; throw error; } else { - panicOnRootError(thrownValue); + panicOnRootError(root, thrownValue); return; } } @@ -28388,13 +28416,16 @@ to return true:wantsResponderID| | } } - function panicOnRootError(error) { + function panicOnRootError(root, error) { // There's no ancestor that can handle this exception. This should never // happen because the root is supposed to capture all errors that weren't // caught by an error boundary. This is a fatal error, or panic condition, // because we've run out of ways to recover. workInProgressRootExitStatus = RootFatalErrored; - workInProgressRootFatalError = error; // Set `workInProgress` to null. This represents advancing to the next + logCapturedError( + root.current, + createCapturedValueAtFiber(error, root.current) + ); // Set `workInProgress` to null. This represents advancing to the next // sibling, or the parent if there are no siblings. But since the root // has no siblings nor a parent, we set it to null. Usually this is // handled by `completeUnitOfWork` or `unwindWork`, but since we're @@ -28809,13 +28840,6 @@ to return true:wantsResponderID| | ); onRecoverableError(recoverableError.value, errorInfo); } - } - - if (hasUncaughtError) { - hasUncaughtError = false; - var error$1 = firstUncaughtError; - firstUncaughtError = null; - throw error$1; } // If the passive effects are the result of a discrete render, flush them // synchronously at the end of the current task so that the result is // immediately observable. Otherwise, we assume that they are not @@ -29060,15 +29084,6 @@ to return true:wantsResponderID| | } } - function prepareToThrowUncaughtError(error) { - if (!hasUncaughtError) { - hasUncaughtError = true; - firstUncaughtError = error; - } - } - - var onUncaughtError = prepareToThrowUncaughtError; - function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { var errorInfo = createCapturedValueAtFiber(error, sourceFiber); var update = createRootErrorUpdate(rootFiber, errorInfo, SyncLane); @@ -30962,7 +30977,7 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "19.0.0-canary-2bac5262"; + var ReactVersion = "19.0.0-canary-23fb6fb2"; 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 3aff61932cc8d..1ca602bcf1a1f 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<> + * @generated SignedSource<<221a1cc682b43c2e39118b978eab6b86>> */ "use strict"; @@ -893,7 +893,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_255 = { +var injectedNamesToPlugins$jscomp$inline_254 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -939,32 +939,32 @@ var injectedNamesToPlugins$jscomp$inline_255 = { } } }, - isOrderingDirty$jscomp$inline_256 = !1, - pluginName$jscomp$inline_257; -for (pluginName$jscomp$inline_257 in injectedNamesToPlugins$jscomp$inline_255) + isOrderingDirty$jscomp$inline_255 = !1, + pluginName$jscomp$inline_256; +for (pluginName$jscomp$inline_256 in injectedNamesToPlugins$jscomp$inline_254) if ( - injectedNamesToPlugins$jscomp$inline_255.hasOwnProperty( - pluginName$jscomp$inline_257 + injectedNamesToPlugins$jscomp$inline_254.hasOwnProperty( + pluginName$jscomp$inline_256 ) ) { - var pluginModule$jscomp$inline_258 = - injectedNamesToPlugins$jscomp$inline_255[pluginName$jscomp$inline_257]; + var pluginModule$jscomp$inline_257 = + injectedNamesToPlugins$jscomp$inline_254[pluginName$jscomp$inline_256]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_257) || - namesToPlugins[pluginName$jscomp$inline_257] !== - pluginModule$jscomp$inline_258 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_256) || + namesToPlugins[pluginName$jscomp$inline_256] !== + pluginModule$jscomp$inline_257 ) { - if (namesToPlugins[pluginName$jscomp$inline_257]) + if (namesToPlugins[pluginName$jscomp$inline_256]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_257 + "`.") + (pluginName$jscomp$inline_256 + "`.") ); - namesToPlugins[pluginName$jscomp$inline_257] = - pluginModule$jscomp$inline_258; - isOrderingDirty$jscomp$inline_256 = !0; + namesToPlugins[pluginName$jscomp$inline_256] = + pluginModule$jscomp$inline_257; + isOrderingDirty$jscomp$inline_255 = !0; } } -isOrderingDirty$jscomp$inline_256 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_255 && recomputePluginOrdering(); var instanceCache = new Map(), instanceProps = new Map(); function getInstanceFromTag(tag) { @@ -2222,99 +2222,26 @@ function ensureRootIsScheduled(root) { } function flushSyncWorkAcrossRoots_impl(onlyLegacy) { if (!isFlushingWork && mightHavePendingSyncWork) { - var errors = null; isFlushingWork = !0; do { var didPerformSomeWork = !1; for (var root = firstScheduledRoot; null !== root; ) { if (!onlyLegacy || 0 === root.tag) { - var workInProgressRootRenderLanes$12 = workInProgressRootRenderLanes, - nextLanes = getNextLanes( - root, - root === workInProgressRoot ? workInProgressRootRenderLanes$12 : 0 - ); - if (0 !== (nextLanes & 3)) - try { - didPerformSomeWork = !0; - workInProgressRootRenderLanes$12 = root; - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - if (!flushPassiveEffects()) { - var exitStatus = renderRootSync( - workInProgressRootRenderLanes$12, - nextLanes - ); - if ( - 0 !== workInProgressRootRenderLanes$12.tag && - 2 === exitStatus - ) { - var originallyAttemptedLanes = nextLanes, - errorRetryLanes = getLanesToRetrySynchronouslyOnError( - workInProgressRootRenderLanes$12, - originallyAttemptedLanes - ); - 0 !== errorRetryLanes && - ((nextLanes = errorRetryLanes), - (exitStatus = recoverFromConcurrentError( - workInProgressRootRenderLanes$12, - originallyAttemptedLanes, - errorRetryLanes - ))); - } - if (1 === exitStatus) - throw ( - ((originallyAttemptedLanes = workInProgressRootFatalError), - prepareFreshStack(workInProgressRootRenderLanes$12, 0), - markRootSuspended( - workInProgressRootRenderLanes$12, - nextLanes, - 0 - ), - ensureRootIsScheduled(workInProgressRootRenderLanes$12), - originallyAttemptedLanes) - ); - 6 === exitStatus - ? markRootSuspended( - workInProgressRootRenderLanes$12, - nextLanes, - workInProgressDeferredLane - ) - : ((workInProgressRootRenderLanes$12.finishedWork = - workInProgressRootRenderLanes$12.current.alternate), - (workInProgressRootRenderLanes$12.finishedLanes = - nextLanes), - commitRoot( - workInProgressRootRenderLanes$12, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - workInProgressDeferredLane - )); - } - ensureRootIsScheduled(workInProgressRootRenderLanes$12); - } catch (error) { - null === errors ? (errors = [error]) : errors.push(error); - } + var workInProgressRootRenderLanes$12 = workInProgressRootRenderLanes; + workInProgressRootRenderLanes$12 = getNextLanes( + root, + root === workInProgressRoot ? workInProgressRootRenderLanes$12 : 0 + ); + 0 !== (workInProgressRootRenderLanes$12 & 3) && + ((didPerformSomeWork = !0), + performSyncWorkOnRoot(root, workInProgressRootRenderLanes$12)); } root = root.next; } } while (didPerformSomeWork); isFlushingWork = !1; - if (null !== errors) { - if (1 < errors.length) { - if ("function" === typeof AggregateError) - throw new AggregateError(errors); - for (onlyLegacy = 1; onlyLegacy < errors.length; onlyLegacy++) - (didPerformSomeWork = throwError.bind(null, errors[onlyLegacy])), - scheduleCallback$3(ImmediatePriority, didPerformSomeWork); - } - throw errors[0]; - } } } -function throwError(error) { - throw error; -} function processRootScheduleInMicrotask() { mightHavePendingSyncWork = didScheduleMicrotask = !1; for ( @@ -2783,16 +2710,16 @@ function describeNativeComponentFrame(fn, construct) { } else { try { Fake.call(); - } catch (x$18) { - control = x$18; + } catch (x$17) { + control = x$17; } fn.call(Fake.prototype); } } else { try { throw Error(); - } catch (x$19) { - control = x$19; + } catch (x$18) { + control = x$18; } (Fake = fn()) && "function" === typeof Fake.catch && @@ -4093,7 +4020,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$33 = !1; + didReadFromEntangledAsyncAction$32 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -4106,7 +4033,7 @@ function updateReducerImpl(hook, current, reducer) { if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$33 = !0); + (didReadFromEntangledAsyncAction$32 = !0); continue; } else (updateLane = { @@ -4135,7 +4062,7 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$33 = !0); + (didReadFromEntangledAsyncAction$32 = !0); updateLane = update.action; shouldDoubleInvokeUserFnsInHooksDEV && reducer(pendingQueue, updateLane); @@ -4165,7 +4092,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$33 && + didReadFromEntangledAsyncAction$32 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -5241,15 +5168,49 @@ if ( throw Error( "Expected ReactFiberErrorDialog.showErrorDialog to be a function." ); +var reportGlobalError = + "function" === typeof reportError + ? reportError + : function (error) { + if ( + "object" === typeof window && + "function" === typeof window.ErrorEvent + ) { + var event = new window.ErrorEvent("error", { + bubbles: !0, + cancelable: !0, + message: + "object" === typeof error && + null !== error && + "string" === typeof error.message + ? String(error.message) + : String(error), + error: error + }); + if (!window.dispatchEvent(event)) return; + } else if ( + "object" === typeof process && + "function" === typeof process.emit + ) { + process.emit("uncaughtException", error); + return; + } + console.error(error); + }; function logCapturedError(boundary, errorInfo) { try { - !1 !== + if ( + !1 !== ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog({ componentStack: null !== errorInfo.stack ? errorInfo.stack : "", error: errorInfo.value, errorBoundary: null !== boundary && 1 === boundary.tag ? boundary.stateNode : null - }) && console.error(errorInfo.value); + }) + ) { + var error = errorInfo.value; + 3 === boundary.tag ? reportGlobalError(error) : console.error(error); + } } catch (e) { setTimeout(function () { throw e; @@ -5260,9 +5221,7 @@ function createRootErrorUpdate(fiber, errorInfo, lane) { lane = createUpdate(lane); lane.tag = 3; lane.payload = { element: null }; - var error = errorInfo.value; lane.callback = function () { - hasUncaughtError || ((hasUncaughtError = !0), (firstUncaughtError = error)); logCapturedError(fiber, errorInfo); }; return lane; @@ -7192,14 +7151,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$72 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$72 = lastTailNode), + for (var lastTailNode$71 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$71 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$72 + null === lastTailNode$71 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$72.sibling = null); + : (lastTailNode$71.sibling = null); } } function bubbleProperties(completedWork) { @@ -7209,19 +7168,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$73 = completedWork.child; null !== child$73; ) - (newChildLanes |= child$73.lanes | child$73.childLanes), - (subtreeFlags |= child$73.subtreeFlags & 31457280), - (subtreeFlags |= child$73.flags & 31457280), - (child$73.return = completedWork), - (child$73 = child$73.sibling); + for (var child$72 = completedWork.child; null !== child$72; ) + (newChildLanes |= child$72.lanes | child$72.childLanes), + (subtreeFlags |= child$72.subtreeFlags & 31457280), + (subtreeFlags |= child$72.flags & 31457280), + (child$72.return = completedWork), + (child$72 = child$72.sibling); else - for (child$73 = completedWork.child; null !== child$73; ) - (newChildLanes |= child$73.lanes | child$73.childLanes), - (subtreeFlags |= child$73.subtreeFlags), - (subtreeFlags |= child$73.flags), - (child$73.return = completedWork), - (child$73 = child$73.sibling); + for (child$72 = completedWork.child; null !== child$72; ) + (newChildLanes |= child$72.lanes | child$72.childLanes), + (subtreeFlags |= child$72.subtreeFlags), + (subtreeFlags |= child$72.flags), + (child$72.return = completedWork), + (child$72 = child$72.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -7727,8 +7686,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { else if ("function" === typeof ref) try { ref(null); - } catch (error$95) { - captureCommitPhaseError(current, nearestMountedAncestor, error$95); + } catch (error$94) { + captureCommitPhaseError(current, nearestMountedAncestor, error$94); } else ref.current = null; } @@ -7832,10 +7791,10 @@ function commitHookEffectListMount(flags, finishedWork) { var effect = (finishedWork = finishedWork.next); do { if ((effect.tag & flags) === flags) { - var create$96 = effect.create, + var create$95 = effect.create, inst = effect.inst; - create$96 = create$96(); - inst.destroy = create$96; + create$95 = create$95(); + inst.destroy = create$95; } effect = effect.next; } while (effect !== finishedWork); @@ -7889,11 +7848,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$97) { + } catch (error$96) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$97 + error$96 ); } } @@ -8356,8 +8315,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$105) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$105); + } catch (error$104) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$104); } } break; @@ -8404,8 +8363,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { viewConfig.uiViewClassName, updatePayload ); - } catch (error$108) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$108); + } catch (error$107) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$107); } } break; @@ -8425,8 +8384,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { "RCTRawText", { text: current } ); - } catch (error$109) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$109); + } catch (error$108) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$108); } } break; @@ -8538,11 +8497,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === current) try { throw Error("Not yet implemented."); - } catch (error$99) { + } catch (error$98) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$99 + error$98 ); } } else if ( @@ -8616,12 +8575,12 @@ function commitReconciliationEffects(finishedWork) { break; case 3: case 4: - var parent$100 = JSCompiler_inline_result.stateNode.containerInfo, - before$101 = getHostSibling(finishedWork); + var parent$99 = JSCompiler_inline_result.stateNode.containerInfo, + before$100 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$101, - parent$100 + before$100, + parent$99 ); break; default: @@ -9245,7 +9204,6 @@ var DefaultCacheDispatcher = { workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = 0, - workInProgressRootFatalError = null, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, workInProgressRootPingedLanes = 0, @@ -9257,8 +9215,6 @@ var DefaultCacheDispatcher = { globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, workInProgressTransitions = null, - hasUncaughtError = !1, - firstUncaughtError = null, legacyErrorBoundariesThatAlreadyFailed = null, rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = null, @@ -9361,14 +9317,11 @@ function performConcurrentWorkOnRoot(root, didTimeout) { errorRetryLanes ))); } - if (1 === exitStatus) - throw ( - ((originalCallbackNode = workInProgressRootFatalError), - prepareFreshStack(root, 0), - markRootSuspended(root, lanes, 0), - ensureRootIsScheduled(root), - originalCallbackNode) - ); + if (1 === exitStatus) { + prepareFreshStack(root, 0); + markRootSuspended(root, lanes, 0); + break; + } root.finishedWork = didTimeout; root.finishedLanes = lanes; a: { @@ -9551,6 +9504,50 @@ function markRootSuspended(root, suspendedLanes, spawnedLane) { 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } +function performSyncWorkOnRoot(root, lanes) { + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + if (flushPassiveEffects()) return ensureRootIsScheduled(root), null; + var exitStatus = renderRootSync(root, lanes); + if (0 !== root.tag && 2 === exitStatus) { + var originallyAttemptedLanes = lanes, + errorRetryLanes = getLanesToRetrySynchronouslyOnError( + root, + originallyAttemptedLanes + ); + 0 !== errorRetryLanes && + ((lanes = errorRetryLanes), + (exitStatus = recoverFromConcurrentError( + root, + originallyAttemptedLanes, + errorRetryLanes + ))); + } + if (1 === exitStatus) + return ( + prepareFreshStack(root, 0), + markRootSuspended(root, lanes, 0), + ensureRootIsScheduled(root), + null + ); + if (6 === exitStatus) + return ( + markRootSuspended(root, lanes, workInProgressDeferredLane), + ensureRootIsScheduled(root), + null + ); + root.finishedWork = root.current.alternate; + root.finishedLanes = lanes; + commitRoot( + root, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + workInProgressDeferredLane + ); + ensureRootIsScheduled(root); + return null; +} function resetWorkInProgressStack() { if (null !== workInProgress) { if (0 === workInProgressSuspendedReason) @@ -9584,12 +9581,11 @@ function prepareFreshStack(root, lanes) { workInProgressSuspendedReason = 0; workInProgressThrownValue = null; workInProgressRootDidAttachPingListener = !1; - workInProgressRootExitStatus = 0; - workInProgressRootFatalError = null; workInProgressDeferredLane = workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = + workInProgressRootExitStatus = 0; workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null; @@ -9615,37 +9611,41 @@ function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; ReactCurrentOwner.current = null; - thrownValue === SuspenseException - ? ((thrownValue = getSuspendedThenable()), - (root = suspenseHandlerStackCursor.current), - (workInProgressSuspendedReason = - (null !== root && - ((workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null !== shellBoundary - : ((workInProgressRootRenderLanes & 62914560) !== - workInProgressRootRenderLanes && - 0 === (workInProgressRootRenderLanes & 536870912)) || - root !== shellBoundary)) || - 0 !== (workInProgressRootSkippedLanes & 134217727) || - 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 3 - : 2)) - : thrownValue === SuspenseyCommitException - ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = 4)) - : (workInProgressSuspendedReason = - thrownValue === SelectiveHydrationException - ? 8 - : null !== thrownValue && - "object" === typeof thrownValue && - "function" === typeof thrownValue.then - ? 6 - : 1); + if (thrownValue === SuspenseException) { + thrownValue = getSuspendedThenable(); + var handler = suspenseHandlerStackCursor.current; + workInProgressSuspendedReason = + (null !== handler && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + handler !== shellBoundary)) || + 0 !== (workInProgressRootSkippedLanes & 134217727) || + 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) + ? 3 + : 2; + } else + thrownValue === SuspenseyCommitException + ? ((thrownValue = getSuspendedThenable()), + (workInProgressSuspendedReason = 4)) + : (workInProgressSuspendedReason = + thrownValue === SelectiveHydrationException + ? 8 + : null !== thrownValue && + "object" === typeof thrownValue && + "function" === typeof thrownValue.then + ? 6 + : 1); workInProgressThrownValue = thrownValue; null === workInProgress && ((workInProgressRootExitStatus = 1), - (workInProgressRootFatalError = thrownValue)); + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + )); } function pushDispatcher() { var prevDispatcher = ReactCurrentDispatcher.current; @@ -9699,8 +9699,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$117) { - handleThrow(root, thrownValue$117); + } catch (thrownValue$116) { + handleThrow(root, thrownValue$116); } while (1); lanes && root.shellSuspendCounter++; @@ -9808,8 +9808,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$119) { - handleThrow(root, thrownValue$119); + } catch (thrownValue$118) { + handleThrow(root, thrownValue$118); } while (1); resetContextDependencies(); @@ -9905,14 +9905,20 @@ function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { ) ) { workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); workInProgress = null; return; } } catch (error) { if (null !== returnFiber) throw ((workInProgress = returnFiber), error); workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); workInProgress = null; return; } @@ -10066,13 +10072,6 @@ function commitRootImpl( componentStack: remainingLanes.stack }), renderPriorityLevel(remainingLanes.value, transitions); - if (hasUncaughtError) - throw ( - ((hasUncaughtError = !1), - (root = firstUncaughtError), - (firstUncaughtError = null), - root) - ); 0 !== (pendingPassiveEffectsLanes & 3) && 0 !== root.tag && flushPassiveEffects(); @@ -10821,10 +10820,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1175 = { + devToolsConfig$jscomp$inline_1165 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "19.0.0-canary-1149c8ba", + version: "19.0.0-canary-0dd4e460", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10840,11 +10839,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1428 = { - bundleType: devToolsConfig$jscomp$inline_1175.bundleType, - version: devToolsConfig$jscomp$inline_1175.version, - rendererPackageName: devToolsConfig$jscomp$inline_1175.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1175.rendererConfig, +var internals$jscomp$inline_1416 = { + bundleType: devToolsConfig$jscomp$inline_1165.bundleType, + version: devToolsConfig$jscomp$inline_1165.version, + rendererPackageName: devToolsConfig$jscomp$inline_1165.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1165.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10860,26 +10859,26 @@ var internals$jscomp$inline_1428 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1175.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1165.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-1149c8ba" + reconcilerVersion: "19.0.0-canary-0dd4e460" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1429 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1417 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1429.isDisabled && - hook$jscomp$inline_1429.supportsFiber + !hook$jscomp$inline_1417.isDisabled && + hook$jscomp$inline_1417.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1429.inject( - internals$jscomp$inline_1428 + (rendererID = hook$jscomp$inline_1417.inject( + internals$jscomp$inline_1416 )), - (injectedHook = hook$jscomp$inline_1429); + (injectedHook = hook$jscomp$inline_1417); } 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 73cbe8916c057..4b5db1e78950c 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<<14a99595e5982b14efdba0ab338639e9>> + * @generated SignedSource<> */ "use strict"; @@ -897,7 +897,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_271 = { +var injectedNamesToPlugins$jscomp$inline_270 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -943,32 +943,32 @@ var injectedNamesToPlugins$jscomp$inline_271 = { } } }, - isOrderingDirty$jscomp$inline_272 = !1, - pluginName$jscomp$inline_273; -for (pluginName$jscomp$inline_273 in injectedNamesToPlugins$jscomp$inline_271) + isOrderingDirty$jscomp$inline_271 = !1, + pluginName$jscomp$inline_272; +for (pluginName$jscomp$inline_272 in injectedNamesToPlugins$jscomp$inline_270) if ( - injectedNamesToPlugins$jscomp$inline_271.hasOwnProperty( - pluginName$jscomp$inline_273 + injectedNamesToPlugins$jscomp$inline_270.hasOwnProperty( + pluginName$jscomp$inline_272 ) ) { - var pluginModule$jscomp$inline_274 = - injectedNamesToPlugins$jscomp$inline_271[pluginName$jscomp$inline_273]; + var pluginModule$jscomp$inline_273 = + injectedNamesToPlugins$jscomp$inline_270[pluginName$jscomp$inline_272]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_273) || - namesToPlugins[pluginName$jscomp$inline_273] !== - pluginModule$jscomp$inline_274 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_272) || + namesToPlugins[pluginName$jscomp$inline_272] !== + pluginModule$jscomp$inline_273 ) { - if (namesToPlugins[pluginName$jscomp$inline_273]) + if (namesToPlugins[pluginName$jscomp$inline_272]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_273 + "`.") + (pluginName$jscomp$inline_272 + "`.") ); - namesToPlugins[pluginName$jscomp$inline_273] = - pluginModule$jscomp$inline_274; - isOrderingDirty$jscomp$inline_272 = !0; + namesToPlugins[pluginName$jscomp$inline_272] = + pluginModule$jscomp$inline_273; + isOrderingDirty$jscomp$inline_271 = !0; } } -isOrderingDirty$jscomp$inline_272 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_271 && recomputePluginOrdering(); var instanceCache = new Map(), instanceProps = new Map(); function getInstanceFromTag(tag) { @@ -2344,101 +2344,26 @@ function ensureRootIsScheduled(root) { } function flushSyncWorkAcrossRoots_impl(onlyLegacy) { if (!isFlushingWork && mightHavePendingSyncWork) { - var errors = null; isFlushingWork = !0; do { var didPerformSomeWork = !1; for (var root = firstScheduledRoot; null !== root; ) { if (!onlyLegacy || 0 === root.tag) { - var workInProgressRootRenderLanes$15 = workInProgressRootRenderLanes, - nextLanes = getNextLanes( - root, - root === workInProgressRoot ? workInProgressRootRenderLanes$15 : 0 - ); - if (0 !== (nextLanes & 3)) - try { - didPerformSomeWork = !0; - workInProgressRootRenderLanes$15 = root; - if (0 !== (executionContext & 6)) - throw Error("Should not already be working."); - if (!flushPassiveEffects()) { - currentUpdateIsNested = nestedUpdateScheduled; - nestedUpdateScheduled = !1; - var exitStatus = renderRootSync( - workInProgressRootRenderLanes$15, - nextLanes - ); - if ( - 0 !== workInProgressRootRenderLanes$15.tag && - 2 === exitStatus - ) { - var originallyAttemptedLanes = nextLanes, - errorRetryLanes = getLanesToRetrySynchronouslyOnError( - workInProgressRootRenderLanes$15, - originallyAttemptedLanes - ); - 0 !== errorRetryLanes && - ((nextLanes = errorRetryLanes), - (exitStatus = recoverFromConcurrentError( - workInProgressRootRenderLanes$15, - originallyAttemptedLanes, - errorRetryLanes - ))); - } - if (1 === exitStatus) - throw ( - ((originallyAttemptedLanes = workInProgressRootFatalError), - prepareFreshStack(workInProgressRootRenderLanes$15, 0), - markRootSuspended( - workInProgressRootRenderLanes$15, - nextLanes, - 0 - ), - ensureRootIsScheduled(workInProgressRootRenderLanes$15), - originallyAttemptedLanes) - ); - 6 === exitStatus - ? markRootSuspended( - workInProgressRootRenderLanes$15, - nextLanes, - workInProgressDeferredLane - ) - : ((workInProgressRootRenderLanes$15.finishedWork = - workInProgressRootRenderLanes$15.current.alternate), - (workInProgressRootRenderLanes$15.finishedLanes = - nextLanes), - commitRoot( - workInProgressRootRenderLanes$15, - workInProgressRootRecoverableErrors, - workInProgressTransitions, - workInProgressRootDidIncludeRecursiveRenderUpdate, - workInProgressDeferredLane - )); - } - ensureRootIsScheduled(workInProgressRootRenderLanes$15); - } catch (error) { - null === errors ? (errors = [error]) : errors.push(error); - } + var workInProgressRootRenderLanes$15 = workInProgressRootRenderLanes; + workInProgressRootRenderLanes$15 = getNextLanes( + root, + root === workInProgressRoot ? workInProgressRootRenderLanes$15 : 0 + ); + 0 !== (workInProgressRootRenderLanes$15 & 3) && + ((didPerformSomeWork = !0), + performSyncWorkOnRoot(root, workInProgressRootRenderLanes$15)); } root = root.next; } } while (didPerformSomeWork); isFlushingWork = !1; - if (null !== errors) { - if (1 < errors.length) { - if ("function" === typeof AggregateError) - throw new AggregateError(errors); - for (onlyLegacy = 1; onlyLegacy < errors.length; onlyLegacy++) - (didPerformSomeWork = throwError.bind(null, errors[onlyLegacy])), - scheduleCallback$3(ImmediatePriority, didPerformSomeWork); - } - throw errors[0]; - } } } -function throwError(error) { - throw error; -} function processRootScheduleInMicrotask() { mightHavePendingSyncWork = didScheduleMicrotask = !1; for ( @@ -2907,16 +2832,16 @@ function describeNativeComponentFrame(fn, construct) { } else { try { Fake.call(); - } catch (x$21) { - control = x$21; + } catch (x$20) { + control = x$20; } fn.call(Fake.prototype); } } else { try { throw Error(); - } catch (x$22) { - control = x$22; + } catch (x$21) { + control = x$21; } (Fake = fn()) && "function" === typeof Fake.catch && @@ -4217,7 +4142,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$36 = !1; + didReadFromEntangledAsyncAction$35 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -4230,7 +4155,7 @@ function updateReducerImpl(hook, current, reducer) { if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$36 = !0); + (didReadFromEntangledAsyncAction$35 = !0); continue; } else (updateLane = { @@ -4259,7 +4184,7 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$36 = !0); + (didReadFromEntangledAsyncAction$35 = !0); updateLane = update.action; shouldDoubleInvokeUserFnsInHooksDEV && reducer(pendingQueue, updateLane); @@ -4289,7 +4214,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$36 && + didReadFromEntangledAsyncAction$35 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -5435,15 +5360,49 @@ if ( throw Error( "Expected ReactFiberErrorDialog.showErrorDialog to be a function." ); +var reportGlobalError = + "function" === typeof reportError + ? reportError + : function (error) { + if ( + "object" === typeof window && + "function" === typeof window.ErrorEvent + ) { + var event = new window.ErrorEvent("error", { + bubbles: !0, + cancelable: !0, + message: + "object" === typeof error && + null !== error && + "string" === typeof error.message + ? String(error.message) + : String(error), + error: error + }); + if (!window.dispatchEvent(event)) return; + } else if ( + "object" === typeof process && + "function" === typeof process.emit + ) { + process.emit("uncaughtException", error); + return; + } + console.error(error); + }; function logCapturedError(boundary, errorInfo) { try { - !1 !== + if ( + !1 !== ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog({ componentStack: null !== errorInfo.stack ? errorInfo.stack : "", error: errorInfo.value, errorBoundary: null !== boundary && 1 === boundary.tag ? boundary.stateNode : null - }) && console.error(errorInfo.value); + }) + ) { + var error = errorInfo.value; + 3 === boundary.tag ? reportGlobalError(error) : console.error(error); + } } catch (e) { setTimeout(function () { throw e; @@ -5454,9 +5413,7 @@ function createRootErrorUpdate(fiber, errorInfo, lane) { lane = createUpdate(lane); lane.tag = 3; lane.payload = { element: null }; - var error = errorInfo.value; lane.callback = function () { - hasUncaughtError || ((hasUncaughtError = !0), (firstUncaughtError = error)); logCapturedError(fiber, errorInfo); }; return lane; @@ -7426,14 +7383,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$76 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$76 = lastTailNode), + for (var lastTailNode$75 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$75 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$76 + null === lastTailNode$75 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$76.sibling = null); + : (lastTailNode$75.sibling = null); } } function bubbleProperties(completedWork) { @@ -7445,53 +7402,53 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$78 = completedWork.selfBaseDuration, - child$79 = completedWork.child; - null !== child$79; + var treeBaseDuration$77 = completedWork.selfBaseDuration, + child$78 = completedWork.child; + null !== child$78; ) - (newChildLanes |= child$79.lanes | child$79.childLanes), - (subtreeFlags |= child$79.subtreeFlags & 31457280), - (subtreeFlags |= child$79.flags & 31457280), - (treeBaseDuration$78 += child$79.treeBaseDuration), - (child$79 = child$79.sibling); - completedWork.treeBaseDuration = treeBaseDuration$78; + (newChildLanes |= child$78.lanes | child$78.childLanes), + (subtreeFlags |= child$78.subtreeFlags & 31457280), + (subtreeFlags |= child$78.flags & 31457280), + (treeBaseDuration$77 += child$78.treeBaseDuration), + (child$78 = child$78.sibling); + completedWork.treeBaseDuration = treeBaseDuration$77; } else for ( - treeBaseDuration$78 = completedWork.child; - null !== treeBaseDuration$78; + treeBaseDuration$77 = completedWork.child; + null !== treeBaseDuration$77; ) (newChildLanes |= - treeBaseDuration$78.lanes | treeBaseDuration$78.childLanes), - (subtreeFlags |= treeBaseDuration$78.subtreeFlags & 31457280), - (subtreeFlags |= treeBaseDuration$78.flags & 31457280), - (treeBaseDuration$78.return = completedWork), - (treeBaseDuration$78 = treeBaseDuration$78.sibling); + treeBaseDuration$77.lanes | treeBaseDuration$77.childLanes), + (subtreeFlags |= treeBaseDuration$77.subtreeFlags & 31457280), + (subtreeFlags |= treeBaseDuration$77.flags & 31457280), + (treeBaseDuration$77.return = completedWork), + (treeBaseDuration$77 = treeBaseDuration$77.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$78 = completedWork.actualDuration; - child$79 = completedWork.selfBaseDuration; + treeBaseDuration$77 = completedWork.actualDuration; + child$78 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$78 += child.actualDuration), - (child$79 += child.treeBaseDuration), + (treeBaseDuration$77 += child.actualDuration), + (child$78 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$78; - completedWork.treeBaseDuration = child$79; + completedWork.actualDuration = treeBaseDuration$77; + completedWork.treeBaseDuration = child$78; } else for ( - treeBaseDuration$78 = completedWork.child; - null !== treeBaseDuration$78; + treeBaseDuration$77 = completedWork.child; + null !== treeBaseDuration$77; ) (newChildLanes |= - treeBaseDuration$78.lanes | treeBaseDuration$78.childLanes), - (subtreeFlags |= treeBaseDuration$78.subtreeFlags), - (subtreeFlags |= treeBaseDuration$78.flags), - (treeBaseDuration$78.return = completedWork), - (treeBaseDuration$78 = treeBaseDuration$78.sibling); + treeBaseDuration$77.lanes | treeBaseDuration$77.childLanes), + (subtreeFlags |= treeBaseDuration$77.subtreeFlags), + (subtreeFlags |= treeBaseDuration$77.flags), + (treeBaseDuration$77.return = completedWork), + (treeBaseDuration$77 = treeBaseDuration$77.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -8055,8 +8012,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { recordLayoutEffectDuration(current); } else ref(null); - } catch (error$104) { - captureCommitPhaseError(current, nearestMountedAncestor, error$104); + } catch (error$103) { + captureCommitPhaseError(current, nearestMountedAncestor, error$103); } else ref.current = null; } @@ -8189,10 +8146,10 @@ function commitHookEffectListMount(flags, finishedWork) { injectedProfilingHooks.markComponentLayoutEffectMountStarted( finishedWork ); - var create$105 = effect.create, + var create$104 = effect.create, inst = effect.inst; - create$105 = create$105(); - inst.destroy = create$105; + create$104 = create$104(); + inst.destroy = create$104; 0 !== (flags & 8) ? null !== injectedProfilingHooks && "function" === @@ -8220,8 +8177,8 @@ function commitHookLayoutEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$107) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$107); + } catch (error$106) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$106); } } function commitClassCallbacks(finishedWork) { @@ -8301,11 +8258,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { } else try { finishedRoot.componentDidMount(); - } catch (error$108) { + } catch (error$107) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$108 + error$107 ); } else { @@ -8322,11 +8279,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$109) { + } catch (error$108) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$109 + error$108 ); } recordLayoutEffectDuration(finishedWork); @@ -8337,11 +8294,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$110) { + } catch (error$109) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$110 + error$109 ); } } @@ -8831,22 +8788,22 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { startLayoutEffectTimer(), commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$119) { + } catch (error$118) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$119 + error$118 ); } recordLayoutEffectDuration(finishedWork); } else try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$120) { + } catch (error$119) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$120 + error$119 ); } } @@ -8894,8 +8851,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { viewConfig.uiViewClassName, updatePayload ); - } catch (error$123) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$123); + } catch (error$122) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$122); } } break; @@ -8915,8 +8872,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { "RCTRawText", { text: current } ); - } catch (error$124) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$124); + } catch (error$123) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$123); } } break; @@ -9028,11 +8985,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === current) try { throw Error("Not yet implemented."); - } catch (error$113) { + } catch (error$112) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$113 + error$112 ); } } else if ( @@ -9106,12 +9063,12 @@ function commitReconciliationEffects(finishedWork) { break; case 3: case 4: - var parent$114 = JSCompiler_inline_result.stateNode.containerInfo, - before$115 = getHostSibling(finishedWork); + var parent$113 = JSCompiler_inline_result.stateNode.containerInfo, + before$114 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$115, - parent$114 + before$114, + parent$113 ); break; default: @@ -9297,8 +9254,8 @@ function commitHookPassiveMountEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$128) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$128); + } catch (error$127) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$127); } } function commitOffscreenPassiveMountEffects(current, finishedWork) { @@ -9777,7 +9734,6 @@ var DefaultCacheDispatcher = { workInProgressRootDidAttachPingListener = !1, entangledRenderLanes = 0, workInProgressRootExitStatus = 0, - workInProgressRootFatalError = null, workInProgressRootSkippedLanes = 0, workInProgressRootInterleavedUpdatedLanes = 0, workInProgressRootPingedLanes = 0, @@ -9789,8 +9745,6 @@ var DefaultCacheDispatcher = { globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, workInProgressTransitions = null, - hasUncaughtError = !1, - firstUncaughtError = null, legacyErrorBoundariesThatAlreadyFailed = null, rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = null, @@ -9896,14 +9850,11 @@ function performConcurrentWorkOnRoot(root, didTimeout) { errorRetryLanes ))); } - if (1 === exitStatus) - throw ( - ((originalCallbackNode = workInProgressRootFatalError), - prepareFreshStack(root, 0), - markRootSuspended(root, lanes, 0), - ensureRootIsScheduled(root), - originalCallbackNode) - ); + if (1 === exitStatus) { + prepareFreshStack(root, 0); + markRootSuspended(root, lanes, 0); + break; + } root.finishedWork = didTimeout; root.finishedLanes = lanes; a: { @@ -10086,6 +10037,52 @@ function markRootSuspended(root, suspendedLanes, spawnedLane) { 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } +function performSyncWorkOnRoot(root, lanes) { + if (0 !== (executionContext & 6)) + throw Error("Should not already be working."); + if (flushPassiveEffects()) return ensureRootIsScheduled(root), null; + currentUpdateIsNested = nestedUpdateScheduled; + nestedUpdateScheduled = !1; + var exitStatus = renderRootSync(root, lanes); + if (0 !== root.tag && 2 === exitStatus) { + var originallyAttemptedLanes = lanes, + errorRetryLanes = getLanesToRetrySynchronouslyOnError( + root, + originallyAttemptedLanes + ); + 0 !== errorRetryLanes && + ((lanes = errorRetryLanes), + (exitStatus = recoverFromConcurrentError( + root, + originallyAttemptedLanes, + errorRetryLanes + ))); + } + if (1 === exitStatus) + return ( + prepareFreshStack(root, 0), + markRootSuspended(root, lanes, 0), + ensureRootIsScheduled(root), + null + ); + if (6 === exitStatus) + return ( + markRootSuspended(root, lanes, workInProgressDeferredLane), + ensureRootIsScheduled(root), + null + ); + root.finishedWork = root.current.alternate; + root.finishedLanes = lanes; + commitRoot( + root, + workInProgressRootRecoverableErrors, + workInProgressTransitions, + workInProgressRootDidIncludeRecursiveRenderUpdate, + workInProgressDeferredLane + ); + ensureRootIsScheduled(root); + return null; +} function resetWorkInProgressStack() { if (null !== workInProgress) { if (0 === workInProgressSuspendedReason) @@ -10119,12 +10116,11 @@ function prepareFreshStack(root, lanes) { workInProgressSuspendedReason = 0; workInProgressThrownValue = null; workInProgressRootDidAttachPingListener = !1; - workInProgressRootExitStatus = 0; - workInProgressRootFatalError = null; workInProgressDeferredLane = workInProgressRootPingedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = + workInProgressRootExitStatus = 0; workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors = null; @@ -10150,41 +10146,46 @@ function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; ReactCurrentOwner.current = null; - thrownValue === SuspenseException - ? ((thrownValue = getSuspendedThenable()), - (root = suspenseHandlerStackCursor.current), - (workInProgressSuspendedReason = - (null !== root && - ((workInProgressRootRenderLanes & 4194176) === - workInProgressRootRenderLanes - ? null !== shellBoundary - : ((workInProgressRootRenderLanes & 62914560) !== - workInProgressRootRenderLanes && - 0 === (workInProgressRootRenderLanes & 536870912)) || - root !== shellBoundary)) || - 0 !== (workInProgressRootSkippedLanes & 134217727) || - 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) - ? 3 - : 2)) - : thrownValue === SuspenseyCommitException - ? ((thrownValue = getSuspendedThenable()), - (workInProgressSuspendedReason = 4)) - : (workInProgressSuspendedReason = - thrownValue === SelectiveHydrationException - ? 8 - : null !== thrownValue && - "object" === typeof thrownValue && - "function" === typeof thrownValue.then - ? 6 - : 1); + if (thrownValue === SuspenseException) { + thrownValue = getSuspendedThenable(); + var handler = suspenseHandlerStackCursor.current; + workInProgressSuspendedReason = + (null !== handler && + ((workInProgressRootRenderLanes & 4194176) === + workInProgressRootRenderLanes + ? null !== shellBoundary + : ((workInProgressRootRenderLanes & 62914560) !== + workInProgressRootRenderLanes && + 0 === (workInProgressRootRenderLanes & 536870912)) || + handler !== shellBoundary)) || + 0 !== (workInProgressRootSkippedLanes & 134217727) || + 0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727) + ? 3 + : 2; + } else + thrownValue === SuspenseyCommitException + ? ((thrownValue = getSuspendedThenable()), + (workInProgressSuspendedReason = 4)) + : (workInProgressSuspendedReason = + thrownValue === SelectiveHydrationException + ? 8 + : null !== thrownValue && + "object" === typeof thrownValue && + "function" === typeof thrownValue.then + ? 6 + : 1); workInProgressThrownValue = thrownValue; - root = workInProgress; - if (null === root) + handler = workInProgress; + if (null === handler) (workInProgressRootExitStatus = 1), - (workInProgressRootFatalError = thrownValue); + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); else switch ( - (root.mode & 2 && stopProfilerTimerIfRunningAndRecordDelta(root, !0), + (handler.mode & 2 && + stopProfilerTimerIfRunningAndRecordDelta(handler, !0), markComponentRenderStopped(), workInProgressSuspendedReason) ) { @@ -10192,7 +10193,7 @@ function handleThrow(root, thrownValue) { null !== injectedProfilingHooks && "function" === typeof injectedProfilingHooks.markComponentErrored && injectedProfilingHooks.markComponentErrored( - root, + handler, thrownValue, workInProgressRootRenderLanes ); @@ -10204,7 +10205,7 @@ function handleThrow(root, thrownValue) { null !== injectedProfilingHooks && "function" === typeof injectedProfilingHooks.markComponentSuspended && injectedProfilingHooks.markComponentSuspended( - root, + handler, thrownValue, workInProgressRootRenderLanes ); @@ -10272,8 +10273,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$133) { - handleThrow(root, thrownValue$133); + } catch (thrownValue$132) { + handleThrow(root, thrownValue$132); } while (1); lanes && root.shellSuspendCounter++; @@ -10392,8 +10393,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$135) { - handleThrow(root, thrownValue$135); + } catch (thrownValue$134) { + handleThrow(root, thrownValue$134); } while (1); resetContextDependencies(); @@ -10506,14 +10507,20 @@ function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { ) ) { workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); workInProgress = null; return; } } catch (error) { if (null !== returnFiber) throw ((workInProgress = returnFiber), error); workInProgressRootExitStatus = 1; - workInProgressRootFatalError = thrownValue; + logCapturedError( + root.current, + createCapturedValueAtFiber(thrownValue, root.current) + ); workInProgress = null; return; } @@ -10687,13 +10694,6 @@ function commitRootImpl( componentStack: remainingLanes.stack }), renderPriorityLevel(remainingLanes.value, transitions); - if (hasUncaughtError) - throw ( - ((hasUncaughtError = !1), - (root = firstUncaughtError), - (firstUncaughtError = null), - root) - ); 0 !== (pendingPassiveEffectsLanes & 3) && 0 !== root.tag && flushPassiveEffects(); @@ -10764,7 +10764,7 @@ function flushPassiveEffects() { _finishedWork$memoize = finishedWork.memoizedProps, id = _finishedWork$memoize.id, onPostCommit = _finishedWork$memoize.onPostCommit, - commitTime$106 = commitTime, + commitTime$105 = commitTime, phase = null === finishedWork.alternate ? "mount" : "update"; currentUpdateIsNested && (phase = "nested-update"); "function" === typeof onPostCommit && @@ -10772,7 +10772,7 @@ function flushPassiveEffects() { id, phase, passiveEffectDuration, - commitTime$106 + commitTime$105 ); var parentFiber = finishedWork.return; b: for (; null !== parentFiber; ) { @@ -11528,10 +11528,10 @@ batchedUpdatesImpl = function (fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1256 = { + devToolsConfig$jscomp$inline_1247 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "19.0.0-canary-cb8d857e", + version: "19.0.0-canary-1c73f0d8", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -11561,10 +11561,10 @@ var roots = new Map(), } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1256.bundleType, - version: devToolsConfig$jscomp$inline_1256.version, - rendererPackageName: devToolsConfig$jscomp$inline_1256.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1256.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1247.bundleType, + version: devToolsConfig$jscomp$inline_1247.version, + rendererPackageName: devToolsConfig$jscomp$inline_1247.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1247.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -11580,14 +11580,14 @@ var roots = new Map(), return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1256.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1247.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-cb8d857e" + reconcilerVersion: "19.0.0-canary-1c73f0d8" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { computeComponentStackForErrorReporting: function (reactTag) {