feat: todomvc
This commit is contained in:
1 parent
ce33031519
commit
cfa0927cdd
20 files changed
+934
-245
No files matched your search
+21
-21
@@ -473,27 +473,27 @@ impl<'a> DiffMachine<'a> {
|
||||
//
|
||||
// Upon exiting, the change list stack is in the same state.
|
||||
fn diff_keyed_children(&mut self, old: &[VNode<'a>], new: &[VNode<'a>]) {
|
||||
if cfg!(debug_assertions) {
|
||||
let mut keys = fxhash::FxHashSet::default();
|
||||
let mut assert_unique_keys = |children: &[VNode]| {
|
||||
keys.clear();
|
||||
for child in children {
|
||||
let key = child.key();
|
||||
debug_assert!(
|
||||
key.is_some(),
|
||||
"if any sibling is keyed, all siblings must be keyed"
|
||||
);
|
||||
keys.insert(key);
|
||||
}
|
||||
debug_assert_eq!(
|
||||
children.len(),
|
||||
keys.len(),
|
||||
"keyed siblings must each have a unique key"
|
||||
);
|
||||
};
|
||||
assert_unique_keys(old);
|
||||
assert_unique_keys(new);
|
||||
}
|
||||
// if cfg!(debug_assertions) {
|
||||
// let mut keys = fxhash::FxHashSet::default();
|
||||
// let mut assert_unique_keys = |children: &[VNode]| {
|
||||
// keys.clear();
|
||||
// for child in children {
|
||||
// let key = child.key();
|
||||
// debug_assert!(
|
||||
// key.is_some(),
|
||||
// "if any sibling is keyed, all siblings must be keyed"
|
||||
// );
|
||||
// keys.insert(key);
|
||||
// }
|
||||
// debug_assert_eq!(
|
||||
// children.len(),
|
||||
// keys.len(),
|
||||
// "keyed siblings must each have a unique key"
|
||||
// );
|
||||
// };
|
||||
// assert_unique_keys(old);
|
||||
// assert_unique_keys(new);
|
||||
// }
|
||||
|
||||
// First up, we diff all the nodes with the same key at the beginning of the
|
||||
// children.
|
||||
|
||||
Reference in new issue
Block a user