From 6fd4655273e798702ca5c2ca587da529b47d603f Mon Sep 17 00:00:00 2001 From: Till JS Date: Thu, 9 Apr 2026 00:31:53 +0200 Subject: [PATCH] fix(questions): unwrap \$state proxy for tags before Dexie write MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Creating a new question crashed in mana-sync's pending-change hook with DataCloneError because the tags array is a Svelte 5 \$state proxy and IndexedDB / structured-clone can't serialize proxies. Surfaced while clicking through the deep-research feature end-to-end in the browser — the form would silently fail to submit with the error buried in the console. Use \$state.snapshot() to deep-clone tags into a plain array before persisting. Other fields are primitives so they're already plain. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../apps/web/src/routes/(app)/questions/new/+page.svelte | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/mana/apps/web/src/routes/(app)/questions/new/+page.svelte b/apps/mana/apps/web/src/routes/(app)/questions/new/+page.svelte index 77ac41c18..80d0cde15 100644 --- a/apps/mana/apps/web/src/routes/(app)/questions/new/+page.svelte +++ b/apps/mana/apps/web/src/routes/(app)/questions/new/+page.svelte @@ -71,7 +71,11 @@ description: description.trim() || null, status: 'open' as const, priority, - tags, + // Unwrap the Svelte 5 $state proxy — Dexie / mana-sync's + // _pendingChanges hook structured-clones the row and proxies + // throw DataCloneError. $state.snapshot() returns a plain + // deep copy. + tags: $state.snapshot(tags), researchDepth, createdAt: now, updatedAt: now,