Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@wire on getter/setter ignores implementation #4450

Open
Tracked by #2964
wjhsf opened this issue Aug 8, 2024 · 0 comments
Open
Tracked by #2964

@wire on getter/setter ignores implementation #4450

wjhsf opened this issue Aug 8, 2024 · 0 comments

Comments

@wjhsf
Copy link
Contributor

wjhsf commented Aug 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant