What I think would be useful is essentially an arena allocator associated with a state. So any components and entities created when a state is active would be removed when that state is exited. Otherwise it seems that one must do manual GC, which is error-prone and will almost certainly lead to slow leaks over time.
[0]: https://docs.rs/bevy/latest/bevy/ecs/prelude/struct.State.ht...