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 2021-04-26 11:57:24 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 6e13040ecb
Коммит 08a1531a1f
1 изменённых файлов: 0 добавлений и 15 удалений

Просмотреть файл

@ -854,21 +854,6 @@ static void calculateShadowViewMutationsFlattener(
oldTreeNodePair, oldTreeNodePair,
subVisitedNewMap, subVisitedNewMap,
subVisitedOldMap); 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 // Flatten parent, unflatten child
else { else {