fix(todo): use \$state.snapshot() for subtask toggle to avoid DataCloneError

Svelte 5 \$state creates deep reactive Proxy objects. IndexedDB can't
serialize Proxies via structured clone algorithm. Using \$state.snapshot()
produces plain objects that IndexedDB can store.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-03-31 17:31:35 +02:00
parent cbe877c3c9
commit 2a00310273
2 changed files with 4 additions and 2 deletions

View file

@ -209,7 +209,8 @@
function toggleSubtask(subtaskId: string) {
if (!onSave) return;
const updated = (task.subtasks ?? []).map((s) =>
const subtasks = $state.snapshot(task.subtasks) ?? [];
const updated = subtasks.map((s) =>
s.id === subtaskId
? {
...s,

View file

@ -153,7 +153,8 @@
function toggleSubtask(subtaskId: string) {
if (!onSave) return;
const updated = (task.subtasks ?? []).map((s) =>
const subtasks = $state.snapshot(task.subtasks) ?? [];
const updated = subtasks.map((s) =>
s.id === subtaskId
? {
...s,