ember-cli / ember-cli/eslint-plugin-ember
New lint: potential bug with assigning a value to a tracked property
Open
enhancement
New Rule
- Dominant language
- JavaScript
- Stars
- 263
- Forks
- 214
- Avg merge
- 30m
- Merged PRs (30d)
- 5
Description
Example:
```js
class Demo extends Component {
@tracked foo = this.someProperty
@cached
get someProperty() {
return this.args.someData ?? [];
}
}
```
The bug is that we expect `foo` to initially be `someProperty`, but `someData` may not yet be available and we end up setting `[]` as the value of `foo` on first render.
Since property assignment is _non-reactive_, we should warn of this bug, and suggest using `@localCopy` from https://github.com/tracked-tools/tracked-toolbox
so that changes to `someProperty` used in `foo`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.