Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

destroy chart instance when component is disconnected

Vincent41dfff4b49f2
diff --git a/ui/component/or-attribute-card/src/index.ts b/ui/component/or-attribute-card/src/index.ts
index 9797ae950..9a66d3bc7 100644
--- a/ui/component/or-attribute-card/src/index.ts
+++ b/ui/component/or-attribute-card/src/index.ts
@@ -205,6 +205,18 @@ export class OrAttributeCard extends LitElement {
}
+ disconnectedCallback(): void {
+ super.disconnectedCallback();
+ this._cleanup();
+ }
+
+ protected _cleanup() {
+ if (this._chart) {
+ this._chart.destroy();
+ this._chart = undefined;
+ }
+ }
+
protected render() {
if (this.assetId === "" || this.attributeName === "") {