Merge pull request #1065 from Demonthos/fix-events-on-placeholders
Fix panic when events trigger on placeholders
This commit is contained in:
1 file changed
+9
-3
@@ -389,7 +389,8 @@ impl VirtualDom {
|
|||||||
// Loop through each dynamic attribute (in a depth first order) in this template before moving up to the template's parent.
|
// 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 {
|
while let Some(el_ref) = parent_path {
|
||||||
// safety: we maintain references of all vnodes in the element slab
|
// safety: we maintain references of all vnodes in the element slab
|
||||||
let template = unsafe { el_ref.template.unwrap().as_ref() };
|
if let Some(template) = el_ref.template {
|
||||||
|
let template = unsafe { template.as_ref() };
|
||||||
let node_template = template.template.get();
|
let node_template = template.template.get();
|
||||||
let target_path = el_ref.path;
|
let target_path = el_ref.path;
|
||||||
|
|
||||||
@@ -425,13 +426,17 @@ impl VirtualDom {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parent_path = template.parent.and_then(|id| self.elements.get(id.0));
|
parent_path = dbg!(template.parent).and_then(|id| self.elements.get(id.0));
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, we just call the listener on the target element
|
// Otherwise, we just call the listener on the target element
|
||||||
if let Some(el_ref) = parent_path {
|
if let Some(el_ref) = parent_path {
|
||||||
// safety: we maintain references of all vnodes in the element slab
|
// safety: we maintain references of all vnodes in the element slab
|
||||||
let template = unsafe { el_ref.template.unwrap().as_ref() };
|
if let Some(template) = el_ref.template {
|
||||||
|
let template = unsafe { template.as_ref() };
|
||||||
let node_template = template.template.get();
|
let node_template = template.template.get();
|
||||||
let target_path = el_ref.path;
|
let target_path = el_ref.path;
|
||||||
|
|
||||||
@@ -453,6 +458,7 @@ impl VirtualDom {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Wait for the scheduler to have any work.
|
/// Wait for the scheduler to have any work.
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in new issue
Block a user