1
0
Эх сурвалжийг харах

chore: add back template diffing

Jonathan Kelley 2 жил өмнө
parent
commit
b659f4d5d6

+ 7 - 9
packages/core/src/diff.rs

@@ -228,7 +228,6 @@ impl<'b> VirtualDom {
         self.run_scope(scope_id);
         self.diff_scope(scope_id);
 
-        println!("diffed component scope {:?}", scope_id);
         self.dirty_scopes.remove(&DirtyScope {
             height: self.scopes[scope_id.0].height,
             id: scope_id,
@@ -273,14 +272,13 @@ impl<'b> VirtualDom {
     /// }
     /// ```
     fn light_diff_templates(&mut self, left: &'b VNode<'b>, right: &'b VNode<'b>) {
-        self.replace(left, right)
-        // match matching_components(left, right) {
-        //     None => self.replace(left, right),
-        //     Some(components) => components
-        //         .into_iter()
-        //         .enumerate()
-        //         .for_each(|(idx, (l, r))| self.diff_vcomponent(l, r, right, idx)),
-        // }
+        match matching_components(left, right) {
+            None => self.replace(left, right),
+            Some(components) => components
+                .into_iter()
+                .enumerate()
+                .for_each(|(idx, (l, r))| self.diff_vcomponent(l, r, right, idx)),
+        }
     }
 
     /// Diff the two text nodes

+ 0 - 1
packages/core/src/scopes.rs

@@ -238,7 +238,6 @@ impl<'src> ScopeState {
     pub fn schedule_update_any(&self) -> Arc<dyn Fn(ScopeId) + Send + Sync> {
         let chan = self.tasks.sender.clone();
         Arc::new(move |id| {
-            println!("Scheduling update for {:?}", id);
             chan.unbounded_send(SchedulerMsg::Immediate(id)).unwrap();
         })
     }