Differ: fix unit test case 1167342011

Summary:
Unit test case seed 1167342011 encodes a case where the differ produces a DELETE and CREATE of the same node in the same frame, which we consider an error.

It turns out this was caused by nested "unflatten" operations and this bit of deleted code specifically. We were deleting an unmatched node from a parent call's dictionary of nodes,
which prevented it from being matched in the "old" tree later on.

This is only possible now that we attach pointers to the "other" ViewNodePair when they're matched, so we can check existence of that pointer instead of inclusion in dictionaries to decide if we need to DELETE/CREATE a node and its subtree.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D28003330

fbshipit-source-id: 305440ef20b921883c1d6e38a4a4072e5a7f95ac
This commit is contained in:
Joshua Gross 2021-04-26 11:57:24 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 4bc81422ed
Коммит ca3aae7980
1 изменённых файлов: 0 добавлений и 4 удалений

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

@ -963,10 +963,6 @@ static void calculateShadowViewMutationsFlattener(
{newTreeNodePair.shadowView.tag, &newTreeNodePair});
subVisitedOldMap->insert(
{oldTreeNodePair.shadowView.tag, &oldTreeNodePair});
if (unvisitedIt != unvisitedOtherNodes.end()) {
unvisitedOtherNodes.erase(unvisitedIt);
}
} else {
// Node does not in exist in other tree.
if (treeChildPair.isConcreteView && !treeChildPair.inOtherTree()) {