From acb6876e035c26b7ce12cb3f3cae3c70c8e2d911 Mon Sep 17 00:00:00 2001 From: sebmarkbage Date: Sat, 30 Mar 2024 15:13:30 +0000 Subject: [PATCH] Include regular stack trace in serialized errors from Fizz (#28684) We previously only included the component stack. Cleaned up the fields in Fizz server that wasn't using consistent hidden classes in dev vs prod. Added a prefix to errors serialized from server rendering. It can be a bit confusing to see where this error came from otherwise since it didn't come from elsewhere on the client. It's really kind of confusing with other recoverable errors that happen on the client too. DiffTrain build for commit https://github.com/facebook/react/commit/b9149cc6e6442389accf1f7c34a77ba2e6e52b5e. --- .../cjs/ReactTestRenderer-dev.js | 20 ++++++++++++------- .../cjs/ReactTestRenderer-prod.js | 7 ++++--- .../cjs/ReactTestRenderer-profiling.js | 7 ++++--- .../Libraries/Renderer/REVISION | 2 +- .../implementations/ReactFabric-dev.fb.js | 20 ++++++++++++------- .../implementations/ReactFabric-prod.fb.js | 7 ++++--- .../ReactFabric-profiling.fb.js | 7 ++++--- .../ReactNativeRenderer-dev.fb.js | 20 ++++++++++++------- .../ReactNativeRenderer-prod.fb.js | 7 ++++--- .../ReactNativeRenderer-profiling.fb.js | 7 ++++--- 10 files changed, 64 insertions(+), 40 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 559cc4fe23..798bd56853 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<<9224411efbfa8776e575f8317a5cebc6>> + * @generated SignedSource<<4c8833d67d5c40def402e9b24fc93313>> */ "use strict"; @@ -15825,7 +15825,7 @@ if (__DEV__) { // get an update and we'll never be able to hydrate the final content. Let's just try the // client side render instead. var digest; - var message, stack; + var message, stack, componentStack; { var _getSuspenseInstanceF = @@ -15834,6 +15834,7 @@ if (__DEV__) { digest = _getSuspenseInstanceF.digest; message = _getSuspenseInstanceF.message; stack = _getSuspenseInstanceF.stack; + componentStack = _getSuspenseInstanceF.componentStack; } var capturedValue = null; // TODO: Figure out a better signal than encoding a magic digest value. @@ -15847,13 +15848,18 @@ if (__DEV__) { } else { error = new Error( "The server could not finish this Suspense boundary, likely " + - "due to an error during server rendering. Switched to " + - "client rendering." + "due to an error during server rendering. " + + "Switched to client rendering." ); - } + } // Replace the stack with the server stack + error.stack = stack || ""; error.digest = digest; - capturedValue = createCapturedValueFromError(error, digest, stack); + capturedValue = createCapturedValueFromError( + error, + digest, + componentStack + ); } return retrySuspenseComponentWithoutHydrating( @@ -26832,7 +26838,7 @@ if (__DEV__) { return root; } - var ReactVersion = "19.0.0-canary-74c595da"; + var ReactVersion = "19.0.0-canary-90c44db1"; // 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 f592203c98..9747994339 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<<389fe4c4dd5a3dc2a002349defa47aea>> + * @generated SignedSource<<7ea0ba771a3dafe13783264b14f1cffd>> */ "use strict"; @@ -4462,6 +4462,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (nextProps = Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." )), + (nextProps.stack = ""), (nextProps.digest = JSCompiler_temp), (JSCompiler_temp = createCapturedValueFromError( nextProps, @@ -9219,7 +9220,7 @@ var devToolsConfig$jscomp$inline_1002 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "19.0.0-canary-dd31caf0", + version: "19.0.0-canary-0ee8586e", rendererPackageName: "react-test-renderer" }; var internals$jscomp$inline_1190 = { @@ -9250,7 +9251,7 @@ var internals$jscomp$inline_1190 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-dd31caf0" + reconcilerVersion: "19.0.0-canary-0ee8586e" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1191 = __REACT_DEVTOOLS_GLOBAL_HOOK__; 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 56e1a2a664..3b0f8b7070 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<<81674d0a8c35b33e23ad87b78ab22d08>> + * @generated SignedSource<<0102d8d01b7c7efdce15387c6fa804bc>> */ "use strict"; @@ -4633,6 +4633,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (nextProps = Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." )), + (nextProps.stack = ""), (nextProps.digest = JSCompiler_temp), (JSCompiler_temp = createCapturedValueFromError( nextProps, @@ -9837,7 +9838,7 @@ var devToolsConfig$jscomp$inline_1086 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "19.0.0-canary-8fc8d975", + version: "19.0.0-canary-8b0c34a5", rendererPackageName: "react-test-renderer" }; (function (internals) { @@ -9881,7 +9882,7 @@ var devToolsConfig$jscomp$inline_1086 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-8fc8d975" + reconcilerVersion: "19.0.0-canary-8b0c34a5" }); exports._Scheduler = Scheduler; exports.act = act; 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 f7d03a3bfd..9d93b7c4f3 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 @@ -5d4b7587da52dd81bc5c366b909c4511e2970cd1 +b9149cc6e6442389accf1f7c34a77ba2e6e52b5e 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 f0dadb42a8..a17f569e47 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<569c28c9c7718b755c53912a8e17a0bd>> */ "use strict"; @@ -19485,7 +19485,7 @@ to return true:wantsResponderID| | // get an update and we'll never be able to hydrate the final content. Let's just try the // client side render instead. var digest; - var message, stack; + var message, stack, componentStack; { var _getSuspenseInstanceF = @@ -19494,6 +19494,7 @@ to return true:wantsResponderID| | digest = _getSuspenseInstanceF.digest; message = _getSuspenseInstanceF.message; stack = _getSuspenseInstanceF.stack; + componentStack = _getSuspenseInstanceF.componentStack; } var capturedValue = null; // TODO: Figure out a better signal than encoding a magic digest value. @@ -19507,13 +19508,18 @@ to return true:wantsResponderID| | } else { error = new Error( "The server could not finish this Suspense boundary, likely " + - "due to an error during server rendering. Switched to " + - "client rendering." + "due to an error during server rendering. " + + "Switched to client rendering." ); - } + } // Replace the stack with the server stack + error.stack = stack || ""; error.digest = digest; - capturedValue = createCapturedValueFromError(error, digest, stack); + capturedValue = createCapturedValueFromError( + error, + digest, + componentStack + ); } return retrySuspenseComponentWithoutHydrating( @@ -30602,7 +30608,7 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "19.0.0-canary-89cc0451"; + var ReactVersion = "19.0.0-canary-f9a3ca70"; 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 a974d3ee37..f8cb431cc8 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<<6caf0298fd44810887edd334677ec6ef>> + * @generated SignedSource<<6f0e7861f6743b3815fa3d44454d6dbd>> */ "use strict"; @@ -6009,6 +6009,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (nextProps = Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." )), + (nextProps.stack = ""), (nextProps.digest = JSCompiler_temp), (JSCompiler_temp = createCapturedValueFromError( nextProps, @@ -10638,7 +10639,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1104 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "19.0.0-canary-3aaf7c49", + version: "19.0.0-canary-1065157b", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10681,7 +10682,7 @@ var internals$jscomp$inline_1341 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-3aaf7c49" + reconcilerVersion: "19.0.0-canary-1065157b" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1342 = __REACT_DEVTOOLS_GLOBAL_HOOK__; 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 ca2ee4722f..0547fd0785 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<<7eba5ed56d62fd3b39e8d3ac4bd0561c>> + * @generated SignedSource<<9dbe74e43cd78023236dba5059713bf8>> */ "use strict"; @@ -6215,6 +6215,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (nextProps = Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." )), + (nextProps.stack = ""), (nextProps.digest = JSCompiler_temp), (JSCompiler_temp = createCapturedValueFromError( nextProps, @@ -11345,7 +11346,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1186 = { findFiberByHostInstance: getInstanceFromNode, bundleType: 0, - version: "19.0.0-canary-270b90fe", + version: "19.0.0-canary-feeb7459", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -11401,7 +11402,7 @@ var roots = new Map(), scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-270b90fe" + reconcilerVersion: "19.0.0-canary-feeb7459" }); 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 143a9568f6..5cb421a28e 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<<671deef2ff146cb90557b5929b5a868f>> + * @generated SignedSource<<29c94384161e3a1a33fb8ae6d6155a35>> */ "use strict"; @@ -19756,7 +19756,7 @@ to return true:wantsResponderID| | // get an update and we'll never be able to hydrate the final content. Let's just try the // client side render instead. var digest; - var message, stack; + var message, stack, componentStack; { var _getSuspenseInstanceF = @@ -19765,6 +19765,7 @@ to return true:wantsResponderID| | digest = _getSuspenseInstanceF.digest; message = _getSuspenseInstanceF.message; stack = _getSuspenseInstanceF.stack; + componentStack = _getSuspenseInstanceF.componentStack; } var capturedValue = null; // TODO: Figure out a better signal than encoding a magic digest value. @@ -19778,13 +19779,18 @@ to return true:wantsResponderID| | } else { error = new Error( "The server could not finish this Suspense boundary, likely " + - "due to an error during server rendering. Switched to " + - "client rendering." + "due to an error during server rendering. " + + "Switched to client rendering." ); - } + } // Replace the stack with the server stack + error.stack = stack || ""; error.digest = digest; - capturedValue = createCapturedValueFromError(error, digest, stack); + capturedValue = createCapturedValueFromError( + error, + digest, + componentStack + ); } return retrySuspenseComponentWithoutHydrating( @@ -31042,7 +31048,7 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "19.0.0-canary-5f8abb5a"; + var ReactVersion = "19.0.0-canary-366999b3"; 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 bc5260f414..256acfb944 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<<01cbfec88e8a21340f3c759d699dada0>> + * @generated SignedSource<<6b9cf5f3bb5fc8873d7404b36e5c3753>> */ "use strict"; @@ -6074,6 +6074,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (nextProps = Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." )), + (nextProps.stack = ""), (nextProps.digest = JSCompiler_temp), (JSCompiler_temp = createCapturedValueFromError( nextProps, @@ -10854,7 +10855,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1171 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "19.0.0-canary-bbd4ca50", + version: "19.0.0-canary-2d04f3bb", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -10897,7 +10898,7 @@ var internals$jscomp$inline_1422 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-bbd4ca50" + reconcilerVersion: "19.0.0-canary-2d04f3bb" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1423 = __REACT_DEVTOOLS_GLOBAL_HOOK__; 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 2749eeab2e..300409d538 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<<8e1902f82cf3871cb88745e438768098>> + * @generated SignedSource<<2fd9d14d7cf1c89a35f0ee934ecc3eda>> */ "use strict"; @@ -6280,6 +6280,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { (nextProps = Error( "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." )), + (nextProps.stack = ""), (nextProps.digest = JSCompiler_temp), (JSCompiler_temp = createCapturedValueFromError( nextProps, @@ -11562,7 +11563,7 @@ var roots = new Map(), devToolsConfig$jscomp$inline_1253 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "19.0.0-canary-0502e2a7", + version: "19.0.0-canary-7e371444", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForInstance: getInspectorDataForInstance, @@ -11618,7 +11619,7 @@ var roots = new Map(), scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-canary-0502e2a7" + reconcilerVersion: "19.0.0-canary-7e371444" }); exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { computeComponentStackForErrorReporting: function (reactTag) {