From 964c93e07f5df2fb1cde589bc4192de731fbfea4 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Fri, 2 Nov 2018 17:08:02 -0700 Subject: [PATCH] Guard against the element already being destroyed Since DOM code is in a run.next, it's possible that between the DOM code being queued and running the element is destroyed. So the DOM code needs to guard against this using the isDestroyed API. --- ui/app/components/line-chart.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/app/components/line-chart.js b/ui/app/components/line-chart.js index 52c5de964..2998993cd 100644 --- a/ui/app/components/line-chart.js +++ b/ui/app/components/line-chart.js @@ -325,9 +325,11 @@ export default Component.extend(WindowResizable, { }, mountD3Elements() { - d3.select(this.element.querySelector('.x-axis')).call(this.get('xAxis')); - d3.select(this.element.querySelector('.y-axis')).call(this.get('yAxis')); - d3.select(this.element.querySelector('.y-gridlines')).call(this.get('yGridlines')); + if (!this.get('isDestroyed') && !this.get('isDestroying')) { + d3.select(this.element.querySelector('.x-axis')).call(this.get('xAxis')); + d3.select(this.element.querySelector('.y-axis')).call(this.get('yAxis')); + d3.select(this.element.querySelector('.y-gridlines')).call(this.get('yGridlines')); + } }, windowResizeHandler() {