diff --git a/ghost/admin/app/components/gh-content-view-container.js b/ghost/admin/app/components/gh-content-view-container.js index d3abcf87c2..aefe15beec 100644 --- a/ghost/admin/app/components/gh-content-view-container.js +++ b/ghost/admin/app/components/gh-content-view-container.js @@ -8,6 +8,8 @@ export default Ember.Component.extend({ resizeService: Ember.inject.service(), + _resizeListener: null, + calculatePreviewIsHidden: function () { if (this.$('.content-preview').length) { this.set('previewIsHidden', !this.$('.content-preview').is(':visible')); @@ -16,8 +18,12 @@ export default Ember.Component.extend({ didInsertElement: function () { this._super(...arguments); + this._resizeListener = Ember.run.bind(this, this.calculatePreviewIsHidden); + this.get('resizeService').on('debouncedDidResize', this._resizeListener); this.calculatePreviewIsHidden(); - this.get('resizeService').on('debouncedDidResize', - Ember.run.bind(this, this.calculatePreviewIsHidden)); + }, + + willDestroy: function () { + this.get('resizeService').off('debouncedDidResize', this._resizeListener); } });