v3.2.0: Reading array.length seems to trigger dirty flag
AlexEdgcomb opened this issue · comments
Alex Edgcomb commented
Issue Summary
Reading array.length then calling array.push() yields an error about updating a value after using it in a computation.
Steps to Reproduce
Minimal repro:
- component.js
import Component from '@glimmer/component';
import { tracked } from 'tracked-built-ins';
export default class MyComponent extends Component {
myArray = tracked([]);
constructor() {
super(...arguments);
this.myArray.push(this.myArray.length);
}
}
- template.hbs (empty)
Error when component tries to load:
Uncaught Error: Assertion Failed: You attempted to update `_value` on `TrackedStorageImpl`, but it had already been used previously in the same computation. Attempting to update a value after using it in a computation can cause logical errors, infinite revalidation bugs, and performance issues, and is not supported.
Technical details
tracked-built-ins@3.2.0
ember-source@4.11.0
Supporting information
This may have some relation to #29