From 8ae3ee382f2ba4920d27d770699a840b3d6490e3 Mon Sep 17 00:00:00 2001 From: hardfist Date: Fri, 6 Oct 2017 19:54:08 -0500 Subject: [PATCH 1/2] Update implementation-notes.md prevChild could be CompositeComponent which cause prevChild.node to be undefined. --- content/docs/implementation-notes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/implementation-notes.md b/content/docs/implementation-notes.md index 0c795a1b..b1d7cd4d 100644 --- a/content/docs/implementation-notes.md +++ b/content/docs/implementation-notes.md @@ -750,7 +750,7 @@ We collect DOM operations on children in a list so we can execute them in batch: // If we can't update an existing instance, we have to unmount it // and mount a new one instead of it. if (!canUpdate) { - var prevNode = prevChild.node; + var prevNode = prevChild.getHostNode(); prevChild.unmount(); var nextChild = instantiateComponent(nextChildren[i]); @@ -771,7 +771,7 @@ We collect DOM operations on children in a list so we can execute them in batch: // Finally, unmount any children that don't exist: for (var j = nextChildren.length; j < prevChildren.length; j++) { var prevChild = prevRenderedChildren[j]; - var node = prevChild.node; +     var node = prevChild.getHostNode(); prevChild.unmount(); // Record that we need to remove the node From ca77459159a692a2845d534c60c8ffa10e5eedfe Mon Sep 17 00:00:00 2001 From: hardfist Date: Fri, 6 Oct 2017 22:19:15 -0500 Subject: [PATCH 2/2] Update implementation-notes.md fix indentation problem --- content/docs/implementation-notes.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/content/docs/implementation-notes.md b/content/docs/implementation-notes.md index b1d7cd4d..86b1297a 100644 --- a/content/docs/implementation-notes.md +++ b/content/docs/implementation-notes.md @@ -770,12 +770,12 @@ We collect DOM operations on children in a list so we can execute them in batch: // Finally, unmount any children that don't exist: for (var j = nextChildren.length; j < prevChildren.length; j++) { - var prevChild = prevRenderedChildren[j]; -     var node = prevChild.getHostNode(); - prevChild.unmount(); + var prevChild = prevRenderedChildren[j]; +     var node = prevChild.getHostNode(); + prevChild.unmount(); - // Record that we need to remove the node - operationQueue.push({type: 'REMOVE', node}); + // Record that we need to remove the node + operationQueue.push({type: 'REMOVE', node}); } // Point the list of rendered children to the updated version.