set the scope stack correctly
This commit is contained in:
1 parent
b09e528aaa
commit
a2c7b69a1d
4 files changed
+9
-9
No files matched your search
@@ -65,11 +65,8 @@ impl<'b> VirtualDom {
|
||||
/// Create a new template [`VNode`] and write it to the [`Mutations`] buffer.
|
||||
///
|
||||
/// This method pushes the ScopeID to the internal scopestack and returns the number of nodes created.
|
||||
pub(crate) fn create_scope(&mut self, scope: ScopeId, template: &'b VNode<'b>) -> usize {
|
||||
self.runtime.scope_stack.borrow_mut().push(scope);
|
||||
let out = self.create(template);
|
||||
self.runtime.scope_stack.borrow_mut().pop();
|
||||
out
|
||||
pub(crate) fn create_scope(&mut self, _scope: ScopeId, template: &'b VNode<'b>) -> usize {
|
||||
self.create(template)
|
||||
}
|
||||
|
||||
/// Create this template and write its mutations
|
||||
|
||||
@@ -15,7 +15,6 @@ use DynamicNode::*;
|
||||
|
||||
impl<'b> VirtualDom {
|
||||
pub(super) fn diff_scope(&mut self, scope: ScopeId) {
|
||||
self.runtime.scope_stack.borrow_mut().push(scope);
|
||||
let scope_state = &mut self.get_scope(scope).unwrap();
|
||||
unsafe {
|
||||
// Load the old and new bump arenas
|
||||
@@ -46,7 +45,6 @@ impl<'b> VirtualDom {
|
||||
(Aborted(l), Ready(r)) => self.replace_placeholder(l, [r]),
|
||||
};
|
||||
}
|
||||
self.runtime.scope_stack.borrow_mut().pop();
|
||||
}
|
||||
|
||||
fn diff_ok_to_err(&mut self, l: &'b VNode<'b>, p: &'b VPlaceholder) {
|
||||
|
||||
@@ -45,7 +45,7 @@ pub struct Runtime {
|
||||
pub(crate) scope_contexts: RefCell<Vec<Option<ScopeContext>>>,
|
||||
pub(crate) scheduler: Rc<Scheduler>,
|
||||
|
||||
// While diffing we need some sort of way of breaking off a stream of suspended mutations.
|
||||
// We use this to track the current scope
|
||||
pub(crate) scope_stack: RefCell<Vec<ScopeId>>,
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ impl VirtualDom {
|
||||
}
|
||||
|
||||
pub(crate) fn run_scope(&mut self, scope_id: ScopeId) -> &RenderReturn {
|
||||
self.runtime.scope_stack.borrow_mut().push(scope_id);
|
||||
// Cycle to the next frame and then reset it
|
||||
// This breaks any latent references, invalidating every pointer referencing into it.
|
||||
// Remove all the outdated listeners
|
||||
@@ -94,6 +95,10 @@ impl VirtualDom {
|
||||
}
|
||||
|
||||
// rebind the lifetime now that its stored internally
|
||||
unsafe { allocated.extend_lifetime_ref() }
|
||||
let result = unsafe { allocated.extend_lifetime_ref() };
|
||||
|
||||
self.runtime.scope_stack.borrow_mut().pop();
|
||||
|
||||
result
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user