Skip to content

Commit

Permalink
[Fizz] Reset error component stack and fix error messages (#27456)
Browse files Browse the repository at this point in the history
The way we collect component stacks right now are pretty fragile.

We expect that we'll call captureBoundaryErrorDetailsDev whenever an
error happens. That resets lastBoundaryErrorComponentStackDev to null
but if we don't, it just lingers and we don't set it to anything new
then which leaks the previous component stack into the next time we have
an error. So we need to reset it in a bunch of places.

This is still broken with erroredReplay because it has the inverse
problem that abortRemainingReplayNodes can call
captureBoundaryErrorDetailsDev more than one time. So the second
boundary won't get a stack.

We probably should try to figure out an alternative way to carry along
the stack. Perhaps WeakMap keyed by the error object.

This also fixes an issue where we weren't invoking the onShellReady
event if we error a replay. That event is a bit weird for resuming
because we're probably really supposed to just invoke it immediately if
we have already flushed the shell in the prerender which is always atm.
Right now, it gets invoked later than necessary because you could have a
resumed hole ready before a sibling in the shell is ready and that's
blocked.

DiffTrain build for commit 0fba3ec.
  • Loading branch information
sebmarkbage committed Oct 4, 2023
1 parent 963258f commit 2dd6caa
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24772,7 +24772,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-canary-6f1324395-20231004";
var ReactVersion = "18.3.0-canary-0fba3ecf7-20231004";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8978,7 +8978,7 @@ var devToolsConfig$jscomp$inline_998 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-6f1324395-20231004",
version: "18.3.0-canary-0fba3ecf7-20231004",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1191 = {
Expand Down Expand Up @@ -9009,7 +9009,7 @@ var internals$jscomp$inline_1191 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-6f1324395-20231004"
reconcilerVersion: "18.3.0-canary-0fba3ecf7-20231004"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1192 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9404,7 +9404,7 @@ var devToolsConfig$jscomp$inline_1040 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-6f1324395-20231004",
version: "18.3.0-canary-0fba3ecf7-20231004",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1232 = {
Expand Down Expand Up @@ -9435,7 +9435,7 @@ var internals$jscomp$inline_1232 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-6f1324395-20231004"
reconcilerVersion: "18.3.0-canary-0fba3ecf7-20231004"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1233 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-canary-6f1324395-20231004";
var ReactVersion = "18.3.0-canary-0fba3ecf7-20231004";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,4 +616,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-6f1324395-20231004";
exports.version = "18.3.0-canary-0fba3ecf7-20231004";
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-6f1324395-20231004";
exports.version = "18.3.0-canary-0fba3ecf7-20231004";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6f132439578ee11e04b41a278df51c52b0dc8563
0fba3ecf73900a1b54ed6d3b0617462ac92d2fef

0 comments on commit 2dd6caa

Please sign in to comment.