Skip to content

Commit

Permalink
[Fiber/DevTools] Stop injecting findHostInstanceByFiber (#30519)
Browse files Browse the repository at this point in the history
This is not used by DevTools since it has its own implementation of it.

This function is getting removed since `findDOMNode` is getting removed
so we shouldn't keep around extra bytes unnecessarily.

There is also `findHostInstancesForRefresh` which should really be
implemented on the `react-refresh` side. Not using an injection but
that's a heavier lift and only affects `__DEV__`.

DiffTrain build for commit bea5a2b.
  • Loading branch information
sebmarkbage committed Jul 30, 2024
1 parent aaac27a commit a361701
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 134 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-6b82f3c9-20240729
19.0.0-native-fb-bea5a2bc-20240729
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<45825b7fcc62c4e0270bf13c80f968b7>>
* @generated SignedSource<<f86c05005971e3a7b71fb09889af7bf1>>
*/

"use strict";
__DEV__ &&
(function () {
function JSCompiler_object_inline_createNodeMock_1096() {
function JSCompiler_object_inline_createNodeMock_1093() {
return null;
}
function findHook(fiber, id) {
Expand Down Expand Up @@ -683,16 +683,6 @@ __DEV__ &&
throw Error("Unable to find node on an unmounted component.");
return a.stateNode.current === a ? fiber : alternate;
}
function findCurrentHostFiberImpl(node) {
var tag = node.tag;
if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return node;
for (node = node.child; null !== node; ) {
tag = findCurrentHostFiberImpl(node);
if (null !== tag) return tag;
node = node.sibling;
}
return null;
}
function injectInternals(internals) {
if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) return !1;
var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down Expand Up @@ -12837,11 +12827,6 @@ __DEV__ &&
(scheduleUpdateOnFiber(element, rootFiber, lane),
entangleTransitions(element, rootFiber, lane));
}
function findHostInstanceByFiber(fiber) {
fiber = findCurrentFiberUsingSlowPath(fiber);
fiber = null !== fiber ? findCurrentHostFiberImpl(fiber) : null;
return null === fiber ? null : fiber.stateNode;
}
function emptyFindFiberByHostInstance() {
return null;
}
Expand Down Expand Up @@ -15109,7 +15094,6 @@ __DEV__ &&
setSuspenseHandler: setSuspenseHandler,
scheduleUpdate: scheduleUpdate,
currentDispatcherRef: ReactSharedInternals,
findHostInstanceByFiber: findHostInstanceByFiber,
findFiberByHostInstance:
devToolsConfig.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
Expand All @@ -15118,20 +15102,20 @@ __DEV__ &&
scheduleRoot: scheduleRoot,
setRefreshHandler: setRefreshHandler,
getCurrentFiber: getCurrentFiberForDevTools,
reconcilerVersion: "19.0.0-native-fb-6b82f3c9-20240729"
reconcilerVersion: "19.0.0-native-fb-bea5a2bc-20240729"
});
})({
findFiberByHostInstance: function () {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 1,
version: "19.0.0-native-fb-6b82f3c9-20240729",
version: "19.0.0-native-fb-bea5a2bc-20240729",
rendererPackageName: "react-test-renderer"
});
exports._Scheduler = Scheduler;
exports.act = act;
exports.create = function (element, options) {
var createNodeMock = JSCompiler_object_inline_createNodeMock_1096,
var createNodeMock = JSCompiler_object_inline_createNodeMock_1093,
isConcurrent = !1,
isStrictMode = !1;
"object" === typeof options &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<2fc5c3e33cfc73fcc2c11ad232d302ed>>
* @generated SignedSource<<3b0950e1d465316145b94897bec0f920>>
*/

"use strict";
Expand Down Expand Up @@ -448,16 +448,6 @@ function findCurrentFiberUsingSlowPath(fiber) {
throw Error("Unable to find node on an unmounted component.");
return a.stateNode.current === a ? fiber : alternate;
}
function findCurrentHostFiberImpl(node) {
var tag = node.tag;
if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return node;
for (node = node.child; null !== node; ) {
tag = findCurrentHostFiberImpl(node);
if (null !== tag) return tag;
node = node.sibling;
}
return null;
}
var isArrayImpl = Array.isArray,
scheduleCallback$3 = Scheduler$1.unstable_scheduleCallback,
cancelCallback$1 = Scheduler$1.unstable_cancelCallback,
Expand Down Expand Up @@ -9323,19 +9313,19 @@ function wrapFiber(fiber) {
fiberToWrapper.set(fiber, wrapper));
return wrapper;
}
var devToolsConfig$jscomp$inline_1035 = {
var devToolsConfig$jscomp$inline_1031 = {
findFiberByHostInstance: function () {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "19.0.0-native-fb-6b82f3c9-20240729",
version: "19.0.0-native-fb-bea5a2bc-20240729",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1211 = {
bundleType: devToolsConfig$jscomp$inline_1035.bundleType,
version: devToolsConfig$jscomp$inline_1035.version,
rendererPackageName: devToolsConfig$jscomp$inline_1035.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1035.rendererConfig,
var internals$jscomp$inline_1207 = {
bundleType: devToolsConfig$jscomp$inline_1031.bundleType,
version: devToolsConfig$jscomp$inline_1031.version,
rendererPackageName: devToolsConfig$jscomp$inline_1031.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1031.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
Expand All @@ -9346,32 +9336,27 @@ var internals$jscomp$inline_1211 = {
setSuspenseHandler: null,
scheduleUpdate: null,
currentDispatcherRef: ReactSharedInternals,
findHostInstanceByFiber: function (fiber) {
fiber = findCurrentFiberUsingSlowPath(fiber);
fiber = null !== fiber ? findCurrentHostFiberImpl(fiber) : null;
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1035.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1031.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-native-fb-6b82f3c9-20240729"
reconcilerVersion: "19.0.0-native-fb-bea5a2bc-20240729"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1212 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
var hook$jscomp$inline_1208 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (
!hook$jscomp$inline_1212.isDisabled &&
hook$jscomp$inline_1212.supportsFiber
!hook$jscomp$inline_1208.isDisabled &&
hook$jscomp$inline_1208.supportsFiber
)
try {
(rendererID = hook$jscomp$inline_1212.inject(
internals$jscomp$inline_1211
(rendererID = hook$jscomp$inline_1208.inject(
internals$jscomp$inline_1207
)),
(injectedHook = hook$jscomp$inline_1212);
(injectedHook = hook$jscomp$inline_1208);
} catch (err) {}
}
exports._Scheduler = Scheduler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<ebdb7058bb4b6e0370bac7651360c216>>
* @generated SignedSource<<d632c5265089eef1357fa59e74d227eb>>
*/

"use strict";
Expand Down Expand Up @@ -448,16 +448,6 @@ function findCurrentFiberUsingSlowPath(fiber) {
throw Error("Unable to find node on an unmounted component.");
return a.stateNode.current === a ? fiber : alternate;
}
function findCurrentHostFiberImpl(node) {
var tag = node.tag;
if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return node;
for (node = node.child; null !== node; ) {
tag = findCurrentHostFiberImpl(node);
if (null !== tag) return tag;
node = node.sibling;
}
return null;
}
var isArrayImpl = Array.isArray,
scheduleCallback$3 = Scheduler$1.unstable_scheduleCallback,
cancelCallback$1 = Scheduler$1.unstable_cancelCallback,
Expand Down Expand Up @@ -9947,12 +9937,12 @@ function wrapFiber(fiber) {
fiberToWrapper.set(fiber, wrapper));
return wrapper;
}
var devToolsConfig$jscomp$inline_1119 = {
var devToolsConfig$jscomp$inline_1115 = {
findFiberByHostInstance: function () {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "19.0.0-native-fb-6b82f3c9-20240729",
version: "19.0.0-native-fb-bea5a2bc-20240729",
rendererPackageName: "react-test-renderer"
};
(function (internals) {
Expand All @@ -9969,10 +9959,10 @@ var devToolsConfig$jscomp$inline_1119 = {
} catch (err) {}
return hook.checkDCE ? !0 : !1;
})({
bundleType: devToolsConfig$jscomp$inline_1119.bundleType,
version: devToolsConfig$jscomp$inline_1119.version,
rendererPackageName: devToolsConfig$jscomp$inline_1119.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1119.rendererConfig,
bundleType: devToolsConfig$jscomp$inline_1115.bundleType,
version: devToolsConfig$jscomp$inline_1115.version,
rendererPackageName: devToolsConfig$jscomp$inline_1115.rendererPackageName,
rendererConfig: devToolsConfig$jscomp$inline_1115.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
Expand All @@ -9983,20 +9973,15 @@ var devToolsConfig$jscomp$inline_1119 = {
setSuspenseHandler: null,
scheduleUpdate: null,
currentDispatcherRef: ReactSharedInternals,
findHostInstanceByFiber: function (fiber) {
fiber = findCurrentFiberUsingSlowPath(fiber);
fiber = null !== fiber ? findCurrentHostFiberImpl(fiber) : null;
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1119.findFiberByHostInstance ||
devToolsConfig$jscomp$inline_1115.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-native-fb-6b82f3c9-20240729"
reconcilerVersion: "19.0.0-native-fb-bea5a2bc-20240729"
});
exports._Scheduler = Scheduler;
exports.act = act;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<b9e9e19d4032616fef667d0dd9eba802>>
* @generated SignedSource<<ce9a60542404b5391a0325717aa14a30>>
*/

"use strict";
Expand Down Expand Up @@ -1704,7 +1704,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.0.0-native-fb-6b82f3c9-20240729";
exports.version = "19.0.0-native-fb-bea5a2bc-20240729";
"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<<1b13935c9752f67504f31fedf1f97d68>>
* @generated SignedSource<<fb41549baba1e6f16f81f36add5627f8>>
*/

"use strict";
Expand Down Expand Up @@ -579,4 +579,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-native-fb-6b82f3c9-20240729";
exports.version = "19.0.0-native-fb-bea5a2bc-20240729";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<51f1f5d0a03158aef8a5b651d1d06957>>
* @generated SignedSource<<e54554c9f097565369f1b4ae58864a9d>>
*/

"use strict";
Expand Down Expand Up @@ -583,7 +583,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-native-fb-6b82f3c9-20240729";
exports.version = "19.0.0-native-fb-bea5a2bc-20240729";
"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
@@ -1 +1 @@
6b82f3c9048ff0dd7e6d628dc5770faf85d32a87
bea5a2bc46cc95713392175c3c6307e49c14cd98
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<21e82ca5963e783e2f6590a40ce8119e>>
* @generated SignedSource<<890a4ea59cd9164f3a5525dce24215bb>>
*/

"use strict";
Expand Down Expand Up @@ -13898,10 +13898,6 @@ __DEV__ &&
(scheduleUpdateOnFiber(element, rootFiber, lane),
entangleTransitions(element, rootFiber, lane));
}
function findHostInstanceByFiber(fiber) {
fiber = findCurrentHostFiber(fiber);
return null === fiber ? null : fiber.stateNode;
}
function emptyFindFiberByHostInstance() {
return null;
}
Expand Down Expand Up @@ -16751,7 +16747,6 @@ __DEV__ &&
setSuspenseHandler: setSuspenseHandler,
scheduleUpdate: scheduleUpdate,
currentDispatcherRef: ReactSharedInternals,
findHostInstanceByFiber: findHostInstanceByFiber,
findFiberByHostInstance:
devToolsConfig.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
Expand All @@ -16760,12 +16755,12 @@ __DEV__ &&
scheduleRoot: scheduleRoot,
setRefreshHandler: setRefreshHandler,
getCurrentFiber: getCurrentFiberForDevTools,
reconcilerVersion: "19.0.0-native-fb-6b82f3c9-20240729"
reconcilerVersion: "19.0.0-native-fb-bea5a2bc-20240729"
});
})({
findFiberByHostInstance: getInstanceFromNode,
bundleType: 1,
version: "19.0.0-native-fb-6b82f3c9-20240729",
version: "19.0.0-native-fb-bea5a2bc-20240729",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<51e1e1f2137d9e8f948aa81cc451048c>>
* @generated SignedSource<<bbb0cad9b4b4944ddd2e3c424d4127e4>>
*/

"use strict";
Expand Down Expand Up @@ -10576,7 +10576,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1141 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "19.0.0-native-fb-6b82f3c9-20240729",
version: "19.0.0-native-fb-bea5a2bc-20240729",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -10607,10 +10607,6 @@ var internals$jscomp$inline_1364 = {
setSuspenseHandler: null,
scheduleUpdate: null,
currentDispatcherRef: ReactSharedInternals,
findHostInstanceByFiber: function (fiber) {
fiber = findCurrentHostFiber(fiber);
return null === fiber ? null : fiber.stateNode;
},
findFiberByHostInstance:
devToolsConfig$jscomp$inline_1141.findFiberByHostInstance ||
emptyFindFiberByHostInstance,
Expand All @@ -10619,7 +10615,7 @@ var internals$jscomp$inline_1364 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-native-fb-6b82f3c9-20240729"
reconcilerVersion: "19.0.0-native-fb-bea5a2bc-20240729"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1365 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Loading

0 comments on commit a361701

Please sign in to comment.