Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jelhan committed Jun 1, 2016
1 parent 00bfde3 commit 47ec98a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion addon/mixins/component-child.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ export default Ember.Mixin.create({
let parent = this.nearestOfType(ComponentParentMixin);
if (parent) {
parent.registerChild(this);
this.set('_parent', parent);
}
}),

// stores the parent in didInsertElement hook as a work-a-round for
// https://github.com/emberjs/ember.js/issues/12080
_parent: null,

_willDestroyElement: Ember.on('willDestroyElement', function() {
let parent = this.nearestOfType(ComponentParentMixin);
let parent = this.nearestOfType(ComponentParentMixin) || this.get('_parent');
if (parent) {
parent.removeChild(this);
}
Expand Down

0 comments on commit 47ec98a

Please sign in to comment.