Feat: patch to diff to allow scopes
This commit is contained in:
1 parent
e840f472fa
commit
2041c88d07
2 files changed
+13
-5
No files matched your search
@@ -250,26 +250,30 @@ impl<'a> DiffMachine<'a> {
|
|||||||
self.change_list.commit_traversal();
|
self.change_list.commit_traversal();
|
||||||
}
|
}
|
||||||
|
|
||||||
'outer1: for new_l in new {
|
'outer1: for (l_idx, new_l) in new.iter().enumerate() {
|
||||||
// unsafe {
|
// unsafe {
|
||||||
// Safety relies on removing `new_l` from the registry manually at
|
// Safety relies on removing `new_l` from the registry manually at
|
||||||
// the end of its lifetime. This happens below in the `'outer2`
|
// the end of its lifetime. This happens below in the `'outer2`
|
||||||
// loop, and elsewhere in diffing when removing old dom trees.
|
// loop, and elsewhere in diffing when removing old dom trees.
|
||||||
// registry.add(new_l);
|
// registry.add(new_l);
|
||||||
// }
|
// }
|
||||||
|
let event_type = new_l.event;
|
||||||
|
|
||||||
for (l_idx, old_l) in old.iter().enumerate() {
|
for old_l in old {
|
||||||
if new_l.event == old_l.event {
|
if new_l.event == old_l.event {
|
||||||
let event_type = new_l.event;
|
|
||||||
if let Some(scope) = self.current_idx {
|
if let Some(scope) = self.current_idx {
|
||||||
let cb = CbIdx::from_gi_index(scope, l_idx);
|
let cb = CbIdx::from_gi_index(scope, l_idx);
|
||||||
self.change_list.update_event_listener(event_type, cb);
|
self.change_list.update_event_listener(event_type, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
continue 'outer1;
|
continue 'outer1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.change_list.new_event_listener(new_l);
|
if let Some(scope) = self.current_idx {
|
||||||
|
let cb = CbIdx::from_gi_index(scope, l_idx);
|
||||||
|
self.change_list.new_event_listener(event_type, cb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
'outer2: for old_l in old {
|
'outer2: for old_l in old {
|
||||||
|
|||||||
@@ -98,7 +98,11 @@ impl VirtualDom {
|
|||||||
|
|
||||||
component.run::<()>();
|
component.run::<()>();
|
||||||
|
|
||||||
diff_machine.diff_node(component.old_frame(), component.new_frame());
|
diff_machine.diff_node(
|
||||||
|
component.old_frame(),
|
||||||
|
component.new_frame(),
|
||||||
|
Some(self.base_scope),
|
||||||
|
);
|
||||||
|
|
||||||
Ok(diff_machine.consume())
|
Ok(diff_machine.consume())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user