bevy/crates/bevy_hierarchy/src
Jan Hohenheim 7aaf440fbf
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 13:27:02 +00: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 13:27:02 +00:00
events.rs Require #[derive(Event)] on all Events (#7086) 2023-06-06 14:44:32 +00:00
hierarchy.rs Merge BuildWorldChildren and BuildChildren traits. (#14052) 2024-07-01 14:29:39 +00:00
lib.rs Merge BuildWorldChildren and BuildChildren traits. (#14052) 2024-07-01 14:29:39 +00:00
query_extension.rs Apply Clippy lints regarding lazy evaluation and closures (#14015) 2024-07-01 15:54:40 +00:00
valid_parent_check_plugin.rs Add entity id to hierarchy propagation error message (#12733) 2024-03-26 15:20:21 +00:00