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
This commit is contained in:
Joshua Gross authored and Facebook GitHub Bot committed 2021-04-26 11:59:11 -07:00
1 parent 6e13040ecb
commit 08a1531a1f
1 file changed
-15
@@ -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 {