diff --git a/src/apply_mutations.rs b/src/apply_mutations.rs index 95e5d64..1481c29 100644 --- a/src/apply_mutations.rs +++ b/src/apply_mutations.rs @@ -91,6 +91,8 @@ pub fn apply_mutations( let new = stack.drain((stack.len() - m)..).collect::>(); existing_parent.insert_children(existing_index, &new); DespawnRecursive { entity: existing }.apply(world); + let existing_element_id = bevy_ui_entity_to_element_id.remove(&existing).unwrap(); + element_id_to_bevy_ui_entity.remove(&existing_element_id); } Mutation::InsertAfter { id, m } => todo!(), Mutation::InsertBefore { id, m } => todo!(),