From 1bde4de82764d02d4fb64f12f8661d109a7b1d8a Mon Sep 17 00:00:00 2001 From: Alex Khomenko Date: Tue, 23 Jun 2020 10:43:19 +0300 Subject: [PATCH] Grafana UI: Unbind graph only if initialised (#25762) --- packages/grafana-ui/src/components/Graph/Graph.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/grafana-ui/src/components/Graph/Graph.tsx b/packages/grafana-ui/src/components/Graph/Graph.tsx index 16e3286c083..9495fa1096f 100644 --- a/packages/grafana-ui/src/components/Graph/Graph.tsx +++ b/packages/grafana-ui/src/components/Graph/Graph.tsx @@ -70,7 +70,9 @@ export class Graph extends PureComponent { } componentWillUnmount() { - this.$element.unbind('plotselected', this.onPlotSelected); + if (this.$element) { + this.$element.unbind('plotselected', this.onPlotSelected); + } } onPlotSelected = (event: JQueryEventObject, ranges: { xaxis: { from: number; to: number } }) => {