Skip to content

Conversation

sebmarkbage
Copy link
Collaborator

When keys line up in the beginning but the type doesn't we don't currently delete the child. We need to track that this fiber is a not a reuse and if so mark the old one for deletion.

When keys line up in the beginning but the type doesn't
we don't currently delete the child. We need to track that this
fiber is a not a reuse and if so mark the old one for deletion.
@@ -573,7 +580,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
// it from the child list so that we don't add it to the deletion
// list.
existingChildren.delete(
newFiber.key === null ? newFiber.index : newFiber.key
newFiber.key === null ? newIdx : newFiber.key
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newFiber.index will be 0 if this is a clone. The index we actually matched on is oldFiber.index which also happens to be the same as newIdx which is what we just looked up in the map.

@gaearon
Copy link
Collaborator

gaearon commented Oct 25, 2016

Gonna trust you on this one and later figure out how child reconciliation works in more detail.

@gaearon gaearon added this to the 15-next milestone Oct 25, 2016
@gaearon gaearon merged commit ea8cf7f into facebook:master Oct 25, 2016
@gaearon gaearon removed this from the 15-next milestone Jan 6, 2017
acusti pushed a commit to brandcast/react that referenced this pull request Mar 15, 2017
When keys line up in the beginning but the type doesn't
we don't currently delete the child. We need to track that this
fiber is a not a reuse and if so mark the old one for deletion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants