From a78ee3b2f1b72a3150d27dd2115b6200169e232f Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 3 Jan 2024 14:43:14 +0100 Subject: [PATCH] Revert "make cleaner" This reverts commit fa33b3361451dd334d9f69142f9754a1ea2c1ca4. --- src/data/todo.ts | 7 +++++-- src/panels/todo/dialog-todo-item-editor.ts | 12 +++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/data/todo.ts b/src/data/todo.ts index cf2bec8f49b3..0a38b5de4c6f 100644 --- a/src/data/todo.ts +++ b/src/data/todo.ts @@ -83,7 +83,10 @@ export const updateItem = ( item: item.uid, rename: item.summary, status: item.status, - description: item.description === "" ? null : item.description, + description: + item.description === undefined || item.description + ? item.description + : null, due_datetime: item.due?.includes("T") ? item.due : undefined, due_date: item.due === undefined || item.due?.includes("T") @@ -103,7 +106,7 @@ export const createItem = ( "add_item", { item: item.summary, - description: item.description === "" ? null : item.description, + description: item.description || undefined, due_datetime: item.due?.includes("T") ? item.due : undefined, due_date: item.due === undefined || item.due?.includes("T") diff --git a/src/panels/todo/dialog-todo-item-editor.ts b/src/panels/todo/dialog-todo-item-editor.ts index cee282ec93d2..daa5eff68627 100644 --- a/src/panels/todo/dialog-todo-item-editor.ts +++ b/src/panels/todo/dialog-todo-item-editor.ts @@ -319,11 +319,13 @@ class DialogTodoItemEditor extends LitElement { await updateItem(this.hass!, this._params!.entity, { ...entry, summary: this._summary, - description: this._todoListSupportsFeature( - TodoListEntityFeature.SET_DESCRIPTION_ON_ITEM - ) - ? this._description - : undefined, + description: + this._description || + (this._todoListSupportsFeature( + TodoListEntityFeature.SET_DESCRIPTION_ON_ITEM + ) + ? null + : undefined), due: this._due ? this._hasTime ? this._due.toISOString()