Skip to content

Commit

Permalink
fix bug causing card to disappear when translation are not reloaded
Browse files Browse the repository at this point in the history
  • Loading branch information
niels committed Nov 1, 2020
1 parent 02872b6 commit f05fdc8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/scheduler-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class SchedulerCard extends LitElement {
@property() actions: ActionElement[] = [];
@property() friendlyName?: string;

translationsLoaded = false;
@property() translationsLoaded = false;
editItem: string | null = null;
scheduleEntities: string[] = [];

Expand All @@ -79,10 +79,13 @@ export class SchedulerCard extends LitElement {

firstUpdated() {
const hass = this._hass!;
const el = document.querySelector('home-assistant') as HTMLElement & { _loadFragmentTranslations: any };
el._loadFragmentTranslations(hass.language, 'config').then(() => {
this._hass!.localize;
});
if (hass.localize('ui.panel.config.automation.editor.actions.name')) this.translationsLoaded = true;
else {
const el = document.querySelector('home-assistant') as HTMLElement & { _loadFragmentTranslations: any };
el._loadFragmentTranslations(hass.language, 'config').then(() => {
this._hass!.localize;
});
}
}

protected shouldUpdate(changedProps: PropertyValues): boolean {
Expand Down

0 comments on commit f05fdc8

Please sign in to comment.