mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-23 12:43:08 +00:00
remove node refs before dropping nodes
This commit is contained in:
parent
c5ebdc9635
commit
036e1ff0f5
1 changed files with 9 additions and 1 deletions
|
@ -118,6 +118,10 @@ impl VirtualDom {
|
|||
}
|
||||
|
||||
fn drop_scope_inner(&mut self, node: &VNode) {
|
||||
if let Some(id) = node.parent.get() {
|
||||
self.element_refs.remove(id.0);
|
||||
}
|
||||
|
||||
node.dynamic_nodes.iter().for_each(|node| match node {
|
||||
DynamicNode::Component(c) => {
|
||||
if let Some(f) = c.scope.get() {
|
||||
|
@ -128,7 +132,11 @@ impl VirtualDom {
|
|||
DynamicNode::Fragment(nodes) => {
|
||||
nodes.iter().for_each(|node| self.drop_scope_inner(node))
|
||||
}
|
||||
DynamicNode::Placeholder(_) => {}
|
||||
DynamicNode::Placeholder(placeholder) => {
|
||||
if let Some(id) = placeholder.parent.get() {
|
||||
self.element_refs.remove(id.0);
|
||||
}
|
||||
}
|
||||
DynamicNode::Text(_) => {}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue