Skip to content

Commit 5fb5ce8

Browse files
committed
Override the getCurrentStack temporarily while printing uncaught errors (#30309)
This is just a follow up to #30300. I forgot the uncaught branch. DiffTrain build for [29552c7](29552c7)
1 parent f708486 commit 5fb5ce8

34 files changed

+224
-144
lines changed

compiled/facebook-www/REVISION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fe9828954adcc51aa2bd21fe53d969a44dd3c9d2
1+
29552c7907230222acd3f2c586784d24f9da6200
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fe9828954adcc51aa2bd21fe53d969a44dd3c9d2
1+
29552c7907230222acd3f2c586784d24f9da6200

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1998,7 +1998,7 @@ __DEV__ &&
19981998
exports.useTransition = function () {
19991999
return resolveDispatcher().useTransition();
20002000
};
2001-
exports.version = "19.0.0-www-classic-fe9828954a-20240710";
2001+
exports.version = "19.0.0-www-classic-29552c7907-20240710";
20022002
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
20032003
"function" ===
20042004
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1978,7 +1978,7 @@ __DEV__ &&
19781978
exports.useTransition = function () {
19791979
return resolveDispatcher().useTransition();
19801980
};
1981-
exports.version = "19.0.0-www-modern-fe9828954a-20240710";
1981+
exports.version = "19.0.0-www-modern-29552c7907-20240710";
19821982
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
19831983
"function" ===
19841984
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -669,4 +669,4 @@ exports.useSyncExternalStore = function (
669669
exports.useTransition = function () {
670670
return ReactSharedInternals.H.useTransition();
671671
};
672-
exports.version = "19.0.0-www-classic-fe9828954a-20240710";
672+
exports.version = "19.0.0-www-classic-29552c7907-20240710";

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -669,4 +669,4 @@ exports.useSyncExternalStore = function (
669669
exports.useTransition = function () {
670670
return ReactSharedInternals.H.useTransition();
671671
};
672-
exports.version = "19.0.0-www-modern-fe9828954a-20240710";
672+
exports.version = "19.0.0-www-modern-29552c7907-20240710";

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ exports.useSyncExternalStore = function (
673673
exports.useTransition = function () {
674674
return ReactSharedInternals.H.useTransition();
675675
};
676-
exports.version = "19.0.0-www-classic-fe9828954a-20240710";
676+
exports.version = "19.0.0-www-classic-29552c7907-20240710";
677677
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
678678
"function" ===
679679
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ exports.useSyncExternalStore = function (
673673
exports.useTransition = function () {
674674
return ReactSharedInternals.H.useTransition();
675675
};
676-
exports.version = "19.0.0-www-modern-fe9828954a-20240710";
676+
exports.version = "19.0.0-www-modern-29552c7907-20240710";
677677
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
678678
"function" ===
679679
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -17017,14 +17017,14 @@ __DEV__ &&
1701717017
scheduleRoot: scheduleRoot,
1701817018
setRefreshHandler: setRefreshHandler,
1701917019
getCurrentFiber: getCurrentFiberForDevTools,
17020-
reconcilerVersion: "19.0.0-www-classic-fe9828954a-20240710"
17020+
reconcilerVersion: "19.0.0-www-classic-29552c7907-20240710"
1702117021
});
1702217022
})({
1702317023
findFiberByHostInstance: function () {
1702417024
return null;
1702517025
},
1702617026
bundleType: 1,
17027-
version: "19.0.0-www-classic-fe9828954a-20240710",
17027+
version: "19.0.0-www-classic-29552c7907-20240710",
1702817028
rendererPackageName: "react-art"
1702917029
});
1703017030
var ClippingRectangle = TYPES.CLIPPING_RECTANGLE,

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -16432,14 +16432,14 @@ __DEV__ &&
1643216432
scheduleRoot: scheduleRoot,
1643316433
setRefreshHandler: setRefreshHandler,
1643416434
getCurrentFiber: getCurrentFiberForDevTools,
16435-
reconcilerVersion: "19.0.0-www-modern-fe9828954a-20240710"
16435+
reconcilerVersion: "19.0.0-www-modern-29552c7907-20240710"
1643616436
});
1643716437
})({
1643816438
findFiberByHostInstance: function () {
1643916439
return null;
1644016440
},
1644116441
bundleType: 1,
16442-
version: "19.0.0-www-modern-fe9828954a-20240710",
16442+
version: "19.0.0-www-modern-29552c7907-20240710",
1644316443
rendererPackageName: "react-art"
1644416444
});
1644516445
var ClippingRectangle = TYPES.CLIPPING_RECTANGLE,

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -10749,7 +10749,7 @@ var slice = Array.prototype.slice,
1074910749
return null;
1075010750
},
1075110751
bundleType: 0,
10752-
version: "19.0.0-www-classic-fe9828954a-20240710",
10752+
version: "19.0.0-www-classic-29552c7907-20240710",
1075310753
rendererPackageName: "react-art"
1075410754
};
1075510755
var internals$jscomp$inline_1386 = {
@@ -10780,7 +10780,7 @@ var internals$jscomp$inline_1386 = {
1078010780
scheduleRoot: null,
1078110781
setRefreshHandler: null,
1078210782
getCurrentFiber: null,
10783-
reconcilerVersion: "19.0.0-www-classic-fe9828954a-20240710"
10783+
reconcilerVersion: "19.0.0-www-classic-29552c7907-20240710"
1078410784
};
1078510785
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1078610786
var hook$jscomp$inline_1387 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -10202,7 +10202,7 @@ var slice = Array.prototype.slice,
1020210202
return null;
1020310203
},
1020410204
bundleType: 0,
10205-
version: "19.0.0-www-modern-fe9828954a-20240710",
10205+
version: "19.0.0-www-modern-29552c7907-20240710",
1020610206
rendererPackageName: "react-art"
1020710207
};
1020810208
var internals$jscomp$inline_1372 = {
@@ -10233,7 +10233,7 @@ var internals$jscomp$inline_1372 = {
1023310233
scheduleRoot: null,
1023410234
setRefreshHandler: null,
1023510235
getCurrentFiber: null,
10236-
reconcilerVersion: "19.0.0-www-modern-fe9828954a-20240710"
10236+
reconcilerVersion: "19.0.0-www-modern-29552c7907-20240710"
1023710237
};
1023810238
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1023910239
var hook$jscomp$inline_1373 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

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

+23-13
Original file line numberDiff line numberDiff line change
@@ -7856,14 +7856,24 @@ __DEV__ &&
78567856
}
78577857
function defaultOnUncaughtError(error, errorInfo) {
78587858
reportGlobalError(error);
7859-
console.warn(
7860-
"%s\n\n%s\n%s",
7861-
componentName
7862-
? "An error occurred in the <" + componentName + "> component."
7863-
: "An error occurred in one of your React components.",
7864-
"Consider adding an error boundary to your tree to customize error handling behavior.\nVisit https://react.dev/link/error-boundaries to learn more about error boundaries.",
7865-
null != errorInfo.componentStack ? errorInfo.componentStack : ""
7866-
);
7859+
error = componentName
7860+
? "An error occurred in the <" + componentName + "> component."
7861+
: "An error occurred in one of your React components.";
7862+
var prevGetCurrentStack = ReactSharedInternals.getCurrentStack,
7863+
componentStack =
7864+
null != errorInfo.componentStack ? errorInfo.componentStack : "";
7865+
ReactSharedInternals.getCurrentStack = function () {
7866+
return componentStack;
7867+
};
7868+
try {
7869+
warn(
7870+
"%s\n\n%s\n",
7871+
error,
7872+
"Consider adding an error boundary to your tree to customize error handling behavior.\nVisit https://react.dev/link/error-boundaries to learn more about error boundaries."
7873+
);
7874+
} finally {
7875+
ReactSharedInternals.getCurrentStack = prevGetCurrentStack;
7876+
}
78677877
}
78687878
function defaultOnCaughtError(error$1, errorInfo) {
78697879
var componentNameMessage = componentName
@@ -27556,11 +27566,11 @@ __DEV__ &&
2755627566
: flushSyncErrorInBuildsThatSupportLegacyMode;
2755727567
(function () {
2755827568
var isomorphicReactPackageVersion = React.version;
27559-
if ("19.0.0-www-classic-fe9828954a-20240710" !== isomorphicReactPackageVersion)
27569+
if ("19.0.0-www-classic-29552c7907-20240710" !== isomorphicReactPackageVersion)
2756027570
throw Error(
2756127571
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2756227572
(isomorphicReactPackageVersion +
27563-
"\n - react-dom: 19.0.0-www-classic-fe9828954a-20240710\nLearn more: https://react.dev/warnings/version-mismatch")
27573+
"\n - react-dom: 19.0.0-www-classic-29552c7907-20240710\nLearn more: https://react.dev/warnings/version-mismatch")
2756427574
);
2756527575
})();
2756627576
("function" === typeof Map &&
@@ -27626,12 +27636,12 @@ __DEV__ &&
2762627636
scheduleRoot: scheduleRoot,
2762727637
setRefreshHandler: setRefreshHandler,
2762827638
getCurrentFiber: getCurrentFiberForDevTools,
27629-
reconcilerVersion: "19.0.0-www-classic-fe9828954a-20240710"
27639+
reconcilerVersion: "19.0.0-www-classic-29552c7907-20240710"
2763027640
});
2763127641
})({
2763227642
findFiberByHostInstance: getClosestInstanceFromNode,
2763327643
bundleType: 1,
27634-
version: "19.0.0-www-classic-fe9828954a-20240710",
27644+
version: "19.0.0-www-classic-29552c7907-20240710",
2763527645
rendererPackageName: "react-dom"
2763627646
}) &&
2763727647
canUseDOM &&
@@ -28274,7 +28284,7 @@ __DEV__ &&
2827428284
exports.useFormStatus = function () {
2827528285
return resolveDispatcher().useHostTransitionStatus();
2827628286
};
28277-
exports.version = "19.0.0-www-classic-fe9828954a-20240710";
28287+
exports.version = "19.0.0-www-classic-29552c7907-20240710";
2827828288
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2827928289
"function" ===
2828028290
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

+23-13
Original file line numberDiff line numberDiff line change
@@ -7401,14 +7401,24 @@ __DEV__ &&
74017401
}
74027402
function defaultOnUncaughtError(error, errorInfo) {
74037403
reportGlobalError(error);
7404-
console.warn(
7405-
"%s\n\n%s\n%s",
7406-
componentName
7407-
? "An error occurred in the <" + componentName + "> component."
7408-
: "An error occurred in one of your React components.",
7409-
"Consider adding an error boundary to your tree to customize error handling behavior.\nVisit https://react.dev/link/error-boundaries to learn more about error boundaries.",
7410-
null != errorInfo.componentStack ? errorInfo.componentStack : ""
7411-
);
7404+
error = componentName
7405+
? "An error occurred in the <" + componentName + "> component."
7406+
: "An error occurred in one of your React components.";
7407+
var prevGetCurrentStack = ReactSharedInternals.getCurrentStack,
7408+
componentStack =
7409+
null != errorInfo.componentStack ? errorInfo.componentStack : "";
7410+
ReactSharedInternals.getCurrentStack = function () {
7411+
return componentStack;
7412+
};
7413+
try {
7414+
warn(
7415+
"%s\n\n%s\n",
7416+
error,
7417+
"Consider adding an error boundary to your tree to customize error handling behavior.\nVisit https://react.dev/link/error-boundaries to learn more about error boundaries."
7418+
);
7419+
} finally {
7420+
ReactSharedInternals.getCurrentStack = prevGetCurrentStack;
7421+
}
74127422
}
74137423
function defaultOnCaughtError(error$1, errorInfo) {
74147424
var componentNameMessage = componentName
@@ -26688,11 +26698,11 @@ __DEV__ &&
2668826698
return_targetInst = null;
2668926699
(function () {
2669026700
var isomorphicReactPackageVersion = React.version;
26691-
if ("19.0.0-www-modern-fe9828954a-20240710" !== isomorphicReactPackageVersion)
26701+
if ("19.0.0-www-modern-29552c7907-20240710" !== isomorphicReactPackageVersion)
2669226702
throw Error(
2669326703
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
2669426704
(isomorphicReactPackageVersion +
26695-
"\n - react-dom: 19.0.0-www-modern-fe9828954a-20240710\nLearn more: https://react.dev/warnings/version-mismatch")
26705+
"\n - react-dom: 19.0.0-www-modern-29552c7907-20240710\nLearn more: https://react.dev/warnings/version-mismatch")
2669626706
);
2669726707
})();
2669826708
("function" === typeof Map &&
@@ -26757,12 +26767,12 @@ __DEV__ &&
2675726767
scheduleRoot: scheduleRoot,
2675826768
setRefreshHandler: setRefreshHandler,
2675926769
getCurrentFiber: getCurrentFiberForDevTools,
26760-
reconcilerVersion: "19.0.0-www-modern-fe9828954a-20240710"
26770+
reconcilerVersion: "19.0.0-www-modern-29552c7907-20240710"
2676126771
});
2676226772
})({
2676326773
findFiberByHostInstance: getClosestInstanceFromNode,
2676426774
bundleType: 1,
26765-
version: "19.0.0-www-modern-fe9828954a-20240710",
26775+
version: "19.0.0-www-modern-29552c7907-20240710",
2676626776
rendererPackageName: "react-dom"
2676726777
}) &&
2676826778
canUseDOM &&
@@ -27358,7 +27368,7 @@ __DEV__ &&
2735827368
exports.useFormStatus = function () {
2735927369
return resolveDispatcher().useHostTransitionStatus();
2736027370
};
27361-
exports.version = "19.0.0-www-modern-fe9828954a-20240710";
27371+
exports.version = "19.0.0-www-modern-29552c7907-20240710";
2736227372
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2736327373
"function" ===
2736427374
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -17194,14 +17194,14 @@ function getCrossOriginStringAs(as, input) {
1719417194
}
1719517195
var isomorphicReactPackageVersion$jscomp$inline_1769 = React.version;
1719617196
if (
17197-
"19.0.0-www-classic-fe9828954a-20240710" !==
17197+
"19.0.0-www-classic-29552c7907-20240710" !==
1719817198
isomorphicReactPackageVersion$jscomp$inline_1769
1719917199
)
1720017200
throw Error(
1720117201
formatProdErrorMessage(
1720217202
527,
1720317203
isomorphicReactPackageVersion$jscomp$inline_1769,
17204-
"19.0.0-www-classic-fe9828954a-20240710"
17204+
"19.0.0-www-classic-29552c7907-20240710"
1720517205
)
1720617206
);
1720717207
function flushSyncFromReconciler(fn) {
@@ -17247,7 +17247,7 @@ Internals.Events = [
1724717247
var devToolsConfig$jscomp$inline_1776 = {
1724817248
findFiberByHostInstance: getClosestInstanceFromNode,
1724917249
bundleType: 0,
17250-
version: "19.0.0-www-classic-fe9828954a-20240710",
17250+
version: "19.0.0-www-classic-29552c7907-20240710",
1725117251
rendererPackageName: "react-dom"
1725217252
};
1725317253
var internals$jscomp$inline_2220 = {
@@ -17277,7 +17277,7 @@ var internals$jscomp$inline_2220 = {
1727717277
scheduleRoot: null,
1727817278
setRefreshHandler: null,
1727917279
getCurrentFiber: null,
17280-
reconcilerVersion: "19.0.0-www-classic-fe9828954a-20240710"
17280+
reconcilerVersion: "19.0.0-www-classic-29552c7907-20240710"
1728117281
};
1728217282
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1728317283
var hook$jscomp$inline_2221 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17741,4 +17741,4 @@ exports.useFormState = function (action, initialState, permalink) {
1774117741
exports.useFormStatus = function () {
1774217742
return ReactSharedInternals.H.useHostTransitionStatus();
1774317743
};
17744-
exports.version = "19.0.0-www-classic-fe9828954a-20240710";
17744+
exports.version = "19.0.0-www-classic-29552c7907-20240710";

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -16509,14 +16509,14 @@ function getCrossOriginStringAs(as, input) {
1650916509
}
1651016510
var isomorphicReactPackageVersion$jscomp$inline_1740 = React.version;
1651116511
if (
16512-
"19.0.0-www-modern-fe9828954a-20240710" !==
16512+
"19.0.0-www-modern-29552c7907-20240710" !==
1651316513
isomorphicReactPackageVersion$jscomp$inline_1740
1651416514
)
1651516515
throw Error(
1651616516
formatProdErrorMessage(
1651716517
527,
1651816518
isomorphicReactPackageVersion$jscomp$inline_1740,
16519-
"19.0.0-www-modern-fe9828954a-20240710"
16519+
"19.0.0-www-modern-29552c7907-20240710"
1652016520
)
1652116521
);
1652216522
Internals.findDOMNode = function (componentOrElement) {
@@ -16535,7 +16535,7 @@ Internals.Events = [
1653516535
var devToolsConfig$jscomp$inline_1742 = {
1653616536
findFiberByHostInstance: getClosestInstanceFromNode,
1653716537
bundleType: 0,
16538-
version: "19.0.0-www-modern-fe9828954a-20240710",
16538+
version: "19.0.0-www-modern-29552c7907-20240710",
1653916539
rendererPackageName: "react-dom"
1654016540
};
1654116541
var internals$jscomp$inline_2211 = {
@@ -16565,7 +16565,7 @@ var internals$jscomp$inline_2211 = {
1656516565
scheduleRoot: null,
1656616566
setRefreshHandler: null,
1656716567
getCurrentFiber: null,
16568-
reconcilerVersion: "19.0.0-www-modern-fe9828954a-20240710"
16568+
reconcilerVersion: "19.0.0-www-modern-29552c7907-20240710"
1656916569
};
1657016570
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1657116571
var hook$jscomp$inline_2212 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -16936,4 +16936,4 @@ exports.useFormState = function (action, initialState, permalink) {
1693616936
exports.useFormStatus = function () {
1693716937
return ReactSharedInternals.H.useHostTransitionStatus();
1693816938
};
16939-
exports.version = "19.0.0-www-modern-fe9828954a-20240710";
16939+
exports.version = "19.0.0-www-modern-29552c7907-20240710";

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -17965,14 +17965,14 @@ function getCrossOriginStringAs(as, input) {
1796517965
}
1796617966
var isomorphicReactPackageVersion$jscomp$inline_1856 = React.version;
1796717967
if (
17968-
"19.0.0-www-classic-fe9828954a-20240710" !==
17968+
"19.0.0-www-classic-29552c7907-20240710" !==
1796917969
isomorphicReactPackageVersion$jscomp$inline_1856
1797017970
)
1797117971
throw Error(
1797217972
formatProdErrorMessage(
1797317973
527,
1797417974
isomorphicReactPackageVersion$jscomp$inline_1856,
17975-
"19.0.0-www-classic-fe9828954a-20240710"
17975+
"19.0.0-www-classic-29552c7907-20240710"
1797617976
)
1797717977
);
1797817978
function flushSyncFromReconciler(fn) {
@@ -18018,7 +18018,7 @@ Internals.Events = [
1801818018
var devToolsConfig$jscomp$inline_1863 = {
1801918019
findFiberByHostInstance: getClosestInstanceFromNode,
1802018020
bundleType: 0,
18021-
version: "19.0.0-www-classic-fe9828954a-20240710",
18021+
version: "19.0.0-www-classic-29552c7907-20240710",
1802218022
rendererPackageName: "react-dom"
1802318023
};
1802418024
(function (internals) {
@@ -18062,7 +18062,7 @@ var devToolsConfig$jscomp$inline_1863 = {
1806218062
scheduleRoot: null,
1806318063
setRefreshHandler: null,
1806418064
getCurrentFiber: null,
18065-
reconcilerVersion: "19.0.0-www-classic-fe9828954a-20240710"
18065+
reconcilerVersion: "19.0.0-www-classic-29552c7907-20240710"
1806618066
});
1806718067
function ReactDOMRoot(internalRoot) {
1806818068
this._internalRoot = internalRoot;
@@ -18513,7 +18513,7 @@ exports.useFormState = function (action, initialState, permalink) {
1851318513
exports.useFormStatus = function () {
1851418514
return ReactSharedInternals.H.useHostTransitionStatus();
1851518515
};
18516-
exports.version = "19.0.0-www-classic-fe9828954a-20240710";
18516+
exports.version = "19.0.0-www-classic-29552c7907-20240710";
1851718517
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1851818518
"function" ===
1851918519
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)