bevy/crates/bevy_hierarchy/src
Jan Hohenheim e7333510c3
Fix push_children inserting a Children component even when no children are supplied (#14109)
# Objective

The Bevy API around manipulating hierarchies removes `Children` if the
operation results in an entity having no children. This means that
`Children` is guaranteed to hold actual children. However, the following
code unexpectedly inserts empty `Children`:

```rust
commands.entity(entity).with_children(|_| {});
```

This was discovered by @Jondolf:
https://discord.com/channels/691052431525675048/1124043933886976171/1257660865625325800

## Solution

- `with_children` is now a noop when no children were passed

## Testing

- Added a regression test
2024-07-02 22:10:00 +02:00
..
components Disentangle bevy_utils/bevy_core's reexported dependencies (#12313) 2024-03-07 02:30:15 +00:00
child_builder.rs Fix push_children inserting a Children component even when no children are supplied (#14109) 2024-07-02 22:10:00 +02:00
events.rs Require #[derive(Event)] on all Events (#7086) 2023-06-06 14:44:32 +00:00
hierarchy.rs Fix EntityCommands::despawn docs (#13774) 2024-06-09 20:52:52 +02:00
lib.rs fix bevy_hierarchy crate optional feature bevy_app (#12943) 2024-04-13 04:46:00 +00:00
query_extension.rs Rename Q type parameter to D when referring to WorldQueryData (#10782) 2023-12-13 18:50:46 +00:00
valid_parent_check_plugin.rs Add entity id to hierarchy propagation error message (#12733) 2024-03-26 15:20:21 +00:00