Skip to content

Commit

Permalink
Fix issue with updating after adding to lovelace
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Jan 4, 2020
1 parent 47c9f29 commit e1375ab
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
10 changes: 1 addition & 9 deletions src/components/buttons/HacsButtonAddToLovelace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,15 @@ import { customElement, TemplateResult, html, property } from "lit-element";
import swal from "sweetalert";
import { HacsRepositoryButton } from "./HacsRepositoryButton";

import {
Configuration,
LovelaceConfig,
LovelaceResourceConfig
} from "../../data";
import { LovelaceConfig, LovelaceResourceConfig } from "../../data";

import { localize } from "../../localize/localize";

import { Logger } from "../../misc/Logger";

@customElement("hacs-button-add-to-lovelace")
export class HacsButtonAddToLovelace extends HacsRepositoryButton {
@property() public configuration: Configuration;
@property() public lovelaceconfig: LovelaceConfig;

logger = new Logger("add_to_lovelace");

render(): TemplateResult | void {
if (!this.repository.installed) return html``;
if (this.repository.javascript_type === null) return html``;
Expand Down
2 changes: 1 addition & 1 deletion src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,6 @@ export const getLovelaceConfiguration = async (hass: HomeAssistant) => {
});
return response;
} catch (e) {
return e;
return null;
}
};
2 changes: 1 addition & 1 deletion src/misc/AddedToLovelace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function AddedToLovelace(
status: Status
): boolean {
if (status.lovelace_mode === "yaml") return true;
if (lovelaceconfig !== undefined) {
if (lovelaceconfig) {
var loaded: boolean = false;
var URL: string = `/community_plugin/${
repository.full_name.split("/")[1]
Expand Down
4 changes: 3 additions & 1 deletion src/panels/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ export class HacsRepository extends LitElement {
}
}
});
return changedProperties.has("repo");
return (
changedProperties.has("repo") || changedProperties.has("lovelaceconfig")
);
}

protected firstUpdated() {
Expand Down

0 comments on commit e1375ab

Please sign in to comment.