Skip to content

Commit

Permalink
Remove RefreshRuntime.findAffectedHostInstances (#30538)
Browse files Browse the repository at this point in the history
I originally added this with a plan to visualize which nodes got updated
after a Fast Refresh. I didn't end up implementing that part, and to my
knowledge, no actively used integration actually does that or use this
method.

- [Webpack plugin doesn't use
it](https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/f1c8b9a44198449093ca95f85af5df97925e1cfc/lib/runtime/RefreshUtils.js)
- [RN doesn't use
it](https://github.com/facebook/react-native/blob/23c5c42de01953ed7b8e8938c2d3a8fac82250a0/packages/react-native/Libraries/Core/setUpReactRefresh.js)
- [Global GitHub code
search](https://github.com/search?q=findAffectedHostInstances&type=code&p=1)
only shows copies of this code and the type definition based on it, but
not actual calls to it

We should be able to delete this without a problem.

DiffTrain build for [96f3093](96f3093)
  • Loading branch information
gaearon committed Jul 30, 2024
1 parent 53526c5 commit 57f6b8f
Show file tree
Hide file tree
Showing 36 changed files with 774 additions and 1,734 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
146df7c311831a1d5b35f3783dae4a7030638fcf
96f3093becc1f26e06549b9a54b93db9df8f5689
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
146df7c311831a1d5b35f3783dae4a7030638fcf
96f3093becc1f26e06549b9a54b93db9df8f5689
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2001,7 +2001,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.0.0-www-classic-146df7c3-20240730";
exports.version = "19.0.0-www-classic-96f3093b-20240730";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -1981,7 +1981,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.0.0-www-modern-146df7c3-20240730";
exports.version = "19.0.0-www-modern-96f3093b-20240730";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,4 +665,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-classic-146df7c3-20240730";
exports.version = "19.0.0-www-classic-96f3093b-20240730";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,4 +665,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-modern-146df7c3-20240730";
exports.version = "19.0.0-www-modern-96f3093b-20240730";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-classic-146df7c3-20240730";
exports.version = "19.0.0-www-classic-96f3093b-20240730";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-modern-146df7c3-20240730";
exports.version = "19.0.0-www-modern-96f3093b-20240730";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
98 changes: 3 additions & 95 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,6 @@ __DEV__ &&
function shouldErrorImpl() {
return null;
}
function findHostInstancesForRefresh(root, families) {
var hostInstances = new Set();
families = new Set(
families.map(function (family) {
return family.current;
})
);
findHostInstancesForMatchingFibersRecursively(
root.current,
families,
hostInstances
);
return hostInstances;
}
function scheduleRoot(root, element) {
root.context === emptyContextObject &&
(updateContainerSync(element, root, null, null), flushSyncWork());
Expand Down Expand Up @@ -13964,83 +13950,6 @@ __DEV__ &&
staleFamilies
);
}
function findHostInstancesForMatchingFibersRecursively(
fiber,
types,
hostInstances
) {
var child = fiber.child,
sibling = fiber.sibling,
type = fiber.type,
candidateType = null;
switch (fiber.tag) {
case 0:
case 15:
case 1:
candidateType = type;
break;
case 11:
candidateType = type.render;
}
type = !1;
null !== candidateType && types.has(candidateType) && (type = !0);
if (type)
a: {
b: for (child = fiber, candidateType = !1; ; ) {
if (5 === child.tag || 26 === child.tag)
(candidateType = !0), hostInstances.add(child.stateNode);
else if (null !== child.child) {
child.child.return = child;
child = child.child;
continue;
}
if (child === fiber) {
child = candidateType;
break b;
}
for (; null === child.sibling; ) {
if (null === child.return || child.return === fiber) {
child = candidateType;
break b;
}
child = child.return;
}
child.sibling.return = child.return;
child = child.sibling;
}
if (!child)
for (;;) {
switch (fiber.tag) {
case 27:
case 5:
hostInstances.add(fiber.stateNode);
break a;
case 4:
hostInstances.add(fiber.stateNode.containerInfo);
break a;
case 3:
hostInstances.add(fiber.stateNode.containerInfo);
break a;
}
if (null === fiber.return)
throw Error("Expected to reach root first.");
fiber = fiber.return;
}
}
else
null !== child &&
findHostInstancesForMatchingFibersRecursively(
child,
types,
hostInstances
);
null !== sibling &&
findHostInstancesForMatchingFibersRecursively(
sibling,
types,
hostInstances
);
}
function FiberNode(tag, pendingProps, key, mode) {
this.tag = tag;
this.key = key;
Expand Down Expand Up @@ -16874,11 +16783,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-www-classic-146df7c3-20240730",
version: "19.0.0-www-classic-96f3093b-20240730",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-www-classic-146df7c3-20240730"
reconcilerVersion: "19.0.0-www-classic-96f3093b-20240730"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand All @@ -16889,7 +16798,6 @@ __DEV__ &&
internals.scheduleUpdate = scheduleUpdate;
internals.setErrorHandler = setErrorHandler;
internals.setSuspenseHandler = setSuspenseHandler;
internals.findHostInstancesForRefresh = findHostInstancesForRefresh;
internals.scheduleRefresh = scheduleRefresh;
internals.scheduleRoot = scheduleRoot;
internals.setRefreshHandler = setRefreshHandler;
Expand All @@ -16913,7 +16821,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-classic-146df7c3-20240730";
exports.version = "19.0.0-www-classic-96f3093b-20240730";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
98 changes: 3 additions & 95 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,6 @@ __DEV__ &&
function shouldErrorImpl() {
return null;
}
function findHostInstancesForRefresh(root, families) {
var hostInstances = new Set();
families = new Set(
families.map(function (family) {
return family.current;
})
);
findHostInstancesForMatchingFibersRecursively(
root.current,
families,
hostInstances
);
return hostInstances;
}
function scheduleRoot(root, element) {
root.context === emptyContextObject &&
(updateContainerSync(element, root, null, null), flushSyncWork());
Expand Down Expand Up @@ -13429,83 +13415,6 @@ __DEV__ &&
staleFamilies
);
}
function findHostInstancesForMatchingFibersRecursively(
fiber,
types,
hostInstances
) {
var child = fiber.child,
sibling = fiber.sibling,
type = fiber.type,
candidateType = null;
switch (fiber.tag) {
case 0:
case 15:
case 1:
candidateType = type;
break;
case 11:
candidateType = type.render;
}
type = !1;
null !== candidateType && types.has(candidateType) && (type = !0);
if (type)
a: {
b: for (child = fiber, candidateType = !1; ; ) {
if (5 === child.tag || 26 === child.tag)
(candidateType = !0), hostInstances.add(child.stateNode);
else if (null !== child.child) {
child.child.return = child;
child = child.child;
continue;
}
if (child === fiber) {
child = candidateType;
break b;
}
for (; null === child.sibling; ) {
if (null === child.return || child.return === fiber) {
child = candidateType;
break b;
}
child = child.return;
}
child.sibling.return = child.return;
child = child.sibling;
}
if (!child)
for (;;) {
switch (fiber.tag) {
case 27:
case 5:
hostInstances.add(fiber.stateNode);
break a;
case 4:
hostInstances.add(fiber.stateNode.containerInfo);
break a;
case 3:
hostInstances.add(fiber.stateNode.containerInfo);
break a;
}
if (null === fiber.return)
throw Error("Expected to reach root first.");
fiber = fiber.return;
}
}
else
null !== child &&
findHostInstancesForMatchingFibersRecursively(
child,
types,
hostInstances
);
null !== sibling &&
findHostInstancesForMatchingFibersRecursively(
sibling,
types,
hostInstances
);
}
function FiberNode(tag, pendingProps, key, mode) {
this.tag = tag;
this.key = key;
Expand Down Expand Up @@ -16287,11 +16196,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-www-modern-146df7c3-20240730",
version: "19.0.0-www-modern-96f3093b-20240730",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-www-modern-146df7c3-20240730"
reconcilerVersion: "19.0.0-www-modern-96f3093b-20240730"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand All @@ -16302,7 +16211,6 @@ __DEV__ &&
internals.scheduleUpdate = scheduleUpdate;
internals.setErrorHandler = setErrorHandler;
internals.setSuspenseHandler = setSuspenseHandler;
internals.findHostInstancesForRefresh = findHostInstancesForRefresh;
internals.scheduleRefresh = scheduleRefresh;
internals.scheduleRoot = scheduleRoot;
internals.setRefreshHandler = setRefreshHandler;
Expand All @@ -16326,7 +16234,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-modern-146df7c3-20240730";
exports.version = "19.0.0-www-modern-96f3093b-20240730";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -10623,13 +10623,13 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1361 = {
bundleType: 0,
version: "19.0.0-www-classic-146df7c3-20240730",
version: "19.0.0-www-classic-96f3093b-20240730",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: function () {
return null;
},
reconcilerVersion: "19.0.0-www-classic-146df7c3-20240730"
reconcilerVersion: "19.0.0-www-classic-96f3093b-20240730"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1362 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -10655,4 +10655,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-classic-146df7c3-20240730";
exports.version = "19.0.0-www-classic-96f3093b-20240730";
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -10137,13 +10137,13 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1353 = {
bundleType: 0,
version: "19.0.0-www-modern-146df7c3-20240730",
version: "19.0.0-www-modern-96f3093b-20240730",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: function () {
return null;
},
reconcilerVersion: "19.0.0-www-modern-146df7c3-20240730"
reconcilerVersion: "19.0.0-www-modern-96f3093b-20240730"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1354 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -10169,4 +10169,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-modern-146df7c3-20240730";
exports.version = "19.0.0-www-modern-96f3093b-20240730";
Loading

0 comments on commit 57f6b8f

Please sign in to comment.