Skip to content

Decorators on getter/setter ignores implementation, allows duplicates #4450

Open
@wjhsf

Description

@wjhsf
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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions