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

Some destroyables aren't destroyed #1446

Open
swastik opened this issue Oct 9, 2023 · 2 comments
Open

Some destroyables aren't destroyed #1446

swastik opened this issue Oct 9, 2023 · 2 comments

Comments

@swastik
Copy link

swastik commented Oct 9, 2023

I'm not familiar with Glimmer internals, so I'm not sure if this is an issue or if it works as intended, but here's a pretty simple Ember app that inserts 100 divs on click, then clears them out. If I enable destroy tracking, then assert it's all destroyed later, that seems like it doesn't quite happen.

In our actual app, this seems to retain a ton of these destroyables that should (?) be destroyed at this point but aren't for some reason.

Screen.Recording.2023-10-09.at.14.20.24.mov

Code:

  @tracked items = [];
  @tracked count = 0;

  @action addItems() {
    this.items = [
      ...this.items,
      ...Array(100)
        .fill(0)
        .map((_, i) => i),
    ];
  }

  @action clear() {
    this.items = [];
  }
<div>
  <button
    class="p-2 ml-2 add-items"
    type="button"
    {{on "click" this.addItems}}
  >Add 100 items</button>
  <button
    class="p-2 ml-2 clear"
    type="button"
    {{on "click" this.clear}}
  >Clear</button>
</div>

{{#each this.items as |item|}}
  <div>
    {{item}}
  </div>
{{/each}}
@swastik
Copy link
Author

swastik commented Oct 9, 2023

I have a feeling these APIs are intended only for tests, but I'm not seeing everything being destroyed in tests either. 🤔

@NullVoxPopuli
Copy link
Contributor

Do you have an ember test that reproduces the issue? In which ember version?

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

2 participants