From 19ca800caa01eec2f5e65e547c67b11592bec8b0 Mon Sep 17 00:00:00 2001 From: Wick Date: Sat, 1 Feb 2025 06:35:48 +0800 Subject: [PATCH] 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. --- packages/react-reconciler/src/ReactFiberCommitWork.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.js b/packages/react-reconciler/src/ReactFiberCommitWork.js index 1cfe38cc20..850f3c6706 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.js @@ -2007,11 +2007,7 @@ function commitDeletionEffects( hostParentIsContainer = false; break findParent; } - case HostRoot: { - hostParent = parent.stateNode.containerInfo; - hostParentIsContainer = true; - break findParent; - } + case HostRoot: case HostPortal: { hostParent = parent.stateNode.containerInfo; hostParentIsContainer = true;