浏览代码

remove an extra clone

Evan Almloff 1 年之前
父节点
当前提交
d8e79b656b
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 3 3
      packages/core/src/diff/component.rs
  2. 1 1
      packages/core/src/virtual_dom.rs

+ 3 - 3
packages/core/src/diff/component.rs

@@ -37,7 +37,7 @@ impl VirtualDom {
         &mut self,
         to: &mut impl WriteMutations,
         scope: ScopeId,
-        new_node: &RenderReturn,
+        new_node: RenderReturn,
         parent: Option<ElementRef>,
     ) -> usize {
         self.runtime.scope_stack.borrow_mut().push(scope);
@@ -46,7 +46,7 @@ impl VirtualDom {
         let nodes = new_node.create(self, to, parent);
 
         // Then set the new node as the last rendered node
-        self.scopes[scope.0].last_rendered_node = Some(new_node.clone());
+        self.scopes[scope.0].last_rendered_node = Some(new_node);
 
         self.runtime.scope_stack.borrow_mut().pop();
         nodes
@@ -140,6 +140,6 @@ impl VNode {
 
         let new = dom.run_scope(scope);
 
-        dom.create_scope(to, scope, &new, parent)
+        dom.create_scope(to, scope, new, parent)
     }
 }

+ 1 - 1
packages/core/src/virtual_dom.rs

@@ -558,7 +558,7 @@ impl VirtualDom {
         let new_nodes = self.run_scope(ScopeId::ROOT);
 
         // Rebuilding implies we append the created elements to the root
-        let m = self.create_scope(to, ScopeId::ROOT, &new_nodes, None);
+        let m = self.create_scope(to, ScopeId::ROOT, new_nodes, None);
 
         to.append_children(ElementId(0), m);
     }