Skip to content

Commit

Permalink
fix: use public instance in Fiber renderer and expose it from getInsp…
Browse files Browse the repository at this point in the history
…ectorDataForViewAtPoint (#31068)

React DevTools no longer operates with just Fibers, it now builds its
own Shadow Tree, which represents the tree on the Host (Fabric on
Native, DOM on Web).

We have to keep track of public instances for a select-to-inspect
feature. We've recently changed this logic in
#30831, and looks like we've been
incorrectly getting a public instance for Fabric case.

Not only this, turns out that all `getInspectorData...` APIs are
returning Fibers, and not public instances. I have to expose it, so that
React DevTools can correctly identify the element, which was selected.

Changes for React Native are in
[D63421463](https://www.internalfb.com/diff/D63421463)

DiffTrain build for commit d66fa02.
  • Loading branch information
hoxyq committed Sep 26, 2024
1 parent 2baa9b4 commit 635b8b6
Show file tree
Hide file tree
Showing 24 changed files with 106 additions and 95 deletions.
2 changes: 1 addition & 1 deletion compiled-rn/VERSION_NATIVE_FB
Original file line number Diff line number Diff line change
@@ -1 +1 @@
19.0.0-native-fb-778e1ed2-20240926
19.0.0-native-fb-d66fa02a-20240926
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<1d391b897b28e0a40b463f0cd330ecb9>>
* @generated SignedSource<<d00372bc01109f18348cdf21c4e9a6b8>>
*/

"use strict";
Expand Down Expand Up @@ -420,5 +420,5 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.0.0-native-fb-778e1ed2-20240926";
exports.version = "19.0.0-native-fb-d66fa02a-20240926";
})();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<8f65f0b5da0551267ae8d9135836943a>>
* @generated SignedSource<<868c2c45377609fdc75a190d68337a3e>>
*/

"use strict";
Expand Down Expand Up @@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-native-fb-778e1ed2-20240926";
exports.version = "19.0.0-native-fb-d66fa02a-20240926";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<8f65f0b5da0551267ae8d9135836943a>>
* @generated SignedSource<<868c2c45377609fdc75a190d68337a3e>>
*/

"use strict";
Expand Down Expand Up @@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-native-fb-778e1ed2-20240926";
exports.version = "19.0.0-native-fb-d66fa02a-20240926";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<f5ffc0c36bad3a894dfe63de67ba82c1>>
* @generated SignedSource<<98ff6e44e31c0a99c44b8c8b36e4c12b>>
*/

/*
Expand Down Expand Up @@ -25472,11 +25472,11 @@ __DEV__ &&
};
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-native-fb-778e1ed2-20240926" !== isomorphicReactPackageVersion)
if ("19.0.0-native-fb-d66fa02a-20240926" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.0.0-native-fb-778e1ed2-20240926\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.0.0-native-fb-d66fa02a-20240926\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -25513,11 +25513,11 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.0.0-native-fb-778e1ed2-20240926",
version: "19.0.0-native-fb-d66fa02a-20240926",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-778e1ed2-20240926"
reconcilerVersion: "19.0.0-native-fb-d66fa02a-20240926"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -25661,5 +25661,5 @@ __DEV__ &&
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.0.0-native-fb-778e1ed2-20240926";
exports.version = "19.0.0-native-fb-d66fa02a-20240926";
})();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<4015a32f0a281b58a4049cc13ffda2fe>>
* @generated SignedSource<<a09f33651fe28a1f192a618ac0cb95b1>>
*/

/*
Expand Down Expand Up @@ -15753,14 +15753,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_1708 = React.version;
if (
"19.0.0-native-fb-778e1ed2-20240926" !==
"19.0.0-native-fb-d66fa02a-20240926" !==
isomorphicReactPackageVersion$jscomp$inline_1708
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1708,
"19.0.0-native-fb-778e1ed2-20240926"
"19.0.0-native-fb-d66fa02a-20240926"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
Expand All @@ -15782,11 +15782,11 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2151 = {
bundleType: 0,
version: "19.0.0-native-fb-778e1ed2-20240926",
version: "19.0.0-native-fb-d66fa02a-20240926",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-778e1ed2-20240926"
reconcilerVersion: "19.0.0-native-fb-d66fa02a-20240926"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2152 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -15890,4 +15890,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.0.0-native-fb-778e1ed2-20240926";
exports.version = "19.0.0-native-fb-d66fa02a-20240926";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<e0edad628e3ae9cf5c58cd69e3f3278c>>
* @generated SignedSource<<7ce56cadd95efb065db34a90177a79eb>>
*/

/*
Expand Down Expand Up @@ -16405,14 +16405,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_1798 = React.version;
if (
"19.0.0-native-fb-778e1ed2-20240926" !==
"19.0.0-native-fb-d66fa02a-20240926" !==
isomorphicReactPackageVersion$jscomp$inline_1798
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1798,
"19.0.0-native-fb-778e1ed2-20240926"
"19.0.0-native-fb-d66fa02a-20240926"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
Expand All @@ -16434,11 +16434,11 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_1805 = {
bundleType: 0,
version: "19.0.0-native-fb-778e1ed2-20240926",
version: "19.0.0-native-fb-d66fa02a-20240926",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-778e1ed2-20240926",
reconcilerVersion: "19.0.0-native-fb-d66fa02a-20240926",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$292 = 0;
Expand Down Expand Up @@ -16557,4 +16557,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
listenToAllSupportedEvents(container);
return new ReactDOMHydrationRoot(initialChildren);
};
exports.version = "19.0.0-native-fb-778e1ed2-20240926";
exports.version = "19.0.0-native-fb-d66fa02a-20240926";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<7461bb5e8388b2ab269e15f33f1e8d01>>
* @generated SignedSource<<8c15d4eb3be49fe903be47b5a2def320>>
*/

/*
Expand Down Expand Up @@ -25533,11 +25533,11 @@ __DEV__ &&
};
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-native-fb-778e1ed2-20240926" !== isomorphicReactPackageVersion)
if ("19.0.0-native-fb-d66fa02a-20240926" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.0.0-native-fb-778e1ed2-20240926\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.0.0-native-fb-d66fa02a-20240926\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -25574,11 +25574,11 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.0.0-native-fb-778e1ed2-20240926",
version: "19.0.0-native-fb-d66fa02a-20240926",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-778e1ed2-20240926"
reconcilerVersion: "19.0.0-native-fb-d66fa02a-20240926"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -26038,7 +26038,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.0.0-native-fb-778e1ed2-20240926";
exports.version = "19.0.0-native-fb-d66fa02a-20240926";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<74da68ece113c9837fd5a5f7ffa9656d>>
* @generated SignedSource<<7f6e01bcfc6180fc72882ab81f548447>>
*/

/*
Expand Down Expand Up @@ -15764,14 +15764,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_1709 = React.version;
if (
"19.0.0-native-fb-778e1ed2-20240926" !==
"19.0.0-native-fb-d66fa02a-20240926" !==
isomorphicReactPackageVersion$jscomp$inline_1709
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1709,
"19.0.0-native-fb-778e1ed2-20240926"
"19.0.0-native-fb-d66fa02a-20240926"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
Expand All @@ -15793,11 +15793,11 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_2154 = {
bundleType: 0,
version: "19.0.0-native-fb-778e1ed2-20240926",
version: "19.0.0-native-fb-d66fa02a-20240926",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-778e1ed2-20240926"
reconcilerVersion: "19.0.0-native-fb-d66fa02a-20240926"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_2155 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -16055,4 +16055,4 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-native-fb-778e1ed2-20240926";
exports.version = "19.0.0-native-fb-d66fa02a-20240926";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<b24d0195159b5ddf5dec2f940e88a49a>>
* @generated SignedSource<<69ce8346e39ef9afc32e5fd40a790fcd>>
*/

/*
Expand Down Expand Up @@ -16420,14 +16420,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
};
var isomorphicReactPackageVersion$jscomp$inline_1799 = React.version;
if (
"19.0.0-native-fb-778e1ed2-20240926" !==
"19.0.0-native-fb-d66fa02a-20240926" !==
isomorphicReactPackageVersion$jscomp$inline_1799
)
throw Error(
formatProdErrorMessage(
527,
isomorphicReactPackageVersion$jscomp$inline_1799,
"19.0.0-native-fb-778e1ed2-20240926"
"19.0.0-native-fb-d66fa02a-20240926"
)
);
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
Expand All @@ -16449,11 +16449,11 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
};
var internals$jscomp$inline_1806 = {
bundleType: 0,
version: "19.0.0-native-fb-778e1ed2-20240926",
version: "19.0.0-native-fb-d66fa02a-20240926",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-778e1ed2-20240926",
reconcilerVersion: "19.0.0-native-fb-d66fa02a-20240926",
getLaneLabelMap: function () {
for (
var map = new Map(), lane = 1, index$292 = 0;
Expand Down Expand Up @@ -16726,7 +16726,7 @@ exports.useFormState = function (action, initialState, permalink) {
exports.useFormStatus = function () {
return ReactSharedInternals.H.useHostTransitionStatus();
};
exports.version = "19.0.0-native-fb-778e1ed2-20240926";
exports.version = "19.0.0-native-fb-d66fa02a-20240926";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<796ce350fdb7fd6030dd8fa89b0acc85>>
* @generated SignedSource<<6b5cedf736b6f7fe7edbe580662c4ec9>>
*/

"use strict";
Expand Down Expand Up @@ -15022,11 +15022,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-native-fb-778e1ed2-20240926",
version: "19.0.0-native-fb-d66fa02a-20240926",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-native-fb-778e1ed2-20240926"
reconcilerVersion: "19.0.0-native-fb-d66fa02a-20240926"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -15171,5 +15171,5 @@ __DEV__ &&
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.0.0-native-fb-778e1ed2-20240926";
exports.version = "19.0.0-native-fb-d66fa02a-20240926";
})();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<891d3744f557d4ef24e57c34b41282a0>>
* @generated SignedSource<<8166d4dfafe72a6712057618ae207625>>
*/

"use strict";
Expand Down Expand Up @@ -9397,14 +9397,14 @@ function wrapFiber(fiber) {
}
var internals$jscomp$inline_1320 = {
bundleType: 0,
version: "19.0.0-native-fb-778e1ed2-20240926",
version: "19.0.0-native-fb-d66fa02a-20240926",
rendererPackageName: "react-test-renderer",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: function (mockNode) {
mockNode = nodeToInstanceMap.get(mockNode);
return void 0 !== mockNode ? mockNode.internalInstanceHandle : null;
},
reconcilerVersion: "19.0.0-native-fb-778e1ed2-20240926"
reconcilerVersion: "19.0.0-native-fb-d66fa02a-20240926"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1321 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -9540,4 +9540,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
flushSyncWorkAcrossRoots_impl(0, !0));
}
};
exports.version = "19.0.0-native-fb-778e1ed2-20240926";
exports.version = "19.0.0-native-fb-d66fa02a-20240926";
Loading

0 comments on commit 635b8b6

Please sign in to comment.