From 5a418c5a5d51f30441eeccb5b7b9eebc08076474 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Sat, 30 Mar 2019 12:18:47 -0700 Subject: [PATCH] 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 --- ReactCommon/fabric/mounting/Differentiator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactCommon/fabric/mounting/Differentiator.cpp b/ReactCommon/fabric/mounting/Differentiator.cpp index 7c7b7f766a3..33610348a45 100644 --- a/ReactCommon/fabric/mounting/Differentiator.cpp +++ b/ReactCommon/fabric/mounting/Differentiator.cpp @@ -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 =