From 62f635764b9962d6dd164d011f0ebf905db53107 Mon Sep 17 00:00:00 2001 From: farmio Date: Fri, 27 Sep 2024 23:25:14 +0200 Subject: [PATCH] Handle falsy value in ha-yaml-editor (object selector) --- src/components/ha-yaml-editor.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/components/ha-yaml-editor.ts b/src/components/ha-yaml-editor.ts index 1eb94c0aeab9..0528c21aa8de 100644 --- a/src/components/ha-yaml-editor.ts +++ b/src/components/ha-yaml-editor.ts @@ -59,14 +59,13 @@ export class HaYamlEditor extends LitElement { public setValue(value): void { try { - this._yaml = - value && !isEmpty(value) - ? dump(value, { - schema: this.yamlSchema, - quotingType: '"', - noRefs: true, - }) - : ""; + this._yaml = !isEmpty(value) + ? dump(value, { + schema: this.yamlSchema, + quotingType: '"', + noRefs: true, + }) + : ""; } catch (err: any) { // eslint-disable-next-line no-console console.error(err, value); @@ -75,7 +74,7 @@ export class HaYamlEditor extends LitElement { } protected firstUpdated(): void { - if (this.defaultValue) { + if (this.defaultValue !== undefined) { this.setValue(this.defaultValue); } }