fix(questions): unwrap \$state proxy for tags before Dexie write

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) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-04-09 00:31:53 +02:00
parent 74140e1154
commit 6fd4655273

View file

@ -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,