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

v3.2.0: Reading array.length seems to trigger dirty flag #404

Open
AlexEdgcomb opened this issue Apr 5, 2023 · 0 comments
Open

v3.2.0: Reading array.length seems to trigger dirty flag #404

AlexEdgcomb opened this issue Apr 5, 2023 · 0 comments

Comments

@AlexEdgcomb
Copy link

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

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

No branches or pull requests

1 participant