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:
@@ -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 ?? {});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user