From 2de2c20e92164b55aa4e17dfee33489eeff7ad88 Mon Sep 17 00:00:00 2001 From: sebmarkbage Date: Thu, 23 May 2024 16:45:21 +0000 Subject: [PATCH] Set the current fiber to the source of the error during error reporting (#29044) This lets us expose the component stack to the error reporting that happens here as `console.error` patching. Now if you just call `console.error` in the error handlers it'll get the component stack added to the end by React DevTools. However, unfortunately this happens a little too late so the Fiber will be disconnected with its `.return` pointer set to null already. So it'll be too late to extract a parent component stack from but you can at least get the stack from source to error boundary. To work around this I manually add the parent component stack in our default handlers when owner stacks are off. We could potentially fix this but you can also just include it yourself if you're calling `console.error` and it's not a problem for owner stacks. This is not a problem for owner stacks because we'll still have those and so for those just calling `console.error` just works. However, the main feature is that by letting React add them, we can switch to using native error stacks when available. DiffTrain build for [2e540e22b2b4038a278b2875306976b016fb31a9](https://github.com/facebook/react/commit/2e540e22b2b4038a278b2875306976b016fb31a9) --- compiled/facebook-www/REVISION | 2 +- compiled/facebook-www/ReactART-dev.classic.js | 16 +++++- compiled/facebook-www/ReactART-dev.modern.js | 16 +++++- compiled/facebook-www/ReactDOM-dev.classic.js | 49 +++++++++++++++---- compiled/facebook-www/ReactDOM-dev.modern.js | 49 +++++++++++++++---- .../ReactDOMTesting-dev.classic.js | 49 +++++++++++++++---- .../ReactDOMTesting-dev.modern.js | 49 +++++++++++++++---- .../ReactReconciler-dev.classic.js | 49 +++++++++++++++---- .../ReactReconciler-dev.modern.js | 49 +++++++++++++++---- .../ReactTestRenderer-dev.classic.js | 49 +++++++++++++++---- .../ReactTestRenderer-dev.modern.js | 49 +++++++++++++++---- .../__test_utils__/ReactAllWarnings.js | 2 + 12 files changed, 353 insertions(+), 75 deletions(-) diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index 84bfc1ac369e3..ebe1927dab20f 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -2e3e6a9b1cc97ec91248be74565e7ccbf6946067 +2e540e22b2b4038a278b2875306976b016fb31a9 diff --git a/compiled/facebook-www/ReactART-dev.classic.js b/compiled/facebook-www/ReactART-dev.classic.js index ec42b43f2e056..ff4d5457d1509 100644 --- a/compiled/facebook-www/ReactART-dev.classic.js +++ b/compiled/facebook-www/ReactART-dev.classic.js @@ -60,7 +60,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = '19.0.0-www-classic-53ce7a77'; +var ReactVersion = '19.0.0-www-classic-15c5a6dc'; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -12491,7 +12491,11 @@ function createRootErrorUpdate(root, errorInfo, lane) { }; update.callback = function () { + var prevFiber = getCurrentFiber(); // should just be the root + + setCurrentDebugFiberInDEV(errorInfo.source); logUncaughtError(root, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; return update; @@ -12518,7 +12522,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; } @@ -12531,7 +12539,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); if (typeof getDerivedStateFromError !== 'function') { // To preserve the preexisting retry behavior of error boundaries, @@ -24159,7 +24171,9 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh for (var i = 0; i < recoverableErrors.length; i++) { var recoverableError = recoverableErrors[i]; var errorInfo = makeErrorInfo(recoverableError.stack); + setCurrentDebugFiberInDEV(recoverableError.source); onRecoverableError(recoverableError.value, errorInfo); + resetCurrentDebugFiberInDEV(); } } // 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 diff --git a/compiled/facebook-www/ReactART-dev.modern.js b/compiled/facebook-www/ReactART-dev.modern.js index aef7e485ae738..cc447b8ff9824 100644 --- a/compiled/facebook-www/ReactART-dev.modern.js +++ b/compiled/facebook-www/ReactART-dev.modern.js @@ -60,7 +60,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = '19.0.0-www-modern-d3cf6c2c'; +var ReactVersion = '19.0.0-www-modern-1bbec70f'; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -12256,7 +12256,11 @@ function createRootErrorUpdate(root, errorInfo, lane) { }; update.callback = function () { + var prevFiber = getCurrentFiber(); // should just be the root + + setCurrentDebugFiberInDEV(errorInfo.source); logUncaughtError(root, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; return update; @@ -12283,7 +12287,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; } @@ -12296,7 +12304,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); if (typeof getDerivedStateFromError !== 'function') { // To preserve the preexisting retry behavior of error boundaries, @@ -23513,7 +23525,9 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh for (var i = 0; i < recoverableErrors.length; i++) { var recoverableError = recoverableErrors[i]; var errorInfo = makeErrorInfo(recoverableError.stack); + setCurrentDebugFiberInDEV(recoverableError.source); onRecoverableError(recoverableError.value, errorInfo); + resetCurrentDebugFiberInDEV(); } } // 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 diff --git a/compiled/facebook-www/ReactDOM-dev.classic.js b/compiled/facebook-www/ReactDOM-dev.classic.js index 929f2a27b946d..4c26c12c967cb 100644 --- a/compiled/facebook-www/ReactDOM-dev.classic.js +++ b/compiled/facebook-www/ReactDOM-dev.classic.js @@ -16244,22 +16244,39 @@ function defaultOnUncaughtError(error, errorInfo) { reportGlobalError(error); { - var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; - 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.'); + var componentNameMessage = componentName ? "An error occurred in the <" + componentName + "> component." : 'An error occurred in one of your React components.'; + var errorBoundaryMessage = '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.'; + + { + // The current Fiber is disconnected at this point which means that console printing + // cannot add a component stack since it terminates at the deletion node. This is not + // a problem for owner stacks which are not disconnected but for the parent component + // stacks we need to use the snapshot we've previously extracted. + var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; // Don't transform to our wrapper + + console['warn']('%s\n\n%s\n%s', componentNameMessage, errorBoundaryMessage, componentStack); + } } } -function defaultOnCaughtError(error, errorInfo) { +function defaultOnCaughtError(error$1, errorInfo) { // Overriding this can silence these warnings e.g. for tests. // See https://github.com/facebook/react/pull/13384 // Caught by error boundary { - var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; - var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:'; // In development, we provide our own message which includes the component stack + var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component." : 'The above error occurred in one of your React components.'; // In development, we provide our own message which includes the component stack // in addition to the error. - // Don't transform to our wrapper - 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 || 'Anonymous') + ".")); + var recreateMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + (errorBoundaryName || 'Anonymous') + "."); + + { + // The current Fiber is disconnected at this point which means that console printing + // cannot add a component stack since it terminates at the deletion node. This is not + // a problem for owner stacks which are not disconnected but for the parent component + // stacks we need to use the snapshot we've previously extracted. + var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; // Don't transform to our wrapper + + console['error']('%o\n\n%s\n\n%s\n%s', error$1, componentNameMessage, recreateMessage, componentStack); + } } } function defaultOnRecoverableError(error, errorInfo) { @@ -16331,7 +16348,11 @@ function createRootErrorUpdate(root, errorInfo, lane) { }; update.callback = function () { + var prevFiber = getCurrentFiber(); // should just be the root + + setCurrentDebugFiberInDEV(errorInfo.source); logUncaughtError(root, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; return update; @@ -16358,7 +16379,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; } @@ -16371,7 +16396,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); if (typeof getDerivedStateFromError !== 'function') { // To preserve the preexisting retry behavior of error boundaries, @@ -28862,7 +28891,9 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh for (var i = 0; i < recoverableErrors.length; i++) { var recoverableError = recoverableErrors[i]; var errorInfo = makeErrorInfo(recoverableError.stack); + setCurrentDebugFiberInDEV(recoverableError.source); onRecoverableError(recoverableError.value, errorInfo); + resetCurrentDebugFiberInDEV(); } } // 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 @@ -30852,7 +30883,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-classic-d3c0ad7c'; +var ReactVersion = '19.0.0-www-classic-6551c42e'; function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation. implementation) { diff --git a/compiled/facebook-www/ReactDOM-dev.modern.js b/compiled/facebook-www/ReactDOM-dev.modern.js index 70f279c28d26a..d633a28c2c744 100644 --- a/compiled/facebook-www/ReactDOM-dev.modern.js +++ b/compiled/facebook-www/ReactDOM-dev.modern.js @@ -15961,22 +15961,39 @@ function defaultOnUncaughtError(error, errorInfo) { reportGlobalError(error); { - var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; - 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.'); + var componentNameMessage = componentName ? "An error occurred in the <" + componentName + "> component." : 'An error occurred in one of your React components.'; + var errorBoundaryMessage = '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.'; + + { + // The current Fiber is disconnected at this point which means that console printing + // cannot add a component stack since it terminates at the deletion node. This is not + // a problem for owner stacks which are not disconnected but for the parent component + // stacks we need to use the snapshot we've previously extracted. + var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; // Don't transform to our wrapper + + console['warn']('%s\n\n%s\n%s', componentNameMessage, errorBoundaryMessage, componentStack); + } } } -function defaultOnCaughtError(error, errorInfo) { +function defaultOnCaughtError(error$1, errorInfo) { // Overriding this can silence these warnings e.g. for tests. // See https://github.com/facebook/react/pull/13384 // Caught by error boundary { - var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; - var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:'; // In development, we provide our own message which includes the component stack + var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component." : 'The above error occurred in one of your React components.'; // In development, we provide our own message which includes the component stack // in addition to the error. - // Don't transform to our wrapper - 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 || 'Anonymous') + ".")); + var recreateMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + (errorBoundaryName || 'Anonymous') + "."); + + { + // The current Fiber is disconnected at this point which means that console printing + // cannot add a component stack since it terminates at the deletion node. This is not + // a problem for owner stacks which are not disconnected but for the parent component + // stacks we need to use the snapshot we've previously extracted. + var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; // Don't transform to our wrapper + + console['error']('%o\n\n%s\n\n%s\n%s', error$1, componentNameMessage, recreateMessage, componentStack); + } } } function defaultOnRecoverableError(error, errorInfo) { @@ -16048,7 +16065,11 @@ function createRootErrorUpdate(root, errorInfo, lane) { }; update.callback = function () { + var prevFiber = getCurrentFiber(); // should just be the root + + setCurrentDebugFiberInDEV(errorInfo.source); logUncaughtError(root, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; return update; @@ -16075,7 +16096,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; } @@ -16088,7 +16113,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); if (typeof getDerivedStateFromError !== 'function') { // To preserve the preexisting retry behavior of error boundaries, @@ -28113,7 +28142,9 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh for (var i = 0; i < recoverableErrors.length; i++) { var recoverableError = recoverableErrors[i]; var errorInfo = makeErrorInfo(recoverableError.stack); + setCurrentDebugFiberInDEV(recoverableError.source); onRecoverableError(recoverableError.value, errorInfo); + resetCurrentDebugFiberInDEV(); } } // 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 @@ -30027,7 +30058,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-modern-533bc87e'; +var ReactVersion = '19.0.0-www-modern-c6c71924'; function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation. implementation) { diff --git a/compiled/facebook-www/ReactDOMTesting-dev.classic.js b/compiled/facebook-www/ReactDOMTesting-dev.classic.js index e6dc32ca16e7b..e5e400164d8f9 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.classic.js @@ -16385,22 +16385,39 @@ function defaultOnUncaughtError(error, errorInfo) { reportGlobalError(error); { - var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; - 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.'); + var componentNameMessage = componentName ? "An error occurred in the <" + componentName + "> component." : 'An error occurred in one of your React components.'; + var errorBoundaryMessage = '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.'; + + { + // The current Fiber is disconnected at this point which means that console printing + // cannot add a component stack since it terminates at the deletion node. This is not + // a problem for owner stacks which are not disconnected but for the parent component + // stacks we need to use the snapshot we've previously extracted. + var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; // Don't transform to our wrapper + + console['warn']('%s\n\n%s\n%s', componentNameMessage, errorBoundaryMessage, componentStack); + } } } -function defaultOnCaughtError(error, errorInfo) { +function defaultOnCaughtError(error$1, errorInfo) { // Overriding this can silence these warnings e.g. for tests. // See https://github.com/facebook/react/pull/13384 // Caught by error boundary { - var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; - var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:'; // In development, we provide our own message which includes the component stack + var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component." : 'The above error occurred in one of your React components.'; // In development, we provide our own message which includes the component stack // in addition to the error. - // Don't transform to our wrapper - 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 || 'Anonymous') + ".")); + var recreateMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + (errorBoundaryName || 'Anonymous') + "."); + + { + // The current Fiber is disconnected at this point which means that console printing + // cannot add a component stack since it terminates at the deletion node. This is not + // a problem for owner stacks which are not disconnected but for the parent component + // stacks we need to use the snapshot we've previously extracted. + var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; // Don't transform to our wrapper + + console['error']('%o\n\n%s\n\n%s\n%s', error$1, componentNameMessage, recreateMessage, componentStack); + } } } function defaultOnRecoverableError(error, errorInfo) { @@ -16472,7 +16489,11 @@ function createRootErrorUpdate(root, errorInfo, lane) { }; update.callback = function () { + var prevFiber = getCurrentFiber(); // should just be the root + + setCurrentDebugFiberInDEV(errorInfo.source); logUncaughtError(root, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; return update; @@ -16499,7 +16520,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; } @@ -16512,7 +16537,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); if (typeof getDerivedStateFromError !== 'function') { // To preserve the preexisting retry behavior of error boundaries, @@ -29428,7 +29457,9 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh for (var i = 0; i < recoverableErrors.length; i++) { var recoverableError = recoverableErrors[i]; var errorInfo = makeErrorInfo(recoverableError.stack); + setCurrentDebugFiberInDEV(recoverableError.source); onRecoverableError(recoverableError.value, errorInfo); + resetCurrentDebugFiberInDEV(); } } // 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 @@ -31418,7 +31449,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-classic-1d6fd8ed'; +var ReactVersion = '19.0.0-www-classic-29d9d3a8'; function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation. implementation) { diff --git a/compiled/facebook-www/ReactDOMTesting-dev.modern.js b/compiled/facebook-www/ReactDOMTesting-dev.modern.js index 7396dd464454a..e152a65f1ab6a 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.modern.js @@ -16102,22 +16102,39 @@ function defaultOnUncaughtError(error, errorInfo) { reportGlobalError(error); { - var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; - 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.'); + var componentNameMessage = componentName ? "An error occurred in the <" + componentName + "> component." : 'An error occurred in one of your React components.'; + var errorBoundaryMessage = '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.'; + + { + // The current Fiber is disconnected at this point which means that console printing + // cannot add a component stack since it terminates at the deletion node. This is not + // a problem for owner stacks which are not disconnected but for the parent component + // stacks we need to use the snapshot we've previously extracted. + var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; // Don't transform to our wrapper + + console['warn']('%s\n\n%s\n%s', componentNameMessage, errorBoundaryMessage, componentStack); + } } } -function defaultOnCaughtError(error, errorInfo) { +function defaultOnCaughtError(error$1, errorInfo) { // Overriding this can silence these warnings e.g. for tests. // See https://github.com/facebook/react/pull/13384 // Caught by error boundary { - var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; - var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:'; // In development, we provide our own message which includes the component stack + var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component." : 'The above error occurred in one of your React components.'; // In development, we provide our own message which includes the component stack // in addition to the error. - // Don't transform to our wrapper - 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 || 'Anonymous') + ".")); + var recreateMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + (errorBoundaryName || 'Anonymous') + "."); + + { + // The current Fiber is disconnected at this point which means that console printing + // cannot add a component stack since it terminates at the deletion node. This is not + // a problem for owner stacks which are not disconnected but for the parent component + // stacks we need to use the snapshot we've previously extracted. + var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; // Don't transform to our wrapper + + console['error']('%o\n\n%s\n\n%s\n%s', error$1, componentNameMessage, recreateMessage, componentStack); + } } } function defaultOnRecoverableError(error, errorInfo) { @@ -16189,7 +16206,11 @@ function createRootErrorUpdate(root, errorInfo, lane) { }; update.callback = function () { + var prevFiber = getCurrentFiber(); // should just be the root + + setCurrentDebugFiberInDEV(errorInfo.source); logUncaughtError(root, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; return update; @@ -16216,7 +16237,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; } @@ -16229,7 +16254,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); if (typeof getDerivedStateFromError !== 'function') { // To preserve the preexisting retry behavior of error boundaries, @@ -28679,7 +28708,9 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh for (var i = 0; i < recoverableErrors.length; i++) { var recoverableError = recoverableErrors[i]; var errorInfo = makeErrorInfo(recoverableError.stack); + setCurrentDebugFiberInDEV(recoverableError.source); onRecoverableError(recoverableError.value, errorInfo); + resetCurrentDebugFiberInDEV(); } } // 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 @@ -30593,7 +30624,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-modern-1e692f4e'; +var ReactVersion = '19.0.0-www-modern-7421d6e6'; function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation. implementation) { diff --git a/compiled/facebook-www/ReactReconciler-dev.classic.js b/compiled/facebook-www/ReactReconciler-dev.classic.js index 2ddc40d3a2f1a..9de927423f5a1 100644 --- a/compiled/facebook-www/ReactReconciler-dev.classic.js +++ b/compiled/facebook-www/ReactReconciler-dev.classic.js @@ -13175,22 +13175,39 @@ function defaultOnUncaughtError(error, errorInfo) { reportGlobalError(error); { - var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; - 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.'); + var componentNameMessage = componentName ? "An error occurred in the <" + componentName + "> component." : 'An error occurred in one of your React components.'; + var errorBoundaryMessage = '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.'; + + { + // The current Fiber is disconnected at this point which means that console printing + // cannot add a component stack since it terminates at the deletion node. This is not + // a problem for owner stacks which are not disconnected but for the parent component + // stacks we need to use the snapshot we've previously extracted. + var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; // Don't transform to our wrapper + + console['warn']('%s\n\n%s\n%s', componentNameMessage, errorBoundaryMessage, componentStack); + } } } -function defaultOnCaughtError(error, errorInfo) { +function defaultOnCaughtError(error$1, errorInfo) { // Overriding this can silence these warnings e.g. for tests. // See https://github.com/facebook/react/pull/13384 // Caught by error boundary { - var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; - var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:'; // In development, we provide our own message which includes the component stack + var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component." : 'The above error occurred in one of your React components.'; // In development, we provide our own message which includes the component stack // in addition to the error. - // Don't transform to our wrapper - 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 || 'Anonymous') + ".")); + var recreateMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + (errorBoundaryName || 'Anonymous') + "."); + + { + // The current Fiber is disconnected at this point which means that console printing + // cannot add a component stack since it terminates at the deletion node. This is not + // a problem for owner stacks which are not disconnected but for the parent component + // stacks we need to use the snapshot we've previously extracted. + var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; // Don't transform to our wrapper + + console['error']('%o\n\n%s\n\n%s\n%s', error$1, componentNameMessage, recreateMessage, componentStack); + } } } function defaultOnRecoverableError(error, errorInfo) { @@ -13262,7 +13279,11 @@ function createRootErrorUpdate(root, errorInfo, lane) { }; update.callback = function () { + var prevFiber = getCurrentFiber(); // should just be the root + + setCurrentDebugFiberInDEV(errorInfo.source); logUncaughtError(root, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; return update; @@ -13289,7 +13310,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; } @@ -13302,7 +13327,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); if (typeof getDerivedStateFromError !== 'function') { // To preserve the preexisting retry behavior of error boundaries, @@ -26652,7 +26681,9 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh for (var i = 0; i < recoverableErrors.length; i++) { var recoverableError = recoverableErrors[i]; var errorInfo = makeErrorInfo(recoverableError.stack); + setCurrentDebugFiberInDEV(recoverableError.source); onRecoverableError(recoverableError.value, errorInfo); + resetCurrentDebugFiberInDEV(); } } // 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 @@ -28650,7 +28681,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-classic-06080d9f'; +var ReactVersion = '19.0.0-www-classic-5780984f'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol diff --git a/compiled/facebook-www/ReactReconciler-dev.modern.js b/compiled/facebook-www/ReactReconciler-dev.modern.js index daefdc2d1c30c..7c32cb7ec21fb 100644 --- a/compiled/facebook-www/ReactReconciler-dev.modern.js +++ b/compiled/facebook-www/ReactReconciler-dev.modern.js @@ -12942,22 +12942,39 @@ function defaultOnUncaughtError(error, errorInfo) { reportGlobalError(error); { - var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; - 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.'); + var componentNameMessage = componentName ? "An error occurred in the <" + componentName + "> component." : 'An error occurred in one of your React components.'; + var errorBoundaryMessage = '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.'; + + { + // The current Fiber is disconnected at this point which means that console printing + // cannot add a component stack since it terminates at the deletion node. This is not + // a problem for owner stacks which are not disconnected but for the parent component + // stacks we need to use the snapshot we've previously extracted. + var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; // Don't transform to our wrapper + + console['warn']('%s\n\n%s\n%s', componentNameMessage, errorBoundaryMessage, componentStack); + } } } -function defaultOnCaughtError(error, errorInfo) { +function defaultOnCaughtError(error$1, errorInfo) { // Overriding this can silence these warnings e.g. for tests. // See https://github.com/facebook/react/pull/13384 // Caught by error boundary { - var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; - var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:'; // In development, we provide our own message which includes the component stack + var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component." : 'The above error occurred in one of your React components.'; // In development, we provide our own message which includes the component stack // in addition to the error. - // Don't transform to our wrapper - 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 || 'Anonymous') + ".")); + var recreateMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + (errorBoundaryName || 'Anonymous') + "."); + + { + // The current Fiber is disconnected at this point which means that console printing + // cannot add a component stack since it terminates at the deletion node. This is not + // a problem for owner stacks which are not disconnected but for the parent component + // stacks we need to use the snapshot we've previously extracted. + var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; // Don't transform to our wrapper + + console['error']('%o\n\n%s\n\n%s\n%s', error$1, componentNameMessage, recreateMessage, componentStack); + } } } function defaultOnRecoverableError(error, errorInfo) { @@ -13029,7 +13046,11 @@ function createRootErrorUpdate(root, errorInfo, lane) { }; update.callback = function () { + var prevFiber = getCurrentFiber(); // should just be the root + + setCurrentDebugFiberInDEV(errorInfo.source); logUncaughtError(root, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; return update; @@ -13056,7 +13077,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; } @@ -13069,7 +13094,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); if (typeof getDerivedStateFromError !== 'function') { // To preserve the preexisting retry behavior of error boundaries, @@ -25994,7 +26023,9 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh for (var i = 0; i < recoverableErrors.length; i++) { var recoverableError = recoverableErrors[i]; var errorInfo = makeErrorInfo(recoverableError.stack); + setCurrentDebugFiberInDEV(recoverableError.source); onRecoverableError(recoverableError.value, errorInfo); + resetCurrentDebugFiberInDEV(); } } // 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 @@ -27916,7 +27947,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-modern-51ae228d'; +var ReactVersion = '19.0.0-www-modern-e832d486'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol diff --git a/compiled/facebook-www/ReactTestRenderer-dev.classic.js b/compiled/facebook-www/ReactTestRenderer-dev.classic.js index bdcd21afa8e76..594bd251bb882 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.classic.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.classic.js @@ -11333,22 +11333,39 @@ function defaultOnUncaughtError(error, errorInfo) { reportGlobalError(error); { - var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; - 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.'); + var componentNameMessage = componentName ? "An error occurred in the <" + componentName + "> component." : 'An error occurred in one of your React components.'; + var errorBoundaryMessage = '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.'; + + { + // The current Fiber is disconnected at this point which means that console printing + // cannot add a component stack since it terminates at the deletion node. This is not + // a problem for owner stacks which are not disconnected but for the parent component + // stacks we need to use the snapshot we've previously extracted. + var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; // Don't transform to our wrapper + + console['warn']('%s\n\n%s\n%s', componentNameMessage, errorBoundaryMessage, componentStack); + } } } -function defaultOnCaughtError(error, errorInfo) { +function defaultOnCaughtError(error$1, errorInfo) { // Overriding this can silence these warnings e.g. for tests. // See https://github.com/facebook/react/pull/13384 // Caught by error boundary { - var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; - var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:'; // In development, we provide our own message which includes the component stack + var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component." : 'The above error occurred in one of your React components.'; // In development, we provide our own message which includes the component stack // in addition to the error. - // Don't transform to our wrapper - 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 || 'Anonymous') + ".")); + var recreateMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + (errorBoundaryName || 'Anonymous') + "."); + + { + // The current Fiber is disconnected at this point which means that console printing + // cannot add a component stack since it terminates at the deletion node. This is not + // a problem for owner stacks which are not disconnected but for the parent component + // stacks we need to use the snapshot we've previously extracted. + var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; // Don't transform to our wrapper + + console['error']('%o\n\n%s\n\n%s\n%s', error$1, componentNameMessage, recreateMessage, componentStack); + } } } function defaultOnRecoverableError(error, errorInfo) { @@ -11420,7 +11437,11 @@ function createRootErrorUpdate(root, errorInfo, lane) { }; update.callback = function () { + var prevFiber = getCurrentFiber(); // should just be the root + + setCurrentDebugFiberInDEV(errorInfo.source); logUncaughtError(root, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; return update; @@ -11447,7 +11468,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; } @@ -11460,7 +11485,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); if (typeof getDerivedStateFromError !== 'function') { // To preserve the preexisting retry behavior of error boundaries, @@ -21411,7 +21440,9 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh for (var i = 0; i < recoverableErrors.length; i++) { var recoverableError = recoverableErrors[i]; var errorInfo = makeErrorInfo(recoverableError.stack); + setCurrentDebugFiberInDEV(recoverableError.source); onRecoverableError(recoverableError.value, errorInfo); + resetCurrentDebugFiberInDEV(); } } // 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 @@ -23130,7 +23161,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-classic-a084ecf7'; +var ReactVersion = '19.0.0-www-classic-9eaf1ccb'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol diff --git a/compiled/facebook-www/ReactTestRenderer-dev.modern.js b/compiled/facebook-www/ReactTestRenderer-dev.modern.js index 1ec1a6833ddd7..b82ae6500ff60 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.modern.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.modern.js @@ -11333,22 +11333,39 @@ function defaultOnUncaughtError(error, errorInfo) { reportGlobalError(error); { - var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; - 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.'); + var componentNameMessage = componentName ? "An error occurred in the <" + componentName + "> component." : 'An error occurred in one of your React components.'; + var errorBoundaryMessage = '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.'; + + { + // The current Fiber is disconnected at this point which means that console printing + // cannot add a component stack since it terminates at the deletion node. This is not + // a problem for owner stacks which are not disconnected but for the parent component + // stacks we need to use the snapshot we've previously extracted. + var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; // Don't transform to our wrapper + + console['warn']('%s\n\n%s\n%s', componentNameMessage, errorBoundaryMessage, componentStack); + } } } -function defaultOnCaughtError(error, errorInfo) { +function defaultOnCaughtError(error$1, errorInfo) { // Overriding this can silence these warnings e.g. for tests. // See https://github.com/facebook/react/pull/13384 // Caught by error boundary { - var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; - var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:'; // In development, we provide our own message which includes the component stack + var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component." : 'The above error occurred in one of your React components.'; // In development, we provide our own message which includes the component stack // in addition to the error. - // Don't transform to our wrapper - 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 || 'Anonymous') + ".")); + var recreateMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + (errorBoundaryName || 'Anonymous') + "."); + + { + // The current Fiber is disconnected at this point which means that console printing + // cannot add a component stack since it terminates at the deletion node. This is not + // a problem for owner stacks which are not disconnected but for the parent component + // stacks we need to use the snapshot we've previously extracted. + var componentStack = errorInfo.componentStack != null ? errorInfo.componentStack : ''; // Don't transform to our wrapper + + console['error']('%o\n\n%s\n\n%s\n%s', error$1, componentNameMessage, recreateMessage, componentStack); + } } } function defaultOnRecoverableError(error, errorInfo) { @@ -11420,7 +11437,11 @@ function createRootErrorUpdate(root, errorInfo, lane) { }; update.callback = function () { + var prevFiber = getCurrentFiber(); // should just be the root + + setCurrentDebugFiberInDEV(errorInfo.source); logUncaughtError(root, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; return update; @@ -11447,7 +11468,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); }; } @@ -11460,7 +11485,11 @@ function initializeClassErrorUpdate(update, root, fiber, errorInfo) { markFailedErrorBoundaryForHotReloading(fiber); } + var prevFiber = getCurrentFiber(); // should be the error boundary + + setCurrentDebugFiberInDEV(errorInfo.source); logCaughtError(root, fiber, errorInfo); + setCurrentDebugFiberInDEV(prevFiber); if (typeof getDerivedStateFromError !== 'function') { // To preserve the preexisting retry behavior of error boundaries, @@ -21411,7 +21440,9 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh for (var i = 0; i < recoverableErrors.length; i++) { var recoverableError = recoverableErrors[i]; var errorInfo = makeErrorInfo(recoverableError.stack); + setCurrentDebugFiberInDEV(recoverableError.source); onRecoverableError(recoverableError.value, errorInfo); + resetCurrentDebugFiberInDEV(); } } // 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 @@ -23130,7 +23161,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-modern-a084ecf7'; +var ReactVersion = '19.0.0-www-modern-9eaf1ccb'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol diff --git a/compiled/facebook-www/__test_utils__/ReactAllWarnings.js b/compiled/facebook-www/__test_utils__/ReactAllWarnings.js index 93a4b4a4f7c9c..6bf413fd1ee8d 100644 --- a/compiled/facebook-www/__test_utils__/ReactAllWarnings.js +++ b/compiled/facebook-www/__test_utils__/ReactAllWarnings.js @@ -14,6 +14,8 @@ export default [ "\"%s\" is not a supported value for tail on . Did you mean \"collapsed\" or \"hidden\"?", "\"%s\" is not a valid value for revealOrder on . React uses the -s suffix in the spelling. Use \"%ss\" instead.", "\"%s\" is not a valid value for revealOrder on . Use lowercase \"%s\" instead.", + "%o\n\n%s\n\n%s\n", + "%s\n\n%s\n", "%s a style property during rerender (%s) when a conflicting property is set (%s) can lead to styling bugs. To avoid this, don't mix shorthand and non-shorthand properties for the same value; instead, replace the shorthand with separate values.", "%s contains a textarea with both value and defaultValue props. Textarea elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled textarea and remove one of these props. More info: https://react.dev/link/controlled-components", "%s contains an input of type %s with both checked and defaultChecked props. Input elements must be either controlled or uncontrolled (specify either the checked prop, or the defaultChecked prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://react.dev/link/controlled-components",