fix recycling nodes in native core

This commit is contained in:
Evan Almloff committed 2023-08-15 09:30:43 -05:00
1 parent 1ab5a03aef
commit 9c2e713dae
1 file changed
+6
+6
View File
@@ -57,6 +57,12 @@ impl DioxusState {
node.insert(ElementIdComponent(element_id));
if self.node_id_mapping.len() <= element_id.0 {
self.node_id_mapping.resize(element_id.0 + 1, None);
} else {
if let Some(mut node) =
self.node_id_mapping[element_id.0].and_then(|id| node.real_dom_mut().get_mut(id))
{
node.remove();
}
}
self.node_id_mapping[element_id.0] = Some(node_id);
}