Grafana UI: Unbind graph only if initialised (#25762)

This commit is contained in:
Alex Khomenko 2020-06-23 10:43:19 +03:00 committed by GitHub
parent 46df05fd9d
commit 1bde4de827
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,7 +70,9 @@ export class Graph extends PureComponent<GraphProps, GraphState> {
}
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 } }) => {