Fabric: Fixed a bug in Diffing algorithm

Summary: Before the fix, the algorithm compares ShadowViews to make a decision should it recursively call itself or not; that didn't work properly because a ShadowView doesn't fully represent the state of the subtree tree (e.g. they don't have information about children nodes). After the fix, we compare pointers to ShadowNodes (by comparing pairs).

Reviewed By: mdvacca

Differential Revision: D14696996

fbshipit-source-id: 560d623b15a272f13b08a11745dec6be39a5dbdd
This commit is contained in:
Valentin Shergin
2019-03-30 12:18:47 -07:00
committed by Facebook Github Bot
parent 0b3f99bf93
commit 5a418c5a5d

View File

@@ -152,7 +152,7 @@ static void calculateShadowViewMutations(
// We have to call the algorithm recursively if the inserted view
// is *not* the same as removed one.
const auto &newChildPair = it->second;
if (newChildPair.shadowView != oldChildPair.shadowView) {
if (newChildPair != oldChildPair) {
const auto oldGrandChildPairs =
sliceChildShadowNodeViewPairs(*oldChildPair.shadowNode);
const auto newGrandChildPairs =