Skip to content

Commit

Permalink
fix: Sometimes the graph was empty when changing tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
RomRider committed Jan 27, 2021
1 parent c3fbca6 commit 9232044
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/apexcharts-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ class ChartsCard extends LitElement {
super.connectedCallback();
if (this._config && this._hass && !this._loaded) {
this._initialLoad();
} else if (this._config && this._hass && this._apexChart && !this._config.update_interval) {
window.requestAnimationFrame(() => {
this._updateOnInterval();
});
}
if (this._config?.update_interval) {
window.requestAnimationFrame(() => {
Expand All @@ -113,6 +117,7 @@ class ChartsCard extends LitElement {
if (this._intervalTimeout) {
clearInterval(this._intervalTimeout);
}
this._updating = false;
super.disconnectedCallback();
}

Expand Down

0 comments on commit 9232044

Please sign in to comment.