From 2256c042889dda9463f3d4413ea398d7f699d545 Mon Sep 17 00:00:00 2001 From: Henry Zimmerman Date: Fri, 20 Sep 2019 23:35:05 -0400 Subject: [PATCH 1/3] Fix VNode orphaning inside of VTags --- src/virtual_dom/vtag.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/virtual_dom/vtag.rs b/src/virtual_dom/vtag.rs index f0f320d4e..06502d6a4 100644 --- a/src/virtual_dom/vtag.rs +++ b/src/virtual_dom/vtag.rs @@ -350,6 +350,12 @@ impl VDiff for VTag { .reference .take() .expect("tried to remove not rendered VTag from DOM"); + + // recursively remove its children + self.childs.drain(..).for_each(|mut v|{ + v.detach(&node); + }); + let sibling = node.next_sibling(); if parent.remove_child(&node).is_err() { warn!("Node not found to remove VTag"); From 5dc34e6e270cd6c5846f70b4d70e24557617b44c Mon Sep 17 00:00:00 2001 From: Henry Zimmerman Date: Sat, 21 Sep 2019 08:09:46 -0400 Subject: [PATCH 2/3] cargo fmt --- src/virtual_dom/vtag.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/virtual_dom/vtag.rs b/src/virtual_dom/vtag.rs index 06502d6a4..394553679 100644 --- a/src/virtual_dom/vtag.rs +++ b/src/virtual_dom/vtag.rs @@ -352,7 +352,7 @@ impl VDiff for VTag { .expect("tried to remove not rendered VTag from DOM"); // recursively remove its children - self.childs.drain(..).for_each(|mut v|{ + self.childs.drain(..).for_each(|mut v| { v.detach(&node); }); From 109504d517661d83386ade4db81513a134a4750c Mon Sep 17 00:00:00 2001 From: Henry Zimmerman Date: Sat, 21 Sep 2019 08:18:20 -0400 Subject: [PATCH 3/3] improve naming --- src/virtual_dom/vtag.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/virtual_dom/vtag.rs b/src/virtual_dom/vtag.rs index 394553679..263f3b15f 100644 --- a/src/virtual_dom/vtag.rs +++ b/src/virtual_dom/vtag.rs @@ -352,8 +352,8 @@ impl VDiff for VTag { .expect("tried to remove not rendered VTag from DOM"); // recursively remove its children - self.childs.drain(..).for_each(|mut v| { - v.detach(&node); + self.childs.drain(..).for_each(|mut child| { + child.detach(&node); }); let sibling = node.next_sibling();