Skip to content

Commit 6f75707

Browse files
committed
feat[react-devtools]: add settings to global hook object (#30564)
Right now we are patching console 2 times: when hook is installed (before page is loaded) and when backend is connected. Because of this, even if user had `appendComponentStack` setting enabled, all emitted error and warning logs are not going to have component stacks appended. They also won't have component stacks appended retroactively when user opens browser DevTools (this is when frontend is initialized and connects to backend). This behavior adds potential race conditions with LogBox in React Native, and also unpredictable to the user, because in order to get component stacks logged you have to open browser DevTools, but by the time you do it, error or warning log was already emitted. To solve this, we are going to only patch console in the hook object, because it is guaranteed to load even before React. Settings are going to be synchronized with the hook via Bridge, and React DevTools Backend Host (React Native or browser extension shell) will be responsible for persisting these settings across the session, this is going to be implemented in a separate PR. DiffTrain build for [5e83d9a](5e83d9a)
1 parent c0925f3 commit 6f75707

34 files changed

+181
-177
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5dcb009760160c085496e943f76090d98528f971
1+
5e83d9ab3b3f88853591dff43cd70ee4e5c90c5d
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5dcb009760160c085496e943f76090d98528f971
1+
5e83d9ab3b3f88853591dff43cd70ee4e5c90c5d

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2000,7 +2000,7 @@ __DEV__ &&
20002000
exports.useTransition = function () {
20012001
return resolveDispatcher().useTransition();
20022002
};
2003-
exports.version = "19.0.0-www-classic-5dcb0097-20240918";
2003+
exports.version = "19.0.0-www-classic-5e83d9ab-20240918";
20042004
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
20052005
"function" ===
20062006
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
@@ -1980,7 +1980,7 @@ __DEV__ &&
19801980
exports.useTransition = function () {
19811981
return resolveDispatcher().useTransition();
19821982
};
1983-
exports.version = "19.0.0-www-modern-5dcb0097-20240918";
1983+
exports.version = "19.0.0-www-modern-5e83d9ab-20240918";
19841984
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
19851985
"function" ===
19861986
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
@@ -665,4 +665,4 @@ exports.useSyncExternalStore = function (
665665
exports.useTransition = function () {
666666
return ReactSharedInternals.H.useTransition();
667667
};
668-
exports.version = "19.0.0-www-classic-5dcb0097-20240918";
668+
exports.version = "19.0.0-www-classic-5e83d9ab-20240918";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,4 +665,4 @@ exports.useSyncExternalStore = function (
665665
exports.useTransition = function () {
666666
return ReactSharedInternals.H.useTransition();
667667
};
668-
exports.version = "19.0.0-www-modern-5dcb0097-20240918";
668+
exports.version = "19.0.0-www-modern-5e83d9ab-20240918";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ exports.useSyncExternalStore = function (
669669
exports.useTransition = function () {
670670
return ReactSharedInternals.H.useTransition();
671671
};
672-
exports.version = "19.0.0-www-classic-5dcb0097-20240918";
672+
exports.version = "19.0.0-www-classic-5e83d9ab-20240918";
673673
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
674674
"function" ===
675675
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
@@ -669,7 +669,7 @@ exports.useSyncExternalStore = function (
669669
exports.useTransition = function () {
670670
return ReactSharedInternals.H.useTransition();
671671
};
672-
exports.version = "19.0.0-www-modern-5dcb0097-20240918";
672+
exports.version = "19.0.0-www-modern-5e83d9ab-20240918";
673673
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
674674
"function" ===
675675
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17026,11 +17026,11 @@ __DEV__ &&
1702617026
(function () {
1702717027
var internals = {
1702817028
bundleType: 1,
17029-
version: "19.0.0-www-classic-5dcb0097-20240918",
17029+
version: "19.0.0-www-classic-5e83d9ab-20240918",
1703017030
rendererPackageName: "react-art",
1703117031
currentDispatcherRef: ReactSharedInternals,
1703217032
findFiberByHostInstance: getInstanceFromNode,
17033-
reconcilerVersion: "19.0.0-www-classic-5dcb0097-20240918"
17033+
reconcilerVersion: "19.0.0-www-classic-5e83d9ab-20240918"
1703417034
};
1703517035
internals.overrideHookState = overrideHookState;
1703617036
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -17064,7 +17064,7 @@ __DEV__ &&
1706417064
exports.Shape = Shape;
1706517065
exports.Surface = Surface;
1706617066
exports.Text = Text;
17067-
exports.version = "19.0.0-www-classic-5dcb0097-20240918";
17067+
exports.version = "19.0.0-www-classic-5e83d9ab-20240918";
1706817068
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1706917069
"function" ===
1707017070
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16472,11 +16472,11 @@ __DEV__ &&
1647216472
(function () {
1647316473
var internals = {
1647416474
bundleType: 1,
16475-
version: "19.0.0-www-modern-5dcb0097-20240918",
16475+
version: "19.0.0-www-modern-5e83d9ab-20240918",
1647616476
rendererPackageName: "react-art",
1647716477
currentDispatcherRef: ReactSharedInternals,
1647816478
findFiberByHostInstance: getInstanceFromNode,
16479-
reconcilerVersion: "19.0.0-www-modern-5dcb0097-20240918"
16479+
reconcilerVersion: "19.0.0-www-modern-5e83d9ab-20240918"
1648016480
};
1648116481
internals.overrideHookState = overrideHookState;
1648216482
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -16510,7 +16510,7 @@ __DEV__ &&
1651016510
exports.Shape = Shape;
1651116511
exports.Surface = Surface;
1651216512
exports.Text = Text;
16513-
exports.version = "19.0.0-www-modern-5dcb0097-20240918";
16513+
exports.version = "19.0.0-www-modern-5e83d9ab-20240918";
1651416514
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1651516515
"function" ===
1651616516
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)