feat: fix the scope rollover bug
This commit is contained in:
1 parent
e4d089fabc
commit
d4b6bb8a7b
17 files changed
+591
-360
No files matched your search
@@ -34,14 +34,14 @@ impl ElementRef {
|
||||
|
||||
impl VirtualDom {
|
||||
pub(crate) fn next_element(&mut self, template: &VNode, path: &'static [u8]) -> ElementId {
|
||||
self.next(template, ElementPath::Deep(path))
|
||||
self.next_reference(template, ElementPath::Deep(path))
|
||||
}
|
||||
|
||||
pub(crate) fn next_root(&mut self, template: &VNode, path: usize) -> ElementId {
|
||||
self.next(template, ElementPath::Root(path))
|
||||
self.next_reference(template, ElementPath::Root(path))
|
||||
}
|
||||
|
||||
fn next(&mut self, template: &VNode, path: ElementPath) -> ElementId {
|
||||
fn next_reference(&mut self, template: &VNode, path: ElementPath) -> ElementId {
|
||||
let entry = self.elements.vacant_entry();
|
||||
let id = entry.key();
|
||||
|
||||
@@ -100,15 +100,15 @@ impl VirtualDom {
|
||||
nodes.iter().for_each(|node| self.drop_scope_inner(node))
|
||||
}
|
||||
DynamicNode::Placeholder(t) => {
|
||||
self.try_reclaim(t.get());
|
||||
self.try_reclaim(t.id.get().unwrap());
|
||||
}
|
||||
DynamicNode::Text(t) => {
|
||||
self.try_reclaim(t.id.get());
|
||||
self.try_reclaim(t.id.get().unwrap());
|
||||
}
|
||||
});
|
||||
|
||||
for root in node.root_ids {
|
||||
let id = root.get();
|
||||
let id = root.get().unwrap();
|
||||
if id.0 != 0 {
|
||||
self.try_reclaim(id);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ impl VirtualDom {
|
||||
// Only descend if the props are borrowed
|
||||
DynamicNode::Component(c) if !c.static_props => {
|
||||
self.ensure_drop_safety(c.scope.get().unwrap());
|
||||
c.props.set(None);
|
||||
c.props.take();
|
||||
}
|
||||
|
||||
DynamicNode::Fragment(f) => f
|
||||
|
||||
Reference in new issue
Block a user