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

Release root components after they are destroyed #15513

Merged

Conversation

mitchlloyd
Copy link
Contributor

@mitchlloyd mitchlloyd commented Jul 16, 2017

The first commit removes some guards around assertions that used to fail in Glimmer. They seem to be working now 🎉

The second commit removes destroyed root components from renderer._roots. This was the behavior before this commit.

I'm submitting this PR because retaining the destroyed components is causing trouble for me when attempting to create a new feature for ember-islands. I'd like to destroy a component and have it released so that I don't leak memory. The issue manifests in tests:

  1. Use component.appendTo() in an acceptance test.
  2. Call component.destroy().
  3. On test teardown (application.destroy()) I get an error Error: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

Glimmer throws this error because Ember attempts to clean up all the _roots from _clearAllRoots. However the component in _roots has already been destroyed.

@rwjblue
Copy link
Member

rwjblue commented Aug 7, 2017

Sorry for letting this linger @mitchlloyd!

@rwjblue rwjblue merged commit 81baec7 into emberjs:master Aug 7, 2017
@mitchlloyd
Copy link
Contributor Author

Thanks for reviewing!

@mitchlloyd mitchlloyd deleted the mitchlloyd/destroying-appended-components branch August 11, 2017 02:50
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

Successfully merging this pull request may close these issues.

2 participants