Skip to content

Commit

Permalink
Include regular stack trace in serialized errors from Fizz (#28684)
Browse files Browse the repository at this point in the history
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 b9149cc.
  • Loading branch information
sebmarkbage committed Mar 30, 2024
1 parent e4f3fc3 commit acb6876
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<9224411efbfa8776e575f8317a5cebc6>>
* @generated SignedSource<<4c8833d67d5c40def402e9b24fc93313>>
*/

"use strict";
Expand Down Expand Up @@ -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 =
Expand All @@ -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.
Expand All @@ -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(
Expand Down Expand Up @@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<389fe4c4dd5a3dc2a002349defa47aea>>
* @generated SignedSource<<7ea0ba771a3dafe13783264b14f1cffd>>
*/

"use strict";
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<81674d0a8c35b33e23ad87b78ab22d08>>
* @generated SignedSource<<0102d8d01b7c7efdce15387c6fa804bc>>
*/

"use strict";
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5d4b7587da52dd81bc5c366b909c4511e2970cd1
b9149cc6e6442389accf1f7c34a77ba2e6e52b5e
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<be8f8e1152affd8740c0c745720e9e1a>>
* @generated SignedSource<<569c28c9c7718b755c53912a8e17a0bd>>
*/

"use strict";
Expand Down Expand Up @@ -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 =
Expand All @@ -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.
Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<6caf0298fd44810887edd334677ec6ef>>
* @generated SignedSource<<6f0e7861f6743b3815fa3d44454d6dbd>>
*/

"use strict";
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<7eba5ed56d62fd3b39e8d3ac4bd0561c>>
* @generated SignedSource<<9dbe74e43cd78023236dba5059713bf8>>
*/

"use strict";
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<671deef2ff146cb90557b5929b5a868f>>
* @generated SignedSource<<29c94384161e3a1a33fb8ae6d6155a35>>
*/

"use strict";
Expand Down Expand Up @@ -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 =
Expand All @@ -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.
Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<01cbfec88e8a21340f3c759d699dada0>>
* @generated SignedSource<<6b9cf5f3bb5fc8873d7404b36e5c3753>>
*/

"use strict";
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<8e1902f82cf3871cb88745e438768098>>
* @generated SignedSource<<2fd9d14d7cf1c89a35f0ee934ecc3eda>>
*/

"use strict";
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit acb6876

Please sign in to comment.