Skip to content

Commit 6c082d0

Browse files
committed
[DevTools] Don't capture durations for disconnected subtrees when profiling (facebook#35718)
After facebook#34089, when updating (possibly, mounting) inside disconnected subtree, we don't record this as an operation. This only happens during reconnect. The issue is that `recordProfilingDurations()` can be called, which diffs tree base duration and reports it to the Frontend: https://github.com/facebook/react/blob/65db1000b944c8a07b5947c06b38eb8364dce4f2/packages/react-devtools-shared/src/backend/fiber/renderer.js#L4506-L4521 This operation can be recorded before the "Add" operation, and it will not be resolved properly on the Frontend side. Before the fix: ``` commit tree › Suspense › should handle transitioning from fallback back to content during profiling Could not clone the node: commit tree does not contain fiber "5". This is a bug in React DevTools. 162 | const existingNode = nodes.get(id); 163 | if (existingNode == null) { > 164 | throw new Error( | ^ 165 | `Could not clone the node: commit tree does not contain fiber "${id}". This is a bug in React DevTools.`, 166 | ); 167 | } at getClonedNode (packages/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.js:164:13) at updateTree (packages/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.js:348:24) at getCommitTree (packages/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.js:112:20) at ProfilingCache.getCommitTree (packages/react-devtools-shared/src/devtools/ProfilingCache.js:40:46) at Object.<anonymous> (packages/react-devtools-shared/src/__tests__/profilingCommitTreeBuilder-test.js:257:44) ``` DiffTrain build for [c6bb26b](facebook@c6bb26b)
1 parent 47f4f1b commit 6c082d0

21 files changed

Lines changed: 128 additions & 160 deletions

compiled-rn/VERSION_NATIVE_FB

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19.3.0-native-fb-95ffd6cd-20260205
1+
19.3.0-native-fb-c6bb26bf-20260209

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<<912813980b6c79cb465fbbd0df05988b>>
10+
* @generated SignedSource<<a6e195ec94f19817c5fc1c6084f9cf6e>>
1111
*/
1212

1313
"use strict";
@@ -410,5 +410,5 @@ __DEV__ &&
410410
exports.useFormStatus = function () {
411411
return resolveDispatcher().useHostTransitionStatus();
412412
};
413-
exports.version = "19.3.0-native-fb-95ffd6cd-20260205";
413+
exports.version = "19.3.0-native-fb-c6bb26bf-20260209";
414414
})();

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<<66c3d3d092132ffe5fb5d5496d491ef0>>
10+
* @generated SignedSource<<79f33a34f12f1eb2d849b216f5de71b1>>
1111
*/
1212

1313
"use strict";
@@ -209,4 +209,4 @@ exports.useFormState = function (action, initialState, permalink) {
209209
exports.useFormStatus = function () {
210210
return ReactSharedInternals.H.useHostTransitionStatus();
211211
};
212-
exports.version = "19.3.0-native-fb-95ffd6cd-20260205";
212+
exports.version = "19.3.0-native-fb-c6bb26bf-20260209";

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<<66c3d3d092132ffe5fb5d5496d491ef0>>
10+
* @generated SignedSource<<79f33a34f12f1eb2d849b216f5de71b1>>
1111
*/
1212

1313
"use strict";
@@ -209,4 +209,4 @@ exports.useFormState = function (action, initialState, permalink) {
209209
exports.useFormStatus = function () {
210210
return ReactSharedInternals.H.useHostTransitionStatus();
211211
};
212-
exports.version = "19.3.0-native-fb-95ffd6cd-20260205";
212+
exports.version = "19.3.0-native-fb-c6bb26bf-20260209";

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

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<50d07b70e524a21eb065979db0e359ea>>
10+
* @generated SignedSource<<49f88e6105f89897774e7a8a8294b35e>>
1111
*/
1212

1313
/*
@@ -7282,53 +7282,45 @@ __DEV__ &&
72827282
);
72837283
}
72847284
if (isArrayImpl(newChild))
7285-
return (
7286-
(prevDebugInfo = pushDebugInfo(newChild._debugInfo)),
7287-
(returnFiber = reconcileChildrenArray(
7288-
returnFiber,
7289-
currentFirstChild,
7290-
newChild,
7291-
lanes
7292-
)),
7293-
(currentDebugInfo = prevDebugInfo),
7294-
returnFiber
7285+
return reconcileChildrenArray(
7286+
returnFiber,
7287+
currentFirstChild,
7288+
newChild,
7289+
lanes
72957290
);
72967291
if (getIteratorFn(newChild)) {
7297-
prevDebugInfo = pushDebugInfo(newChild._debugInfo);
7298-
key = getIteratorFn(newChild);
7299-
if ("function" !== typeof key)
7292+
prevDebugInfo = newChild;
7293+
newChild = getIteratorFn(prevDebugInfo);
7294+
if ("function" !== typeof newChild)
73007295
throw Error(
73017296
"An object is not an iterable. This error is likely caused by a bug in React. Please file an issue."
73027297
);
7303-
var newChildren = key.call(newChild);
7304-
if (newChildren === newChild) {
7298+
key = newChild.call(prevDebugInfo);
7299+
if (key === prevDebugInfo) {
73057300
if (
73067301
0 !== returnFiber.tag ||
73077302
"[object GeneratorFunction]" !==
73087303
Object.prototype.toString.call(returnFiber.type) ||
7309-
"[object Generator]" !==
7310-
Object.prototype.toString.call(newChildren)
7304+
"[object Generator]" !== Object.prototype.toString.call(key)
73117305
)
73127306
didWarnAboutGenerators ||
73137307
console.error(
73147308
"Using Iterators as children is unsupported and will likely yield unexpected results because enumerating a generator mutates it. You may convert it to an array with `Array.from()` or the `[...spread]` operator before rendering. You can also use an Iterable that can iterate multiple times over the same items."
73157309
),
73167310
(didWarnAboutGenerators = !0);
73177311
} else
7318-
newChild.entries !== key ||
7312+
prevDebugInfo.entries !== newChild ||
73197313
didWarnAboutMaps ||
73207314
(console.error(
73217315
"Using Maps as children is not supported. Use an array of keyed ReactElements instead."
73227316
),
73237317
(didWarnAboutMaps = !0));
7324-
returnFiber = reconcileChildrenIterator(
7318+
return reconcileChildrenIterator(
73257319
returnFiber,
73267320
currentFirstChild,
7327-
newChildren,
7321+
key,
73287322
lanes
73297323
);
7330-
currentDebugInfo = prevDebugInfo;
7331-
return returnFiber;
73327324
}
73337325
if ("function" === typeof newChild.then)
73347326
return (
@@ -30203,11 +30195,11 @@ __DEV__ &&
3020330195
};
3020430196
(function () {
3020530197
var isomorphicReactPackageVersion = React.version;
30206-
if ("19.3.0-native-fb-95ffd6cd-20260205" !== isomorphicReactPackageVersion)
30198+
if ("19.3.0-native-fb-c6bb26bf-20260209" !== isomorphicReactPackageVersion)
3020730199
throw Error(
3020830200
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
3020930201
(isomorphicReactPackageVersion +
30210-
"\n - react-dom: 19.3.0-native-fb-95ffd6cd-20260205\nLearn more: https://react.dev/warnings/version-mismatch")
30202+
"\n - react-dom: 19.3.0-native-fb-c6bb26bf-20260209\nLearn more: https://react.dev/warnings/version-mismatch")
3021130203
);
3021230204
})();
3021330205
("function" === typeof Map &&
@@ -30244,10 +30236,10 @@ __DEV__ &&
3024430236
!(function () {
3024530237
var internals = {
3024630238
bundleType: 1,
30247-
version: "19.3.0-native-fb-95ffd6cd-20260205",
30239+
version: "19.3.0-native-fb-c6bb26bf-20260209",
3024830240
rendererPackageName: "react-dom",
3024930241
currentDispatcherRef: ReactSharedInternals,
30250-
reconcilerVersion: "19.3.0-native-fb-95ffd6cd-20260205"
30242+
reconcilerVersion: "19.3.0-native-fb-c6bb26bf-20260209"
3025130243
};
3025230244
internals.overrideHookState = overrideHookState;
3025330245
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -30397,5 +30389,5 @@ __DEV__ &&
3039730389
listenToAllSupportedEvents(container);
3039830390
return new ReactDOMHydrationRoot(initialChildren);
3039930391
};
30400-
exports.version = "19.3.0-native-fb-95ffd6cd-20260205";
30392+
exports.version = "19.3.0-native-fb-c6bb26bf-20260209";
3040130393
})();

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<cfee1f022085bf493941177d037c7b6d>>
10+
* @generated SignedSource<<8d3e8681b5d81cb3435fd32cc748fba4>>
1111
*/
1212

1313
/*
@@ -17759,14 +17759,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1775917759
};
1776017760
var isomorphicReactPackageVersion$jscomp$inline_2046 = React.version;
1776117761
if (
17762-
"19.3.0-native-fb-95ffd6cd-20260205" !==
17762+
"19.3.0-native-fb-c6bb26bf-20260209" !==
1776317763
isomorphicReactPackageVersion$jscomp$inline_2046
1776417764
)
1776517765
throw Error(
1776617766
formatProdErrorMessage(
1776717767
527,
1776817768
isomorphicReactPackageVersion$jscomp$inline_2046,
17769-
"19.3.0-native-fb-95ffd6cd-20260205"
17769+
"19.3.0-native-fb-c6bb26bf-20260209"
1777017770
)
1777117771
);
1777217772
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17788,10 +17788,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1778817788
};
1778917789
var internals$jscomp$inline_2626 = {
1779017790
bundleType: 0,
17791-
version: "19.3.0-native-fb-95ffd6cd-20260205",
17791+
version: "19.3.0-native-fb-c6bb26bf-20260209",
1779217792
rendererPackageName: "react-dom",
1779317793
currentDispatcherRef: ReactSharedInternals,
17794-
reconcilerVersion: "19.3.0-native-fb-95ffd6cd-20260205"
17794+
reconcilerVersion: "19.3.0-native-fb-c6bb26bf-20260209"
1779517795
};
1779617796
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1779717797
var hook$jscomp$inline_2627 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17898,4 +17898,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1789817898
listenToAllSupportedEvents(container);
1789917899
return new ReactDOMHydrationRoot(initialChildren);
1790017900
};
17901-
exports.version = "19.3.0-native-fb-95ffd6cd-20260205";
17901+
exports.version = "19.3.0-native-fb-c6bb26bf-20260209";

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<6a1249999fee26b4d30e67765efabe25>>
10+
* @generated SignedSource<<069666987516facfa0b227a23c30d4df>>
1111
*/
1212

1313
/*
@@ -19748,14 +19748,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1974819748
};
1974919749
var isomorphicReactPackageVersion$jscomp$inline_2394 = React.version;
1975019750
if (
19751-
"19.3.0-native-fb-95ffd6cd-20260205" !==
19751+
"19.3.0-native-fb-c6bb26bf-20260209" !==
1975219752
isomorphicReactPackageVersion$jscomp$inline_2394
1975319753
)
1975419754
throw Error(
1975519755
formatProdErrorMessage(
1975619756
527,
1975719757
isomorphicReactPackageVersion$jscomp$inline_2394,
19758-
"19.3.0-native-fb-95ffd6cd-20260205"
19758+
"19.3.0-native-fb-c6bb26bf-20260209"
1975919759
)
1976019760
);
1976119761
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -19777,10 +19777,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1977719777
};
1977819778
var internals$jscomp$inline_2401 = {
1977919779
bundleType: 0,
19780-
version: "19.3.0-native-fb-95ffd6cd-20260205",
19780+
version: "19.3.0-native-fb-c6bb26bf-20260209",
1978119781
rendererPackageName: "react-dom",
1978219782
currentDispatcherRef: ReactSharedInternals,
19783-
reconcilerVersion: "19.3.0-native-fb-95ffd6cd-20260205",
19783+
reconcilerVersion: "19.3.0-native-fb-c6bb26bf-20260209",
1978419784
getLaneLabelMap: function () {
1978519785
for (
1978619786
var map = new Map(), lane = 1, index$337 = 0;
@@ -19903,4 +19903,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1990319903
listenToAllSupportedEvents(container);
1990419904
return new ReactDOMHydrationRoot(initialChildren);
1990519905
};
19906-
exports.version = "19.3.0-native-fb-95ffd6cd-20260205";
19906+
exports.version = "19.3.0-native-fb-c6bb26bf-20260209";

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

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<60f9065bcd461ac76ccf7d5b58721d6a>>
10+
* @generated SignedSource<<197ec200428e93c66c6be907d3b6c618>>
1111
*/
1212

1313
/*
@@ -7290,53 +7290,45 @@ __DEV__ &&
72907290
);
72917291
}
72927292
if (isArrayImpl(newChild))
7293-
return (
7294-
(prevDebugInfo = pushDebugInfo(newChild._debugInfo)),
7295-
(returnFiber = reconcileChildrenArray(
7296-
returnFiber,
7297-
currentFirstChild,
7298-
newChild,
7299-
lanes
7300-
)),
7301-
(currentDebugInfo = prevDebugInfo),
7302-
returnFiber
7293+
return reconcileChildrenArray(
7294+
returnFiber,
7295+
currentFirstChild,
7296+
newChild,
7297+
lanes
73037298
);
73047299
if (getIteratorFn(newChild)) {
7305-
prevDebugInfo = pushDebugInfo(newChild._debugInfo);
7306-
key = getIteratorFn(newChild);
7307-
if ("function" !== typeof key)
7300+
prevDebugInfo = newChild;
7301+
newChild = getIteratorFn(prevDebugInfo);
7302+
if ("function" !== typeof newChild)
73087303
throw Error(
73097304
"An object is not an iterable. This error is likely caused by a bug in React. Please file an issue."
73107305
);
7311-
var newChildren = key.call(newChild);
7312-
if (newChildren === newChild) {
7306+
key = newChild.call(prevDebugInfo);
7307+
if (key === prevDebugInfo) {
73137308
if (
73147309
0 !== returnFiber.tag ||
73157310
"[object GeneratorFunction]" !==
73167311
Object.prototype.toString.call(returnFiber.type) ||
7317-
"[object Generator]" !==
7318-
Object.prototype.toString.call(newChildren)
7312+
"[object Generator]" !== Object.prototype.toString.call(key)
73197313
)
73207314
didWarnAboutGenerators ||
73217315
console.error(
73227316
"Using Iterators as children is unsupported and will likely yield unexpected results because enumerating a generator mutates it. You may convert it to an array with `Array.from()` or the `[...spread]` operator before rendering. You can also use an Iterable that can iterate multiple times over the same items."
73237317
),
73247318
(didWarnAboutGenerators = !0);
73257319
} else
7326-
newChild.entries !== key ||
7320+
prevDebugInfo.entries !== newChild ||
73277321
didWarnAboutMaps ||
73287322
(console.error(
73297323
"Using Maps as children is not supported. Use an array of keyed ReactElements instead."
73307324
),
73317325
(didWarnAboutMaps = !0));
7332-
returnFiber = reconcileChildrenIterator(
7326+
return reconcileChildrenIterator(
73337327
returnFiber,
73347328
currentFirstChild,
7335-
newChildren,
7329+
key,
73367330
lanes
73377331
);
7338-
currentDebugInfo = prevDebugInfo;
7339-
return returnFiber;
73407332
}
73417333
if ("function" === typeof newChild.then)
73427334
return (
@@ -30265,11 +30257,11 @@ __DEV__ &&
3026530257
};
3026630258
(function () {
3026730259
var isomorphicReactPackageVersion = React.version;
30268-
if ("19.3.0-native-fb-95ffd6cd-20260205" !== isomorphicReactPackageVersion)
30260+
if ("19.3.0-native-fb-c6bb26bf-20260209" !== isomorphicReactPackageVersion)
3026930261
throw Error(
3027030262
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
3027130263
(isomorphicReactPackageVersion +
30272-
"\n - react-dom: 19.3.0-native-fb-95ffd6cd-20260205\nLearn more: https://react.dev/warnings/version-mismatch")
30264+
"\n - react-dom: 19.3.0-native-fb-c6bb26bf-20260209\nLearn more: https://react.dev/warnings/version-mismatch")
3027330265
);
3027430266
})();
3027530267
("function" === typeof Map &&
@@ -30306,10 +30298,10 @@ __DEV__ &&
3030630298
!(function () {
3030730299
var internals = {
3030830300
bundleType: 1,
30309-
version: "19.3.0-native-fb-95ffd6cd-20260205",
30301+
version: "19.3.0-native-fb-c6bb26bf-20260209",
3031030302
rendererPackageName: "react-dom",
3031130303
currentDispatcherRef: ReactSharedInternals,
30312-
reconcilerVersion: "19.3.0-native-fb-95ffd6cd-20260205"
30304+
reconcilerVersion: "19.3.0-native-fb-c6bb26bf-20260209"
3031330305
};
3031430306
internals.overrideHookState = overrideHookState;
3031530307
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -30775,7 +30767,7 @@ __DEV__ &&
3077530767
exports.useFormStatus = function () {
3077630768
return resolveDispatcher().useHostTransitionStatus();
3077730769
};
30778-
exports.version = "19.3.0-native-fb-95ffd6cd-20260205";
30770+
exports.version = "19.3.0-native-fb-c6bb26bf-20260209";
3077930771
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
3078030772
"function" ===
3078130773
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)