Fix: Unsubscribe from events in dashboards (#19788)
* Unsubscribe on unmount * Fix unsubscribe
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user