bevy/crates/bevy_ecs/src
urben1680 8bce3e46f2
Preserve extra data in RelationshipTarget with replace_related(_with_difference) (#19588)
# Objective

The methods and commands `replace_related` and
`replace_related_with_difference` may cause data stored at the
`RelationshipTarget` be lost when all original children are removed
before new children are added.

Part of https://github.com/bevyengine/bevy/issues/19589

## Solution

Fix the issue, either by removing the old children _after_ adding the
new ones and not _before_ (`replace_related_with_difference`) or by
taking the whole `RelationshipTarget` to modify it, not only the inner
collection (`replace_related`).

## Testing

I added a new test asserting the data is kept. I also added a general
test of these methods as they had none previously.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2025-06-15 16:41:28 +00:00
..
entity System::check_change_tick and similar methods take CheckChangeTicks (#19600) 2025-06-13 19:24:27 +00:00
error More uninlined_format_args fixes (#19396) 2025-05-28 02:35:18 +00:00
event Rename Trigger to On (#19596) 2025-06-12 18:22:33 +00:00
observer Make the ObservedBy component useful to public consumers (#19591) 2025-06-12 20:07:11 +00:00
query Mention Mut in QueryData docs, clarify behaviour of Mut vs &mut in Mut docs (#19254) 2025-06-09 19:21:04 +00:00
reflect bevyengine.org -> bevy.org (#19503) 2025-06-05 23:09:28 +00:00
relationship Preserve extra data in RelationshipTarget with replace_related(_with_difference) (#19588) 2025-06-15 16:41:28 +00:00
schedule System::check_change_tick and similar methods take CheckChangeTicks (#19600) 2025-06-13 19:24:27 +00:00
storage System::check_change_tick and similar methods take CheckChangeTicks (#19600) 2025-06-13 19:24:27 +00:00
system System::check_change_tick and similar methods take CheckChangeTicks (#19600) 2025-06-13 19:24:27 +00:00
world System::check_change_tick and similar methods take CheckChangeTicks (#19600) 2025-06-13 19:24:27 +00:00
archetype.rs Rename Trigger to On (#19596) 2025-06-12 18:22:33 +00:00
batching.rs Nonmax all rows (#19132) 2025-05-26 17:39:55 +00:00
bundle.rs Rename Trigger to On (#19596) 2025-06-12 18:22:33 +00:00
change_detection.rs Mention Mut in QueryData docs, clarify behaviour of Mut vs &mut in Mut docs (#19254) 2025-06-09 19:21:04 +00:00
component.rs System::check_change_tick and similar methods take CheckChangeTicks (#19600) 2025-06-13 19:24:27 +00:00
entity_disabling.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
hierarchy.rs Component lifecycle reorganization and documentation (#19543) 2025-06-10 00:59:16 +00:00
intern.rs Rename bevy_platform_support to bevy_platform (#18813) 2025-04-11 23:13:28 +00:00
label.rs Remove upcasting methods + Cleanup interned label code (#18984) 2025-05-26 15:38:12 +00:00
lib.rs Rename Trigger to On (#19596) 2025-06-12 18:22:33 +00:00
lifecycle.rs Stop storing access for all systems (#19477) 2025-06-13 17:56:09 +00:00
name.rs Make entity generation a new type and remove identifier (#19121) 2025-05-08 04:03:05 +00:00
never.rs Use never_say_never hack to work around Rust 2024 regression for fn traits (#18804) 2025-04-14 19:59:48 +00:00
resource.rs refactor(utils): move SyncCell and SyncUnsafeCell to bevy_platform (#19305) 2025-05-27 04:57:26 +00:00
spawn.rs Increase upper limit of children! (#18865) 2025-05-06 00:58:30 +00:00
traversal.rs Rename Trigger to On (#19596) 2025-06-12 18:22:33 +00:00