Skip to content

Commit ee3fa44

Browse files
committed
[Fiber] Mark error boundaries and commit phases when an error is thrown (facebook#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](facebook@0de1233)
1 parent 4cb6ec6 commit ee3fa44

23 files changed

+458
-285
lines changed

compiled-rn/VERSION_NATIVE_FB

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19.1.0-native-fb-99471c02-20241220
1+
19.1.0-native-fb-0de1233f-20250102

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<3b6fd70a2896088fa5220efb4a55c140>>
10+
* @generated SignedSource<<cdd39ce1fdacaaee811be83c49a61b38>>
1111
*/
1212

1313
"use strict";
@@ -420,5 +420,5 @@ __DEV__ &&
420420
exports.useFormStatus = function () {
421421
return resolveDispatcher().useHostTransitionStatus();
422422
};
423-
exports.version = "19.1.0-native-fb-99471c02-20241220";
423+
exports.version = "19.1.0-native-fb-0de1233f-20250102";
424424
})();

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<de012a396ddaeb418583f5d56295dd91>>
10+
* @generated SignedSource<<1636615e03636f4ba7e400d96921febb>>
1111
*/
1212

1313
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
203203
exports.useFormStatus = function () {
204204
return ReactSharedInternals.H.useHostTransitionStatus();
205205
};
206-
exports.version = "19.1.0-native-fb-99471c02-20241220";
206+
exports.version = "19.1.0-native-fb-0de1233f-20250102";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<de012a396ddaeb418583f5d56295dd91>>
10+
* @generated SignedSource<<1636615e03636f4ba7e400d96921febb>>
1111
*/
1212

1313
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
203203
exports.useFormStatus = function () {
204204
return ReactSharedInternals.H.useHostTransitionStatus();
205205
};
206-
exports.version = "19.1.0-native-fb-99471c02-20241220";
206+
exports.version = "19.1.0-native-fb-0de1233f-20250102";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<1784b9f20749b6d8cc926bfccb406b68>>
10+
* @generated SignedSource<<1a9d5b55b6730a980f7c2d797bfeb2fb>>
1111
*/
1212

1313
/*
@@ -13545,6 +13545,14 @@ __DEV__ &&
1354513545
flags & 2048 &&
1354613546
commitHookPassiveMountEffects(finishedWork, Passive | HasEffect);
1354713547
break;
13548+
case 1:
13549+
recursivelyTraversePassiveMountEffects(
13550+
finishedRoot,
13551+
finishedWork,
13552+
committedLanes,
13553+
committedTransitions
13554+
);
13555+
break;
1354813556
case 3:
1354913557
var prevEffectDuration = pushNestedEffectDurations();
1355013558
recursivelyTraversePassiveMountEffects(
@@ -16085,7 +16093,7 @@ __DEV__ &&
1608516093
}
1608616094
null !== ReactSharedInternals.actQueue
1608716095
? workLoopSync()
16088-
: workLoopConcurrent();
16096+
: workLoopConcurrentByScheduler();
1608916097
break;
1609016098
} catch (thrownValue$43) {
1609116099
handleThrow(root, thrownValue$43);
@@ -16108,7 +16116,7 @@ __DEV__ &&
1610816116
finishQueueingConcurrentUpdates();
1610916117
return workInProgressRootExitStatus;
1611016118
}
16111-
function workLoopConcurrent() {
16119+
function workLoopConcurrentByScheduler() {
1611216120
for (; null !== workInProgress && !shouldYield(); )
1611316121
performUnitOfWork(workInProgress);
1611416122
}
@@ -16903,11 +16911,9 @@ __DEV__ &&
1690316911
mightHavePendingSyncWork = !0;
1690416912
null !== ReactSharedInternals.actQueue
1690516913
? didScheduleMicrotask_act ||
16906-
((didScheduleMicrotask_act = !0),
16907-
scheduleImmediateTask(processRootScheduleInMicrotask))
16914+
((didScheduleMicrotask_act = !0), scheduleImmediateRootScheduleTask())
1690816915
: didScheduleMicrotask ||
16909-
((didScheduleMicrotask = !0),
16910-
scheduleImmediateTask(processRootScheduleInMicrotask));
16916+
((didScheduleMicrotask = !0), scheduleImmediateRootScheduleTask());
1691116917
ReactSharedInternals.isBatchingLegacy &&
1691216918
0 === root.tag &&
1691316919
(ReactSharedInternals.didScheduleLegacyUpdate = !0);
@@ -16954,6 +16960,9 @@ __DEV__ &&
1695416960
isFlushingWork = !1;
1695516961
}
1695616962
}
16963+
function processRootScheduleInImmediateTask() {
16964+
processRootScheduleInMicrotask();
16965+
}
1695716966
function processRootScheduleInMicrotask() {
1695816967
mightHavePendingSyncWork =
1695916968
didScheduleMicrotask_act =
@@ -17095,16 +17104,19 @@ __DEV__ &&
1709517104
null !== callbackNode &&
1709617105
cancelCallback$1(callbackNode);
1709717106
}
17098-
function scheduleImmediateTask(cb) {
17107+
function scheduleImmediateRootScheduleTask() {
1709917108
null !== ReactSharedInternals.actQueue &&
1710017109
ReactSharedInternals.actQueue.push(function () {
17101-
cb();
17110+
processRootScheduleInMicrotask();
1710217111
return null;
1710317112
});
1710417113
scheduleMicrotask(function () {
1710517114
(executionContext & (RenderContext | CommitContext)) !== NoContext
17106-
? scheduleCallback$3(ImmediatePriority, cb)
17107-
: cb();
17115+
? scheduleCallback$3(
17116+
ImmediatePriority,
17117+
processRootScheduleInImmediateTask
17118+
)
17119+
: processRootScheduleInMicrotask();
1710817120
});
1710917121
}
1711017122
function requestTransitionLane() {
@@ -25875,11 +25887,11 @@ __DEV__ &&
2587525887
};
2587625888
(function () {
2587725889
var isomorphicReactPackageVersion = React.version;
25878-
if ("19.1.0-native-fb-99471c02-20241220" !== isomorphicReactPackageVersion)
25890+
if ("19.1.0-native-fb-0de1233f-20250102" !== isomorphicReactPackageVersion)
2587925891
throw Error(
2588025892
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2588125893
(isomorphicReactPackageVersion +
25882-
"\n - react-dom: 19.1.0-native-fb-99471c02-20241220\nLearn more: https://react.dev/warnings/version-mismatch")
25894+
"\n - react-dom: 19.1.0-native-fb-0de1233f-20250102\nLearn more: https://react.dev/warnings/version-mismatch")
2588325895
);
2588425896
})();
2588525897
("function" === typeof Map &&
@@ -25916,10 +25928,10 @@ __DEV__ &&
2591625928
!(function () {
2591725929
var internals = {
2591825930
bundleType: 1,
25919-
version: "19.1.0-native-fb-99471c02-20241220",
25931+
version: "19.1.0-native-fb-0de1233f-20250102",
2592025932
rendererPackageName: "react-dom",
2592125933
currentDispatcherRef: ReactSharedInternals,
25922-
reconcilerVersion: "19.1.0-native-fb-99471c02-20241220"
25934+
reconcilerVersion: "19.1.0-native-fb-0de1233f-20250102"
2592325935
};
2592425936
internals.overrideHookState = overrideHookState;
2592525937
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -26065,5 +26077,5 @@ __DEV__ &&
2606526077
listenToAllSupportedEvents(container);
2606626078
return new ReactDOMHydrationRoot(initialChildren);
2606726079
};
26068-
exports.version = "19.1.0-native-fb-99471c02-20241220";
26080+
exports.version = "19.1.0-native-fb-0de1233f-20250102";
2606926081
})();

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<b5b91d63144e756a3b918979040d4b75>>
10+
* @generated SignedSource<<5ef5c1b97dc0879e3464dcc600e9a36f>>
1111
*/
1212

1313
/*
@@ -9604,6 +9604,14 @@ function commitPassiveMountOnFiber(
96049604
);
96059605
flags & 2048 && commitHookEffectListMount(9, finishedWork);
96069606
break;
9607+
case 1:
9608+
recursivelyTraversePassiveMountEffects(
9609+
finishedRoot,
9610+
finishedWork,
9611+
committedLanes,
9612+
committedTransitions
9613+
);
9614+
break;
96079615
case 3:
96089616
recursivelyTraversePassiveMountEffects(
96099617
finishedRoot,
@@ -11611,7 +11619,7 @@ function renderRootConcurrent(root, lanes) {
1161111619
throw Error(formatProdErrorMessage(462));
1161211620
}
1161311621
}
11614-
workLoopConcurrent();
11622+
workLoopConcurrentByScheduler();
1161511623
break;
1161611624
} catch (thrownValue$179) {
1161711625
handleThrow(root, thrownValue$179);
@@ -11627,7 +11635,7 @@ function renderRootConcurrent(root, lanes) {
1162711635
finishQueueingConcurrentUpdates();
1162811636
return workInProgressRootExitStatus;
1162911637
}
11630-
function workLoopConcurrent() {
11638+
function workLoopConcurrentByScheduler() {
1163111639
for (; null !== workInProgress && !shouldYield(); )
1163211640
performUnitOfWork(workInProgress);
1163311641
}
@@ -12113,8 +12121,7 @@ function ensureRootIsScheduled(root) {
1211312121
: (lastScheduledRoot = lastScheduledRoot.next = root));
1211412122
mightHavePendingSyncWork = !0;
1211512123
didScheduleMicrotask ||
12116-
((didScheduleMicrotask = !0),
12117-
scheduleImmediateTask(processRootScheduleInMicrotask));
12124+
((didScheduleMicrotask = !0), scheduleImmediateRootScheduleTask());
1211812125
}
1211912126
function flushSyncWorkAcrossRoots_impl(syncTransitionLanes, onlyLegacy) {
1212012127
if (!isFlushingWork && mightHavePendingSyncWork) {
@@ -12159,6 +12166,9 @@ function flushSyncWorkAcrossRoots_impl(syncTransitionLanes, onlyLegacy) {
1215912166
isFlushingWork = !1;
1216012167
}
1216112168
}
12169+
function processRootScheduleInImmediateTask() {
12170+
processRootScheduleInMicrotask();
12171+
}
1216212172
function processRootScheduleInMicrotask() {
1216312173
mightHavePendingSyncWork = didScheduleMicrotask = !1;
1216412174
var syncTransitionLanes = 0;
@@ -12277,11 +12287,14 @@ function performSyncWorkOnRoot(root, lanes) {
1227712287
if (flushPassiveEffects()) return null;
1227812288
performWorkOnRoot(root, lanes, !0);
1227912289
}
12280-
function scheduleImmediateTask(cb) {
12290+
function scheduleImmediateRootScheduleTask() {
1228112291
scheduleMicrotask(function () {
1228212292
0 !== (executionContext & 6)
12283-
? scheduleCallback$3(ImmediatePriority, cb)
12284-
: cb();
12293+
? scheduleCallback$3(
12294+
ImmediatePriority,
12295+
processRootScheduleInImmediateTask
12296+
)
12297+
: processRootScheduleInMicrotask();
1228512298
});
1228612299
}
1228712300
function requestTransitionLane() {
@@ -15892,14 +15905,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1589215905
};
1589315906
var isomorphicReactPackageVersion$jscomp$inline_1727 = React.version;
1589415907
if (
15895-
"19.1.0-native-fb-99471c02-20241220" !==
15908+
"19.1.0-native-fb-0de1233f-20250102" !==
1589615909
isomorphicReactPackageVersion$jscomp$inline_1727
1589715910
)
1589815911
throw Error(
1589915912
formatProdErrorMessage(
1590015913
527,
1590115914
isomorphicReactPackageVersion$jscomp$inline_1727,
15902-
"19.1.0-native-fb-99471c02-20241220"
15915+
"19.1.0-native-fb-0de1233f-20250102"
1590315916
)
1590415917
);
1590515918
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -15921,10 +15934,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1592115934
};
1592215935
var internals$jscomp$inline_2185 = {
1592315936
bundleType: 0,
15924-
version: "19.1.0-native-fb-99471c02-20241220",
15937+
version: "19.1.0-native-fb-0de1233f-20250102",
1592515938
rendererPackageName: "react-dom",
1592615939
currentDispatcherRef: ReactSharedInternals,
15927-
reconcilerVersion: "19.1.0-native-fb-99471c02-20241220"
15940+
reconcilerVersion: "19.1.0-native-fb-0de1233f-20250102"
1592815941
};
1592915942
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1593015943
var hook$jscomp$inline_2186 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -16030,4 +16043,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1603016043
listenToAllSupportedEvents(container);
1603116044
return new ReactDOMHydrationRoot(initialChildren);
1603216045
};
16033-
exports.version = "19.1.0-native-fb-99471c02-20241220";
16046+
exports.version = "19.1.0-native-fb-0de1233f-20250102";

0 commit comments

Comments
 (0)