Replace `RemovedComponents` with observers
What problem does this solve or what need does it fill?
RemovedComponents isn't a particularly nice tool: it doesn't fit into our existing tools for responding to changes well, doesn't allow users to read the data as it's being removed, must be continually monitored to avoid missing events, and risks desynchronization because of the polling-based mechanism.
What solution would you like?
Observers (merged in https://github.com/bevyengine/bevy/pull/10839) offer an alternative solution to this problem space without the caveats.
We should deprecate and then remove [RemovedComponents], being careful to update and improve documentation and write a clear migration guide.
In particular, users can emit events, triggered by an observer, to recreate the previous polling-style behavior when it is preferred.
What alternative(s) have you considered?
Other solutions to solve and/or work around the problem presented.
Additional context
#2148 proposes a Removed query filter, which might still be a valuable (if complex) complement even with this PR implemented.
Just a note: I think this issue should be blocked on the ability to order observers. The event still has the advantage that we can read it at precise moments until that feature is implemented
RemovedComponents also allow to react on despawns.
We need to implement a similar mechanism for observers before removing them.
Just wanted to add my comment :)
I don't wish RemovedComponents gets replaced.
I don't think observers well replace RemovedComponents, because with RemovedComponents I can very easily control where things are happening based on removals (system). Observers convolute the clarity of what's happening and where. Also, my special needs where I tend to insert or remove components separately as opposed to bundles doesn't work that well with observers.
I almost don't use observers at all, only for a couple of components. The reason is that with them I'm not well in control of how world is accessed.
(I only use bevy_ecs).