|
@@ -15,7 +15,7 @@ use DynamicNode::*;
|
|
|
|
|
|
impl<'b> VirtualDom {
|
|
impl<'b> VirtualDom {
|
|
pub(super) fn diff_scope(&mut self, scope: ScopeId) {
|
|
pub(super) fn diff_scope(&mut self, scope: ScopeId) {
|
|
- let scope_state = &mut self.scopes[scope];
|
|
|
|
|
|
+ let scope_state = &mut self.scopes[scope.0];
|
|
|
|
|
|
self.scope_stack.push(scope);
|
|
self.scope_stack.push(scope);
|
|
unsafe {
|
|
unsafe {
|
|
@@ -191,7 +191,7 @@ impl<'b> VirtualDom {
|
|
right.scope.set(Some(scope_id));
|
|
right.scope.set(Some(scope_id));
|
|
|
|
|
|
// copy out the box for both
|
|
// copy out the box for both
|
|
- let old = self.scopes[scope_id].props.as_ref();
|
|
|
|
|
|
+ let old = self.scopes[scope_id.0].props.as_ref();
|
|
let new: Box<dyn AnyProps> = right.props.take().unwrap();
|
|
let new: Box<dyn AnyProps> = right.props.take().unwrap();
|
|
let new: Box<dyn AnyProps> = unsafe { std::mem::transmute(new) };
|
|
let new: Box<dyn AnyProps> = unsafe { std::mem::transmute(new) };
|
|
|
|
|
|
@@ -203,14 +203,14 @@ impl<'b> VirtualDom {
|
|
}
|
|
}
|
|
|
|
|
|
// First, move over the props from the old to the new, dropping old props in the process
|
|
// First, move over the props from the old to the new, dropping old props in the process
|
|
- self.scopes[scope_id].props = Some(new);
|
|
|
|
|
|
+ self.scopes[scope_id.0].props = Some(new);
|
|
|
|
|
|
// Now run the component and diff it
|
|
// Now run the component and diff it
|
|
self.run_scope(scope_id);
|
|
self.run_scope(scope_id);
|
|
self.diff_scope(scope_id);
|
|
self.diff_scope(scope_id);
|
|
|
|
|
|
self.dirty_scopes.remove(&DirtyScope {
|
|
self.dirty_scopes.remove(&DirtyScope {
|
|
- height: self.scopes[scope_id].height,
|
|
|
|
|
|
+ height: self.scopes[scope_id.0].height,
|
|
id: scope_id,
|
|
id: scope_id,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -714,7 +714,7 @@ impl<'b> VirtualDom {
|
|
|
|
|
|
Component(comp) => {
|
|
Component(comp) => {
|
|
let scope = comp.scope.get().unwrap();
|
|
let scope = comp.scope.get().unwrap();
|
|
- match unsafe { self.scopes[scope].root_node().extend_lifetime_ref() } {
|
|
|
|
|
|
+ match unsafe { self.scopes[scope.0].root_node().extend_lifetime_ref() } {
|
|
RenderReturn::Ready(node) => self.push_all_real_nodes(node),
|
|
RenderReturn::Ready(node) => self.push_all_real_nodes(node),
|
|
RenderReturn::Aborted(_node) => todo!(),
|
|
RenderReturn::Aborted(_node) => todo!(),
|
|
}
|
|
}
|
|
@@ -915,13 +915,13 @@ impl<'b> VirtualDom {
|
|
.expect("VComponents to always have a scope");
|
|
.expect("VComponents to always have a scope");
|
|
|
|
|
|
// Remove the component from the dom
|
|
// Remove the component from the dom
|
|
- match unsafe { self.scopes[scope].root_node().extend_lifetime_ref() } {
|
|
|
|
|
|
+ match unsafe { self.scopes[scope.0].root_node().extend_lifetime_ref() } {
|
|
RenderReturn::Ready(t) => self.remove_node(t, gen_muts),
|
|
RenderReturn::Ready(t) => self.remove_node(t, gen_muts),
|
|
RenderReturn::Aborted(placeholder) => self.remove_placeholder(placeholder, gen_muts),
|
|
RenderReturn::Aborted(placeholder) => self.remove_placeholder(placeholder, gen_muts),
|
|
};
|
|
};
|
|
|
|
|
|
// Restore the props back to the vcomponent in case it gets rendered again
|
|
// Restore the props back to the vcomponent in case it gets rendered again
|
|
- let props = self.scopes[scope].props.take();
|
|
|
|
|
|
+ let props = self.scopes[scope.0].props.take();
|
|
*comp.props.borrow_mut() = unsafe { std::mem::transmute(props) };
|
|
*comp.props.borrow_mut() = unsafe { std::mem::transmute(props) };
|
|
|
|
|
|
// Now drop all the resouces
|
|
// Now drop all the resouces
|
|
@@ -936,7 +936,7 @@ impl<'b> VirtualDom {
|
|
Some(Placeholder(t)) => t.id.get().unwrap(),
|
|
Some(Placeholder(t)) => t.id.get().unwrap(),
|
|
Some(Component(comp)) => {
|
|
Some(Component(comp)) => {
|
|
let scope = comp.scope.get().unwrap();
|
|
let scope = comp.scope.get().unwrap();
|
|
- match unsafe { self.scopes[scope].root_node().extend_lifetime_ref() } {
|
|
|
|
|
|
+ match unsafe { self.scopes[scope.0].root_node().extend_lifetime_ref() } {
|
|
RenderReturn::Ready(t) => self.find_first_element(t),
|
|
RenderReturn::Ready(t) => self.find_first_element(t),
|
|
_ => todo!("cannot handle nonstandard nodes"),
|
|
_ => todo!("cannot handle nonstandard nodes"),
|
|
}
|
|
}
|
|
@@ -952,7 +952,7 @@ impl<'b> VirtualDom {
|
|
Some(Placeholder(t)) => t.id.get().unwrap(),
|
|
Some(Placeholder(t)) => t.id.get().unwrap(),
|
|
Some(Component(comp)) => {
|
|
Some(Component(comp)) => {
|
|
let scope = comp.scope.get().unwrap();
|
|
let scope = comp.scope.get().unwrap();
|
|
- match unsafe { self.scopes[scope].root_node().extend_lifetime_ref() } {
|
|
|
|
|
|
+ match unsafe { self.scopes[scope.0].root_node().extend_lifetime_ref() } {
|
|
RenderReturn::Ready(t) => self.find_last_element(t),
|
|
RenderReturn::Ready(t) => self.find_last_element(t),
|
|
_ => todo!("cannot handle nonstandard nodes"),
|
|
_ => todo!("cannot handle nonstandard nodes"),
|
|
}
|
|
}
|