-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Labels
A-LinterRelated to the linter and custom lintsRelated to the linter and custom lintsC-FeatureMake something new possibleMake something new possible
Description
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.
Metadata
Metadata
Assignees
Labels
A-LinterRelated to the linter and custom lintsRelated to the linter and custom lintsC-FeatureMake something new possibleMake something new possible
Type
Projects
Status
Todo