fix diffing components
This commit is contained in:
1 parent
3545c14a38
commit
b2860a3d73
2 files changed
+8
-8
No files matched your search
@@ -122,8 +122,8 @@ impl VNode {
|
|||||||
|
|
||||||
pub(super) fn create_component_node(
|
pub(super) fn create_component_node(
|
||||||
&self,
|
&self,
|
||||||
_mount: MountId,
|
mount: MountId,
|
||||||
_idx: usize,
|
idx: usize,
|
||||||
component: &VComponent,
|
component: &VComponent,
|
||||||
parent: Option<ElementRef>,
|
parent: Option<ElementRef>,
|
||||||
dom: &mut VirtualDom,
|
dom: &mut VirtualDom,
|
||||||
@@ -135,6 +135,9 @@ impl VNode {
|
|||||||
.context()
|
.context()
|
||||||
.id;
|
.id;
|
||||||
|
|
||||||
|
// Store the scope id for the next render
|
||||||
|
dom.mounts[mount.0].mounted_dynamic_nodes[idx] = scope.0;
|
||||||
|
|
||||||
let new = dom.run_scope(scope);
|
let new = dom.run_scope(scope);
|
||||||
|
|
||||||
dom.create_scope(to, scope, &new, parent)
|
dom.create_scope(to, scope, &new, parent)
|
||||||
|
|||||||
@@ -34,9 +34,8 @@ impl VirtualDom {
|
|||||||
pub(crate) fn run_scope(&mut self, scope_id: ScopeId) -> RenderReturn {
|
pub(crate) fn run_scope(&mut self, scope_id: ScopeId) -> RenderReturn {
|
||||||
self.runtime.scope_stack.borrow_mut().push(scope_id);
|
self.runtime.scope_stack.borrow_mut().push(scope_id);
|
||||||
|
|
||||||
|
let scope = &self.scopes[scope_id.0];
|
||||||
let new_nodes = {
|
let new_nodes = {
|
||||||
let scope = &self.scopes[scope_id.0];
|
|
||||||
|
|
||||||
let context = scope.context();
|
let context = scope.context();
|
||||||
context.suspended.set(false);
|
context.suspended.set(false);
|
||||||
context.hook_index.set(0);
|
context.hook_index.set(0);
|
||||||
@@ -44,12 +43,10 @@ impl VirtualDom {
|
|||||||
// safety: due to how we traverse the tree, we know that the scope is not currently aliased
|
// safety: due to how we traverse the tree, we know that the scope is not currently aliased
|
||||||
let props: &dyn AnyProps = &*scope.props;
|
let props: &dyn AnyProps = &*scope.props;
|
||||||
|
|
||||||
let _span = tracing::trace_span!("render", scope = %scope.context().name);
|
let span = tracing::trace_span!("render", scope = %scope.context().name);
|
||||||
props.render()
|
span.in_scope(|| props.render())
|
||||||
};
|
};
|
||||||
|
|
||||||
let scope = &mut self.scopes[scope_id.0];
|
|
||||||
|
|
||||||
let context = scope.context();
|
let context = scope.context();
|
||||||
|
|
||||||
// And move the render generation forward by one
|
// And move the render generation forward by one
|
||||||
|
|||||||
Reference in new issue
Block a user