diff --git a/public/app/features/dashboard/state/PanelModel.ts b/public/app/features/dashboard/state/PanelModel.ts index 4be47f235df..fcd988ac060 100644 --- a/public/app/features/dashboard/state/PanelModel.ts +++ b/public/app/features/dashboard/state/PanelModel.ts @@ -467,6 +467,7 @@ export class PanelModel implements DataConfigSource { } destroy() { + this.events.emit(PanelEvents.panelTeardown); this.events.removeAllListeners(); if (this.queryRunner) { diff --git a/public/app/features/panel/panel_directive.ts b/public/app/features/panel/panel_directive.ts index 07b46b76ee0..e3b54b33e89 100644 --- a/public/app/features/panel/panel_directive.ts +++ b/public/app/features/panel/panel_directive.ts @@ -82,9 +82,6 @@ module.directive('grafanaPanel', ($rootScope, $document, $timeout) => { scope.$on('$destroy', () => { elem.off(); - panel.events.emit(PanelEvents.panelTeardown); - panel.events.removeAllListeners(); - if (panelScrollbar) { panelScrollbar.dispose(); }