Skip to content

Commit

Permalink
Reload the card when changing the configuration in editor (#21351)
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya authored Jul 10, 2024
1 parent 7edc4ef commit daa3678
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/panels/lovelace/cards/hui-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,10 @@ export class HuiCard extends ReactiveElement {
if (changedProps.has("config")) {
const elementConfig = this._elementConfig;
if (this.config !== elementConfig && this.config) {
const typeChanged = this.config?.type !== elementConfig?.type;
if (typeChanged) {
const typeChanged =
this.config?.type !== elementConfig?.type || this.preview;
// Rebuild the card if the type of the card has changed or if we are in preview mode
if (typeChanged || this.preview) {
this._loadElement(this.config);
} else {
this._updateElement(this.config);
Expand Down

0 comments on commit daa3678

Please sign in to comment.