What problem does this solve or what need does it fill?
The example is written with Add, but similar things like Remove are affected the same way.
fn on_add(trigger: On<Add, Foo>, query: Query<&Foo>) {
// panics when spawning `(Foo, Disabled)`
let foo = query.get(trigger.target()).unwrap();
// fails to uphold invariants of the observer when `Disabled` is removed
let Ok(foo) = query.get(trigger.target()) else { return; };
}
What solution would you like?
fn on_add(trigger: On<Add, Foo>, query: Query<&Foo, Allow<Disabled>>) {
// works
let foo = query.get(trigger.target()).unwrap();
}
What alternative(s) have you considered?
Wait until reactivity is merged. There's a Com and ComMut proposal for getting the components of the triggered entity. That could presumably implicitly allow disabled internally
Additional context
Plugin code not respecting this will break downstream users' ability to use disabled entities.
What problem does this solve or what need does it fill?
The example is written with
Add, but similar things likeRemoveare affected the same way.What solution would you like?
What alternative(s) have you considered?
Wait until reactivity is merged. There's a
ComandComMutproposal for getting the components of the triggered entity. That could presumably implicitly allow disabled internallyAdditional context
Plugin code not respecting this will break downstream users' ability to use disabled entities.