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

Fix view destruction inside outlets #11577

Merged
merged 2 commits into from
Jun 29, 2015
Merged

Fix view destruction inside outlets #11577

merged 2 commits into from
Jun 29, 2015

Conversation

ef4
Copy link
Contributor

@ef4 ef4 commented Jun 28, 2015

This fixes #11539. However, I think it's hacky and this needs review by @wycats and maybe @mmun.

I do not see who is truly responsible for view destruction. HTMLBars is clearing the DOM nodes without destroying corresponding views. This leaves a keyword like outlet in an awkward position of needing to destroy views that are already out-of-DOM, which is bad because the views will blindly nuke their original contextual element even though subsequent content may already be present.

ef4 added 2 commits June 28, 2015 13:42
This solution feels hacky and we need to discuss what code is really
responsible for view destruction. The htmlbars code that clears the DOM
does not do view destruction, which leaves us in an awkward situation
where the DOM is already removed but we need to destroy the view.
@@ -210,7 +210,7 @@ Renderer.prototype.renderElementRemoval =
if (view._willRemoveElement) {
view._willRemoveElement = false;

if (view._renderNode) {
if (view._renderNode && view.element && view.element.parentNode) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the especially hacky bit. Without this, views that are already out-of-DOM will delete unrelated subsequent content that has replaced them in the same render node.

@ef4
Copy link
Contributor Author

ef4 commented Jun 28, 2015

Despite my above caveats, I do think this code is safe to merge and it solves a pressing issue that is blocking people's upgrades. We can address the architectural concern at our leisure.

rwjblue added a commit that referenced this pull request Jun 29, 2015
Fix view destruction inside outlets
@rwjblue rwjblue merged commit 922e2da into emberjs:master Jun 29, 2015
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.

[Ember 1.13.1]willDestroyElement never called
2 participants