Skip to content

Commit 4f7e527

Browse files
committed
[Fiber] Mark error boundaries and commit phases when an error is thrown (#31876)
This tracks commit phase errors and marks the component that errored as red. These also get the errors attached to the entry. <img width="1505" alt="Screenshot 2024-12-20 at 2 40 14 PM" src="https://github.com/user-attachments/assets/cac3ead7-a024-4e33-ab27-2e95293c4299" /> In the render phase I just mark the Error Boundary that caught the error. We don't have access to the actual error since it's locked behind closures in the update queue. We could probably expose that someway. <img width="949" alt="Screenshot 2024-12-20 at 1 49 05 PM" src="https://github.com/user-attachments/assets/3032455d-d9f2-462b-9c07-7be23663ecd3" /> Follow ups: Since the Error Boundary doesn't commit its attempted render, we don't log those. If we did then maybe we should just mark the errored component like I do for the commit phase. We could potentially walk the list of errors and log the captured fibers and just log their entries as children. We could also potentially walk the uncommitted Fiber tree by stashing it somewhere or even getting it from the alternate. This could be done on Suspense boundaries too to track failed hydrations. --------- Co-authored-by: Ricky <[email protected]> DiffTrain build for [0de1233](0de1233)
1 parent 4fe69bf commit 4f7e527

34 files changed

+246
-86
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1e9eb95db5b3a2064ecc26915a4e640b3a9bdaf5
1+
0de1233fd180969f7ffdfc98151922f2466ceb1f
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1e9eb95db5b3a2064ecc26915a4e640b3a9bdaf5
1+
0de1233fd180969f7ffdfc98151922f2466ceb1f

compiled/facebook-www/React-dev.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1942,7 +1942,7 @@ __DEV__ &&
19421942
exports.useTransition = function () {
19431943
return resolveDispatcher().useTransition();
19441944
};
1945-
exports.version = "19.1.0-www-classic-1e9eb95d-20250102";
1945+
exports.version = "19.1.0-www-classic-0de1233f-20250102";
19461946
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
19471947
"function" ===
19481948
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1942,7 +1942,7 @@ __DEV__ &&
19421942
exports.useTransition = function () {
19431943
return resolveDispatcher().useTransition();
19441944
};
1945-
exports.version = "19.1.0-www-modern-1e9eb95d-20250102";
1945+
exports.version = "19.1.0-www-modern-0de1233f-20250102";
19461946
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
19471947
"function" ===
19481948
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,4 +630,4 @@ exports.useSyncExternalStore = function (
630630
exports.useTransition = function () {
631631
return ReactSharedInternals.H.useTransition();
632632
};
633-
exports.version = "19.1.0-www-classic-1e9eb95d-20250102";
633+
exports.version = "19.1.0-www-classic-0de1233f-20250102";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,4 +630,4 @@ exports.useSyncExternalStore = function (
630630
exports.useTransition = function () {
631631
return ReactSharedInternals.H.useTransition();
632632
};
633-
exports.version = "19.1.0-www-modern-1e9eb95d-20250102";
633+
exports.version = "19.1.0-www-modern-0de1233f-20250102";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ exports.useSyncExternalStore = function (
634634
exports.useTransition = function () {
635635
return ReactSharedInternals.H.useTransition();
636636
};
637-
exports.version = "19.1.0-www-classic-1e9eb95d-20250102";
637+
exports.version = "19.1.0-www-classic-0de1233f-20250102";
638638
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
639639
"function" ===
640640
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-profiling.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ exports.useSyncExternalStore = function (
634634
exports.useTransition = function () {
635635
return ReactSharedInternals.H.useTransition();
636636
};
637-
exports.version = "19.1.0-www-modern-1e9eb95d-20250102";
637+
exports.version = "19.1.0-www-modern-0de1233f-20250102";
638638
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
639639
"function" ===
640640
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11613,6 +11613,14 @@ __DEV__ &&
1161311613
flags & 2048 &&
1161411614
commitHookPassiveMountEffects(finishedWork, Passive | HasEffect);
1161511615
break;
11616+
case 1:
11617+
recursivelyTraversePassiveMountEffects(
11618+
finishedRoot,
11619+
finishedWork,
11620+
committedLanes,
11621+
committedTransitions
11622+
);
11623+
break;
1161611624
case 3:
1161711625
var prevEffectDuration = pushNestedEffectDurations();
1161811626
recursivelyTraversePassiveMountEffects(
@@ -16895,10 +16903,10 @@ __DEV__ &&
1689516903
(function () {
1689616904
var internals = {
1689716905
bundleType: 1,
16898-
version: "19.1.0-www-classic-1e9eb95d-20250102",
16906+
version: "19.1.0-www-classic-0de1233f-20250102",
1689916907
rendererPackageName: "react-art",
1690016908
currentDispatcherRef: ReactSharedInternals,
16901-
reconcilerVersion: "19.1.0-www-classic-1e9eb95d-20250102"
16909+
reconcilerVersion: "19.1.0-www-classic-0de1233f-20250102"
1690216910
};
1690316911
internals.overrideHookState = overrideHookState;
1690416912
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -16932,7 +16940,7 @@ __DEV__ &&
1693216940
exports.Shape = Shape;
1693316941
exports.Surface = Surface;
1693416942
exports.Text = Text;
16935-
exports.version = "19.1.0-www-classic-1e9eb95d-20250102";
16943+
exports.version = "19.1.0-www-classic-0de1233f-20250102";
1693616944
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1693716945
"function" ===
1693816946
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.modern.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11417,6 +11417,14 @@ __DEV__ &&
1141711417
flags & 2048 &&
1141811418
commitHookPassiveMountEffects(finishedWork, Passive | HasEffect);
1141911419
break;
11420+
case 1:
11421+
recursivelyTraversePassiveMountEffects(
11422+
finishedRoot,
11423+
finishedWork,
11424+
committedLanes,
11425+
committedTransitions
11426+
);
11427+
break;
1142011428
case 3:
1142111429
var prevEffectDuration = pushNestedEffectDurations();
1142211430
recursivelyTraversePassiveMountEffects(
@@ -16658,10 +16666,10 @@ __DEV__ &&
1665816666
(function () {
1665916667
var internals = {
1666016668
bundleType: 1,
16661-
version: "19.1.0-www-modern-1e9eb95d-20250102",
16669+
version: "19.1.0-www-modern-0de1233f-20250102",
1666216670
rendererPackageName: "react-art",
1666316671
currentDispatcherRef: ReactSharedInternals,
16664-
reconcilerVersion: "19.1.0-www-modern-1e9eb95d-20250102"
16672+
reconcilerVersion: "19.1.0-www-modern-0de1233f-20250102"
1666516673
};
1666616674
internals.overrideHookState = overrideHookState;
1666716675
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -16695,7 +16703,7 @@ __DEV__ &&
1669516703
exports.Shape = Shape;
1669616704
exports.Surface = Surface;
1669716705
exports.Text = Text;
16698-
exports.version = "19.1.0-www-modern-1e9eb95d-20250102";
16706+
exports.version = "19.1.0-www-modern-0de1233f-20250102";
1669916707
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1670016708
"function" ===
1670116709
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)