Skip to content

Commit

Permalink
Prevent issues during destruction when parentView is observed.
Browse files Browse the repository at this point in the history
Setting `parentView` to `null` is technically better, but unfortunately
we have not had this reset in place for a while and folks have dependent
keys that include `parentView`. Setting without `Ember.set` triggers the
mandatory setter assertion.

This removes the clearing of `parentView` (for now) so that we can
properly message it being unobservable in the future.
  • Loading branch information
Robert Jackson committed Sep 13, 2016
1 parent ee1947f commit 67300d6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2565,4 +2565,19 @@ moduleFor('Components test: curly components', class extends RenderingTest {

this.assertText('things');
}

['@test using parentView in the template does not error during destruction']() {
this.registerComponent('foo-bar', {
ComponentClass: Component.extend({
title: computed('parentView.title', function() {
return this.get('parentView.title');
})
}),
template: `{{title}}`
});

this.render(`{{foo-bar}}`, { title: 'things' });

this.assertText('things');
}
});
1 change: 0 additions & 1 deletion packages/ember-htmlbars/lib/hooks/cleanup-render-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export default function cleanupRenderNode(renderNode) {
if (view.parentView && view.parentView === env.view) {
view.parentView.removeChild(view);
}
view.parentView = null;

view._transitionTo('preRender');
});
Expand Down

0 comments on commit 67300d6

Please sign in to comment.