mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 00:01:10 +02:00
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:
parent
cbe877c3c9
commit
2a00310273
2 changed files with 4 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue