Add id = 0 handling (#2201)

* Add id = 0 handling

* Add check in view creation
This commit is contained in:
Zack Arnett
2018-12-06 19:16:06 +01:00
committed by Bram Kragten
parent 647a33ea61
commit f600b0522c
3 changed files with 4 additions and 3 deletions
@@ -28,7 +28,8 @@ export class HuiViewEditor extends hassLocalizeLitMixin(LitElement) {
if (!this._config) {
return "";
}
return this._config.id || "";
return "id" in this._config ? this._config.id! : "";
}
get _title(): string {
@@ -42,7 +42,7 @@ export class HuiDialogEditView extends LitElement {
if (
!this._params.add &&
this._params.viewConfig &&
!this._params.viewConfig.id
!("id" in this._params.viewConfig)
) {
return html`
<hui-migrate-config
+1 -1
View File
@@ -119,7 +119,7 @@ class HUIView extends localizeMixin(EventsMixin(PolymerElement)) {
_addCard() {
showEditCardDialog(this, {
viewId: this.config.id,
viewId: "id" in this.config ? String(this.config.id) : undefined,
add: true,
reloadLovelace: () => {
this.fire("config-refresh");