Open
Description
class Component extends LightningElement {
@wire(getBook, {id: 1}) get book1 () {
console.log('getter')
}
@wire(getBook, {id: 2}) set book2(v) {
console.log('setter')
}
}
Currently, the compiler treats getters and setters identically to props; the implementations present on a component are dropped. (In the example above, neither 'getter'
nor 'setter'
are ever logged to console.) This behavior is not obvious, but using @wire
on a getter/setter is also kind of weird. (A getter cannot receive data, so decorating it with a data provider doesn't really make sense.) To make the behavior more consistent with expectations, we should either disallow @wire
on a getter/setter, or we should preserve their implementations. In either case, it would be a breaking change.
Activity