Skip to content

Commit

Permalink
Fix schedule form rendering after disconnect (#18401)
Browse files Browse the repository at this point in the history
  • Loading branch information
karwosts authored Oct 25, 2023
1 parent 763f80b commit b0b7e77
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/panels/config/helpers/forms/ha-schedule-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,20 @@ class HaScheduleForm extends LitElement {
}
}

public disconnectedCallback(): void {
super.disconnectedCallback();
this.calendar?.destroy();
this.calendar = undefined;
this.renderRoot.querySelector("style[data-fullcalendar]")?.remove();
}

public connectedCallback(): void {
super.connectedCallback();
if (this.hasUpdated && !this.calendar) {
this.setupCalendar();
}
}

public focus() {
this.updateComplete.then(
() =>
Expand Down Expand Up @@ -165,6 +179,10 @@ class HaScheduleForm extends LitElement {
}

protected firstUpdated(): void {
this.setupCalendar();
}

private setupCalendar(): void {
const config: CalendarOptions = {
...defaultFullCalendarConfig,
locale: this.hass.language,
Expand Down

0 comments on commit b0b7e77

Please sign in to comment.