Fix: Unsubscribe from events in dashboards (#19788)

* Unsubscribe on unmount

* Fix unsubscribe
This commit is contained in:
Andrej Ocenas
2019-10-16 12:54:13 +02:00
committed by GitHub
parent f8c474fa1b
commit 945b815fe0
2 changed files with 5 additions and 0 deletions
@@ -81,6 +81,8 @@ export class PanelChrome extends PureComponent<Props, State> {
componentWillUnmount() {
this.props.panel.events.off(PanelEvents.refresh, this.onRefresh);
this.props.panel.events.off(PanelEvents.render, this.onRender);
if (this.querySubscription) {
this.querySubscription.unsubscribe();
this.querySubscription = null;
@@ -151,6 +151,9 @@ export class VisualizationTab extends PureComponent<Props, State> {
}
componentWillUnmount() {
if (this.querySubscription) {
this.querySubscription.unsubscribe();
}
this.cleanUpAngularOptions();
}