Skip to content

Commit

Permalink
reclaim el id for nested dyn nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
gammahead committed Feb 21, 2025
1 parent bdeedc1 commit fd8006d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/diff/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ impl VNode {
} else {
to.remove_node(id);
}
dom.reclaim(id)
}
dom.reclaim(id)
}
Fragment(nodes) => {
for node in &nodes[..nodes.len() - 1] {
Expand Down
12 changes: 6 additions & 6 deletions packages/core/tests/diff_unkeyed_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ fn removes_one_by_one() {
dom.render_immediate_to_vec().edits,
[
LoadTemplate { index: 0, id: ElementId(2) },
CreateTextNode { value: "0".to_string(), id: ElementId(6) },
CreateTextNode { value: "0".to_string(), id: ElementId(3) },
ReplacePlaceholder { path: &[0], m: 1 },
LoadTemplate { index: 0, id: ElementId(8) },
CreateTextNode { value: "1".to_string(), id: ElementId(9) },
LoadTemplate { index: 0, id: ElementId(5) },
CreateTextNode { value: "1".to_string(), id: ElementId(6) },
ReplacePlaceholder { path: &[0], m: 1 },
LoadTemplate { index: 0, id: ElementId(10) },
CreateTextNode { value: "2".to_string(), id: ElementId(11) },
LoadTemplate { index: 0, id: ElementId(7) },
CreateTextNode { value: "2".to_string(), id: ElementId(8) },
ReplacePlaceholder { path: &[0], m: 1 },
ReplaceWith { id: ElementId(4), m: 3 }
]
Expand Down Expand Up @@ -420,7 +420,7 @@ fn remove_many() {
edits.edits,
[
LoadTemplate { index: 0, id: ElementId(9,) },
CreateTextNode { value: "hello 0".to_string(), id: ElementId(7,) },
CreateTextNode { value: "hello 0".to_string(), id: ElementId(10,) },
ReplacePlaceholder { path: &[0,], m: 1 },
ReplaceWith { id: ElementId(11,), m: 1 },
]
Expand Down

0 comments on commit fd8006d

Please sign in to comment.