mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix chart not able to setup because canvas in use (#18018)
* Fix chart not able to setup because canvas in use * Update ha-chart-base.ts
This commit is contained in:
parent
5aaf0cd579
commit
2a8d98307e
@ -53,13 +53,14 @@ export class HaChartBase extends LitElement {
|
|||||||
@state() private _hiddenDatasets: Set<number> = new Set();
|
@state() private _hiddenDatasets: Set<number> = new Set();
|
||||||
|
|
||||||
public disconnectedCallback() {
|
public disconnectedCallback() {
|
||||||
this._releaseCanvas();
|
|
||||||
super.disconnectedCallback();
|
super.disconnectedCallback();
|
||||||
|
this._releaseCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
public connectedCallback() {
|
public connectedCallback() {
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
if (this.hasUpdated) {
|
if (this.hasUpdated) {
|
||||||
|
this._releaseCanvas();
|
||||||
this._setupChart();
|
this._setupChart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,7 +111,7 @@ export class HaChartBase extends LitElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (changedProps.has("plugins") || changedProps.has("chartType")) {
|
if (changedProps.has("plugins") || changedProps.has("chartType")) {
|
||||||
this.chart.destroy();
|
this._releaseCanvas();
|
||||||
this._setupChart();
|
this._setupChart();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user