From 94509a814d6740981894e0a28e39f2abd28dbfec Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Tue, 7 Jul 2020 10:51:25 +0100 Subject: [PATCH] some comments --- packages/client/src/render/attachChildren.js | 1 + packages/client/src/render/prepareRenderComponent.js | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/client/src/render/attachChildren.js b/packages/client/src/render/attachChildren.js index ad0161d72f..ac27f2b5cf 100644 --- a/packages/client/src/render/attachChildren.js +++ b/packages/client/src/render/attachChildren.js @@ -99,6 +99,7 @@ const areTreeNodesEqual = (children1, children2) => { let isEqual = false for (let i = 0; i < children1.length; i++) { + // same context and same children, then nothing has changed isEqual = deepEqual(children1[i].context, children2[i].context) && areTreeNodesEqual(children1[i].children, children2[i].children) diff --git a/packages/client/src/render/prepareRenderComponent.js b/packages/client/src/render/prepareRenderComponent.js index e4bb51aaa0..4458ec9e55 100644 --- a/packages/client/src/render/prepareRenderComponent.js +++ b/packages/client/src/render/prepareRenderComponent.js @@ -79,6 +79,7 @@ export const createTreeNode = () => ({ const node = this return () => { if (node.children) { + // destroy children first - from leaf nodes up for (let child of node.children) { child.destroy() }