From 08a1531a1f579b61fffc9344cd06d618d29dd29f Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Mon, 26 Apr 2021 11:57:24 -0700 Subject: [PATCH] Differ: simplify flatten/unflatten logic Summary: Since each ShadowViewNodePair will point to any matched pair in the "other" tree during diffing, we can rely on the presence of the "other" pointer instead of always removing nodes from `deletionCreationCandidatePairs` when they're matched. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D28003335 fbshipit-source-id: 0b886946eedc497091ca79c436f160b3d4bf3f1e --- .../react/renderer/mounting/Differentiator.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/ReactCommon/react/renderer/mounting/Differentiator.cpp b/ReactCommon/react/renderer/mounting/Differentiator.cpp index 881d65d4c24..69046c14eaa 100644 --- a/ReactCommon/react/renderer/mounting/Differentiator.cpp +++ b/ReactCommon/react/renderer/mounting/Differentiator.cpp @@ -854,21 +854,6 @@ static void calculateShadowViewMutationsFlattener( oldTreeNodePair, subVisitedNewMap, subVisitedOldMap); - - for (auto newFlattenedNode : newFlattenedNodes) { - auto unvisitedOldChildPairIt = - unvisitedNewChildPairs.find(newFlattenedNode->shadowView.tag); - - if (unvisitedOldChildPairIt == unvisitedNewChildPairs.end()) { - // Node was visited. - - auto deleteCreateIt = deletionCreationCandidatePairs.find( - newFlattenedNode->shadowView.tag); - if (deleteCreateIt != deletionCreationCandidatePairs.end()) { - deletionCreationCandidatePairs.erase(deleteCreateIt); - } - } - } } // Flatten parent, unflatten child else {