Skip to content

Commit

Permalink
Fix chart not able to setup because canvas in use (#18018)
Browse files Browse the repository at this point in the history
* Fix chart not able to setup because canvas in use

* Update ha-chart-base.ts
  • Loading branch information
bramkragten authored Sep 26, 2023
1 parent 5aaf0cd commit 2a8d983
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/chart/ha-chart-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ export class HaChartBase extends LitElement {
@state() private _hiddenDatasets: Set<number> = new Set();

public disconnectedCallback() {
this._releaseCanvas();
super.disconnectedCallback();
this._releaseCanvas();
}

public connectedCallback() {
super.connectedCallback();
if (this.hasUpdated) {
this._releaseCanvas();
this._setupChart();
}
}
Expand Down Expand Up @@ -110,7 +111,7 @@ export class HaChartBase extends LitElement {
return;
}
if (changedProps.has("plugins") || changedProps.has("chartType")) {
this.chart.destroy();
this._releaseCanvas();
this._setupChart();
return;
}
Expand Down

0 comments on commit 2a8d983

Please sign in to comment.