Skip to content

Commit 5850bd0

Browse files
mdvaccafacebook-github-bot
authored andcommitted
Force Diffing algorithm to insert views Bottom Up (from children to root)
Summary: This diff changes the way views are inserted by the diffing algorithm. Previously the diffing algorithm inserted views top-down, now it insert views bottom-up (same order as previous version of RN). Let say we need to create the following tree: ``` A --> B --> C | | --> D ``` Before, the diffing algorithm created the following list of instructions: ``` insert(A, B, 0) insert(B, C, 0) insert(B, D, 1) ``` After this diff, the insert instructions are going to be: ``` insert(B, C, 0) insert(B, D, 1) insert(A, B, 0) ``` Reviewed By: shergin Differential Revision: D14817454 fbshipit-source-id: 7aac1a1e1784c53bca2747aee80a5bc8ee788e7a
1 parent 9202d4f commit 5850bd0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ReactCommon/fabric/mounting/Differentiator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,10 @@ static void calculateShadowViewMutations(
207207
mutations.end(), deleteMutations.begin(), deleteMutations.end());
208208
mutations.insert(
209209
mutations.end(), createMutations.begin(), createMutations.end());
210-
mutations.insert(
211-
mutations.end(), insertMutations.begin(), insertMutations.end());
212210
mutations.insert(
213211
mutations.end(), downwardMutations.begin(), downwardMutations.end());
212+
mutations.insert(
213+
mutations.end(), insertMutations.begin(), insertMutations.end());
214214
}
215215

216216
ShadowViewMutationList calculateShadowViewMutations(

0 commit comments

Comments
 (0)