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.
This commit is contained in:
Michael Lange
2018-11-02 17:08:02 -07:00
parent 6aa0c7ffa9
commit 5aef27ccd8

View File

@@ -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() {