fix lazynode diff bug adding children
This commit is contained in:
1 parent
b228e1e4eb
commit
aec5cd9dfa
2 files changed
+26
No files matched your search
@@ -424,6 +424,7 @@ impl<'b> DiffState<'b> {
|
|||||||
(0, 0) => {}
|
(0, 0) => {}
|
||||||
(0, _) => {
|
(0, _) => {
|
||||||
let created = self.create_children(new.children);
|
let created = self.create_children(new.children);
|
||||||
|
self.mutations.push_root(root);
|
||||||
self.mutations.append_children(created as u32);
|
self.mutations.append_children(created as u32);
|
||||||
}
|
}
|
||||||
(_, _) => self.diff_children(old.children, new.children),
|
(_, _) => self.diff_children(old.children, new.children),
|
||||||
|
|||||||
@@ -730,3 +730,28 @@ fn remove_list_nokeyed() {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn add_nested_elements() {
|
||||||
|
let vdom = new_dom();
|
||||||
|
|
||||||
|
let (_create, change) = vdom.diff_lazynodes(
|
||||||
|
rsx! {
|
||||||
|
div{}
|
||||||
|
},
|
||||||
|
rsx! {
|
||||||
|
div{
|
||||||
|
div{}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
change.edits,
|
||||||
|
[
|
||||||
|
CreateElement { root: 2, tag: "div" },
|
||||||
|
PushRoot { root: 1 },
|
||||||
|
AppendChildren { many: 1 },
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user