From 9424cbb615e205b4685ccadf44e2d4fdc81c6ed9 Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Tue, 7 Jul 2020 10:48:24 +0100 Subject: [PATCH] routing breaks when we click same link twice #422 --- packages/client/src/render/attachChildren.js | 4 +++- packages/client/src/render/prepareRenderComponent.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/client/src/render/attachChildren.js b/packages/client/src/render/attachChildren.js index 95db47710e..ad0161d72f 100644 --- a/packages/client/src/render/attachChildren.js +++ b/packages/client/src/render/attachChildren.js @@ -99,7 +99,9 @@ const areTreeNodesEqual = (children1, children2) => { let isEqual = false for (let i = 0; i < children1.length; i++) { - isEqual = deepEqual(children1[i].context, children2[i].context) + isEqual = + deepEqual(children1[i].context, children2[i].context) && + areTreeNodesEqual(children1[i].children, children2[i].children) if (!isEqual) return false if (isScreenSlot(children1[i].parentNode.props._component)) { isEqual = deepEqual(children1[i].props, children2[i].props) diff --git a/packages/client/src/render/prepareRenderComponent.js b/packages/client/src/render/prepareRenderComponent.js index c8b9c5d14c..e4bb51aaa0 100644 --- a/packages/client/src/render/prepareRenderComponent.js +++ b/packages/client/src/render/prepareRenderComponent.js @@ -78,13 +78,13 @@ export const createTreeNode = () => ({ get destroy() { const node = this return () => { - if (node.unsubscribe) node.unsubscribe() - if (node.component && node.component.$destroy) node.component.$destroy() if (node.children) { for (let child of node.children) { child.destroy() } } + if (node.unsubscribe) node.unsubscribe() + if (node.component && node.component.$destroy) node.component.$destroy() for (let onDestroyItem of node.onDestroy) { onDestroyItem() }