Reconciler: Combine identical cases in findParent (#32210)
## Summary When lookup `Parent`, `HostRoot` and `HostPortal` should be merged, because when creating a `Portal`, it will also include `containerInfo`(So we can directly use this `containerInfo` to delete the real DOM nodes.), so there is no need to handle them separately. ## How did you test this change? No behavior changes, all existing tests pass.
Wick committed
Feb 1, 2025 at 06:35 UTC
19ca800caa01eec2f5e65e547c67b11592bec8b0
1 file changed
+1
-5
packages/react-reconciler/src/ReactFiberCommitWork.js
+1
-5
@@ -2007,11 +2007,7 @@ function commitDeletionEffects(
2007
hostParentIsContainer = false;
2008
break findParent;
2009
}
2010
- case HostRoot: {
2011
- hostParent = parent.stateNode.containerInfo;
2012
- hostParentIsContainer = true;
2013
- break findParent;
2014
- }
2010
+ case HostRoot:
2011
case HostPortal: {
2012
hostParent = parent.stateNode.containerInfo;
2013
hostParentIsContainer = true;