fix double drop of bubble id

This commit is contained in:
Evan Almloff 2023-09-05 21:21:54 -05:00
parent 9552ab6c1c
commit 02456c1068
3 changed files with 10 additions and 3 deletions

View file

@ -162,7 +162,9 @@ impl VirtualDom {
let element_refs_slab = &mut self.element_refs;
for element_ref in element_refs.drain(..) {
println!("Dropping element ref {:?}", element_ref);
element_refs_slab[element_ref.0].template = None;
if let Some(element_ref) = element_refs_slab.get_mut(element_ref.0) {
element_ref.template = None;
}
}
}

View file

@ -371,7 +371,8 @@ impl VirtualDom {
// Loop through each dynamic attribute (in a depth first order) in this template before moving up to the template's parent.
while let Some(el_ref) = parent_path {
// safety: we maintain references of all vnodes in the element slab
let template = unsafe { &*el_ref.template.unwrap() };
let template =
unsafe { &*el_ref.template.expect("template reference should be valid") };
let node_template = template.template.get();
let target_path = el_ref.path;

View file

@ -42,7 +42,11 @@ fn app(cx: Scope) -> Element {
*CLICKS.lock().unwrap() += 1;
},
problematic_child {}
vec![
render! {
problematic_child {}
}
].into_iter()
}
}
}