@@ -649,6 +649,7 @@ function CreateTodoForm({
});
if (!r.ok) throw new Error("Could not create list.");
const doc: TodoList = await r.json();
+ setCreating(false);
onCreated(doc);
} catch (e) {
setError(e instanceof Error ? e.message : "Could not create list.");
From 157f992c2c18f542e39e720eebe6272ed06ef1e9 Mon Sep 17 00:00:00 2001
From: Hogne <227774406+hognek@users.noreply.github.com>
Date: Fri, 17 Jul 2026 23:07:24 +0200
Subject: [PATCH 3/8] fix(todo): reorder within visible section + validate
items before setDoc
- Kilo WARNING: reorder items within their visible section (incomplete/complete)
instead of the full list, fixing cross-boundary swap bug and incorrect
move-up/move-down disabled checks
- Kilo SUGGESTION: validate doc.items as array before setDoc in loadDoc
to guard against missing/non-array items from the API
Desktop tests: 12/12 pass. TypeScript: clean.
---
desktop/src/apps/TodoApp.tsx | 49 ++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 19 deletions(-)
diff --git a/desktop/src/apps/TodoApp.tsx b/desktop/src/apps/TodoApp.tsx
index 114b33154..ee8fb7c4b 100644
--- a/desktop/src/apps/TodoApp.tsx
+++ b/desktop/src/apps/TodoApp.tsx
@@ -90,14 +90,14 @@ function isOverdue(ts: number): boolean {
function TodoItemRow({
item,
- itemCount,
+ sectionItems,
onToggleDone,
onEditSave,
onDelete,
onMove,
}: {
item: TodoItem;
- itemCount: number;
+ sectionItems: TodoItem[];
onToggleDone: (id: string, done: boolean) => void;
onEditSave: (id: string, text: string) => Promise;
onDelete: (id: string) => void;
@@ -128,6 +128,7 @@ function TodoItemRow({
}
const overdue = item.due_at && isOverdue(item.due_at) && !item.done;
+ const sectionIdx = sectionItems.findIndex((i) => i.id === item.id);
return (
@@ -234,7 +235,7 @@ function TodoItemRow({