Skip to content

Commit a5d282a

Browse files
committed
[DevTools] Fix crash when inspecting Components suspended on data awaited in anonymous functions (facebook#34234)
DiffTrain build for [3e20dc8](facebook@3e20dc8)
1 parent f55a80d commit a5d282a

38 files changed

+123
-109
lines changed

compiled/eslint-plugin-react-hooks/index.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ const rule$2 = {
923923
}
924924
let callback = node.arguments[callbackIndex];
925925
const reactiveHook = node.callee;
926-
const nodeWithoutNamespace = getNodeWithoutReactNamespace(reactiveHook);
926+
const nodeWithoutNamespace = getNodeWithoutReactNamespace$1(reactiveHook);
927927
const reactiveHookName = 'name' in nodeWithoutNamespace ? nodeWithoutNamespace.name : '';
928928
const maybeNode = node.arguments[callbackIndex + 1];
929929
const declaredDependenciesNode = maybeNode &&
@@ -1330,7 +1330,7 @@ function analyzePropertyChain(node, optionalChains) {
13301330
throw new Error(`Unsupported node type: ${node.type}`);
13311331
}
13321332
}
1333-
function getNodeWithoutReactNamespace(node) {
1333+
function getNodeWithoutReactNamespace$1(node) {
13341334
if (node.type === 'MemberExpression' &&
13351335
node.object.type === 'Identifier' &&
13361336
node.object.name === 'React' &&
@@ -1341,7 +1341,7 @@ function getNodeWithoutReactNamespace(node) {
13411341
return node;
13421342
}
13431343
function getReactiveHookCallbackIndex(calleeNode, options) {
1344-
const node = getNodeWithoutReactNamespace(calleeNode);
1344+
const node = getNodeWithoutReactNamespace$1(calleeNode);
13451345
if (node.type !== 'Identifier') {
13461346
return -1;
13471347
}
@@ -54868,6 +54868,19 @@ function isInsideTryCatch(node) {
5486854868
}
5486954869
return false;
5487054870
}
54871+
function getNodeWithoutReactNamespace(node) {
54872+
if (node.type === 'MemberExpression' &&
54873+
node.object.type === 'Identifier' &&
54874+
node.object.name === 'React' &&
54875+
node.property.type === 'Identifier' &&
54876+
!node.computed) {
54877+
return node.property;
54878+
}
54879+
return node;
54880+
}
54881+
function isUseEffectIdentifier(node) {
54882+
return node.type === 'Identifier' && node.name === 'useEffect';
54883+
}
5487154884
function isUseEffectEventIdentifier(node) {
5487254885
{
5487354886
return node.type === 'Identifier' && node.name === 'useEffectEvent';
@@ -55165,9 +55178,9 @@ const rule = {
5516555178
}
5516655179
reactHooks.push(node.callee);
5516755180
}
55168-
if (node.callee.type === 'Identifier' &&
55169-
(node.callee.name === 'useEffect' ||
55170-
isUseEffectEventIdentifier(node.callee)) &&
55181+
const nodeWithoutNamespace = getNodeWithoutReactNamespace(node.callee);
55182+
if ((isUseEffectIdentifier(nodeWithoutNamespace) ||
55183+
isUseEffectEventIdentifier(nodeWithoutNamespace)) &&
5517155184
node.arguments.length > 0) {
5517255185
lastEffect = node;
5517355186
}

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7a36dfedc70ffb49be2e4e23b40e01d34cef267e
1+
3e20dc8b9c4d335c77e246d114a1bcfd1b77aaae
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7a36dfedc70ffb49be2e4e23b40e01d34cef267e
1+
3e20dc8b9c4d335c77e246d114a1bcfd1b77aaae

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ __DEV__ &&
14091409
exports.useTransition = function () {
14101410
return resolveDispatcher().useTransition();
14111411
};
1412-
exports.version = "19.2.0-www-classic-7a36dfed-20250816";
1412+
exports.version = "19.2.0-www-classic-3e20dc8b-20250820";
14131413
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14141414
"function" ===
14151415
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
@@ -1409,7 +1409,7 @@ __DEV__ &&
14091409
exports.useTransition = function () {
14101410
return resolveDispatcher().useTransition();
14111411
};
1412-
exports.version = "19.2.0-www-modern-7a36dfed-20250816";
1412+
exports.version = "19.2.0-www-modern-3e20dc8b-20250820";
14131413
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14141414
"function" ===
14151415
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
@@ -600,4 +600,4 @@ exports.useSyncExternalStore = function (
600600
exports.useTransition = function () {
601601
return ReactSharedInternals.H.useTransition();
602602
};
603-
exports.version = "19.2.0-www-classic-7a36dfed-20250816";
603+
exports.version = "19.2.0-www-classic-3e20dc8b-20250820";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,4 +600,4 @@ exports.useSyncExternalStore = function (
600600
exports.useTransition = function () {
601601
return ReactSharedInternals.H.useTransition();
602602
};
603-
exports.version = "19.2.0-www-modern-7a36dfed-20250816";
603+
exports.version = "19.2.0-www-modern-3e20dc8b-20250820";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ exports.useSyncExternalStore = function (
604604
exports.useTransition = function () {
605605
return ReactSharedInternals.H.useTransition();
606606
};
607-
exports.version = "19.2.0-www-classic-7a36dfed-20250816";
607+
exports.version = "19.2.0-www-classic-3e20dc8b-20250820";
608608
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
609609
"function" ===
610610
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
@@ -604,7 +604,7 @@ exports.useSyncExternalStore = function (
604604
exports.useTransition = function () {
605605
return ReactSharedInternals.H.useTransition();
606606
};
607-
exports.version = "19.2.0-www-modern-7a36dfed-20250816";
607+
exports.version = "19.2.0-www-modern-3e20dc8b-20250820";
608608
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
609609
"function" ===
610610
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
@@ -19588,10 +19588,10 @@ __DEV__ &&
1958819588
(function () {
1958919589
var internals = {
1959019590
bundleType: 1,
19591-
version: "19.2.0-www-classic-7a36dfed-20250816",
19591+
version: "19.2.0-www-classic-3e20dc8b-20250820",
1959219592
rendererPackageName: "react-art",
1959319593
currentDispatcherRef: ReactSharedInternals,
19594-
reconcilerVersion: "19.2.0-www-classic-7a36dfed-20250816"
19594+
reconcilerVersion: "19.2.0-www-classic-3e20dc8b-20250820"
1959519595
};
1959619596
internals.overrideHookState = overrideHookState;
1959719597
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -19625,7 +19625,7 @@ __DEV__ &&
1962519625
exports.Shape = Shape;
1962619626
exports.Surface = Surface;
1962719627
exports.Text = Text;
19628-
exports.version = "19.2.0-www-classic-7a36dfed-20250816";
19628+
exports.version = "19.2.0-www-classic-3e20dc8b-20250820";
1962919629
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1963019630
"function" ===
1963119631
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)