fix(merge-plan): snapshot proposal prop to avoid structuredClone proxy throw

structuredClone on a Svelte 5 reactive Proxy throws DataCloneError during
component init, causing MergeProposalPanel to silently fail to mount.
Replace with \$state.snapshot which is the documented way to deep-copy a
reactive prop into a local editable state.
This commit is contained in:
2026-04-26 00:28:21 +02:00
parent 131d8c8ff0
commit 24dc46eeb8

View File

@@ -1,5 +1,4 @@
<script lang="ts">
import { untrack } from 'svelte';
import Button from '$lib/components/ui/Button.svelte';
import type { AdminMarketDetail, DuplicateMarket, MarketMergeProposal } from '$lib/api/types.js';
import { fieldLabels, formatValue } from './fieldRenderers.js';
@@ -16,7 +15,7 @@
let { proposal, candidate, current, applying, onApply, onClose }: Props = $props();
// Local copy the admin can edit before applying.
let edited = $state(untrack(() => structuredClone(proposal)));
let edited = $state($state.snapshot(proposal));
const fieldOrder = Object.keys(edited.field_merges ?? {});