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 [b9149cc](b9149cc)
  • Loading branch information
sebmarkbage committed Mar 30, 2024
1 parent a180cdd commit 904602b
Show file tree
Hide file tree
Showing 24 changed files with 671 additions and 468 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5d4b7587da52dd81bc5c366b909c4511e2970cd1
b9149cc6e6442389accf1f7c34a77ba2e6e52b5e
18 changes: 12 additions & 6 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if (__DEV__) {
return self;
}

var ReactVersion = "19.0.0-www-classic-b8b7775c";
var ReactVersion = "19.0.0-www-classic-3ce339ba";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -17563,7 +17563,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 @@ -17572,6 +17572,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 @@ -17585,13 +17586,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
18 changes: 12 additions & 6 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if (__DEV__) {
return self;
}

var ReactVersion = "19.0.0-www-modern-c4adbf64";
var ReactVersion = "19.0.0-www-modern-78997ebd";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -17257,7 +17257,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 @@ -17266,6 +17266,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 @@ -17279,13 +17280,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
5 changes: 3 additions & 2 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -5069,6 +5069,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
else if ((pushPrimaryTreeSuspenseHandler(workInProgress), shim$2()))
(JSCompiler_temp = shim$2().digest),
(nextProps = Error(formatProdErrorMessage(419))),
(nextProps.stack = ""),
(nextProps.digest = JSCompiler_temp),
(JSCompiler_temp = createCapturedValueFromError(
nextProps,
Expand Down Expand Up @@ -10616,7 +10617,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "19.0.0-www-classic-03341623",
version: "19.0.0-www-classic-859a948c",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1324 = {
Expand Down Expand Up @@ -10647,7 +10648,7 @@ var internals$jscomp$inline_1324 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-classic-03341623"
reconcilerVersion: "19.0.0-www-classic-859a948c"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1325 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
5 changes: 3 additions & 2 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -4818,6 +4818,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
else if ((pushPrimaryTreeSuspenseHandler(workInProgress), shim$2()))
(JSCompiler_temp = shim$2().digest),
(nextProps = Error(formatProdErrorMessage(419))),
(nextProps.stack = ""),
(nextProps.digest = JSCompiler_temp),
(JSCompiler_temp = createCapturedValueFromError(
nextProps,
Expand Down Expand Up @@ -10271,7 +10272,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "19.0.0-www-modern-672a54bb",
version: "19.0.0-www-modern-323b75ff",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1304 = {
Expand Down Expand Up @@ -10302,7 +10303,7 @@ var internals$jscomp$inline_1304 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-modern-672a54bb"
reconcilerVersion: "19.0.0-www-modern-323b75ff"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1305 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
24 changes: 16 additions & 8 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -22604,7 +22604,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 @@ -22613,6 +22613,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 @@ -22626,13 +22627,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 @@ -36358,7 +36364,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "19.0.0-www-classic-7d681296";
var ReactVersion = "19.0.0-www-classic-02ab69c6";

function createPortal$1(
children,
Expand Down Expand Up @@ -45317,22 +45323,24 @@ if (__DEV__) {
}
function getSuspenseInstanceFallbackErrorDetails(instance) {
var dataset = instance.nextSibling && instance.nextSibling.dataset;
var digest, message, stack;
var digest, message, stack, componentStack;

if (dataset) {
digest = dataset.dgst;

{
message = dataset.msg;
stack = dataset.stck;
componentStack = dataset.cstck;
}
}

{
return {
message: message,
digest: digest,
stack: stack
stack: stack,
componentStack: componentStack
};
}
}
Expand Down
24 changes: 16 additions & 8 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -22496,7 +22496,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 @@ -22505,6 +22505,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 @@ -22518,13 +22519,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 @@ -36206,7 +36212,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "19.0.0-www-modern-439124ba";
var ReactVersion = "19.0.0-www-modern-d6e2d0b4";

function createPortal$1(
children,
Expand Down Expand Up @@ -46015,22 +46021,24 @@ if (__DEV__) {
}
function getSuspenseInstanceFallbackErrorDetails(instance) {
var dataset = instance.nextSibling && instance.nextSibling.dataset;
var digest, message, stack;
var digest, message, stack, componentStack;

if (dataset) {
digest = dataset.dgst;

{
message = dataset.msg;
stack = dataset.stck;
componentStack = dataset.cstck;
}
}

{
return {
message: message,
digest: digest,
stack: stack
stack: stack,
componentStack: componentStack
};
}
}
Expand Down
7 changes: 4 additions & 3 deletions compiled/facebook-www/ReactDOM-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6063,6 +6063,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
if (JSCompiler_temp) var digest = JSCompiler_temp.dgst;
JSCompiler_temp = digest;
nextProps = Error(formatProdErrorMessage(419));
nextProps.stack = "";
nextProps.digest = JSCompiler_temp;
JSCompiler_temp = createCapturedValueFromError(
nextProps,
Expand Down Expand Up @@ -17107,7 +17108,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1732 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "19.0.0-www-classic-b1be4296",
version: "19.0.0-www-classic-540c4c3d",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2160 = {
Expand Down Expand Up @@ -17137,7 +17138,7 @@ var internals$jscomp$inline_2160 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-classic-b1be4296"
reconcilerVersion: "19.0.0-www-classic-540c4c3d"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2161 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -17587,4 +17588,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
};
exports.version = "19.0.0-www-classic-b1be4296";
exports.version = "19.0.0-www-classic-540c4c3d";
7 changes: 4 additions & 3 deletions compiled/facebook-www/ReactDOM-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -5915,6 +5915,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
if (JSCompiler_temp) var digest = JSCompiler_temp.dgst;
JSCompiler_temp = digest;
nextProps = Error(formatProdErrorMessage(419));
nextProps.stack = "";
nextProps.digest = JSCompiler_temp;
JSCompiler_temp = createCapturedValueFromError(
nextProps,
Expand Down Expand Up @@ -16621,7 +16622,7 @@ Internals.Events = [
var devToolsConfig$jscomp$inline_1693 = {
findFiberByHostInstance: getClosestInstanceFromNode,
bundleType: 0,
version: "19.0.0-www-modern-44929488",
version: "19.0.0-www-modern-04f7fd59",
rendererPackageName: "react-dom"
};
var internals$jscomp$inline_2122 = {
Expand Down Expand Up @@ -16651,7 +16652,7 @@ var internals$jscomp$inline_2122 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-www-modern-44929488"
reconcilerVersion: "19.0.0-www-modern-04f7fd59"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2123 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -16954,4 +16955,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactCurrentDispatcher$2.current.useHostTransitionStatus();
};
exports.version = "19.0.0-www-modern-44929488";
exports.version = "19.0.0-www-modern-04f7fd59";
Loading

0 comments on commit 904602b

Please sign in to comment.