diff --git a/src/routes/(protected)/admin/proclamations/ProclamationForm.svelte b/src/routes/(protected)/admin/proclamations/ProclamationForm.svelte index 7486f76..d996652 100644 --- a/src/routes/(protected)/admin/proclamations/ProclamationForm.svelte +++ b/src/routes/(protected)/admin/proclamations/ProclamationForm.svelte @@ -32,18 +32,23 @@ if (record.id) dirty = true; } - let name = $state(String(record.name ?? '')); - let solfeggioFrequencyId = $state(String(record.solfeggioFrequencyId ?? '')); - let subscriptionLevelId = $state(String(record.subscriptionLevelId ?? '')); + let name = $state(''); + let solfeggioFrequencyId = $state(''); + let subscriptionLevelId = $state(''); + let parentCategoryId = $state(''); + let categoryId = $state(''); - let parentCategoryId = $state( - String( + $effect(() => { + name = String(record.name ?? ''); + solfeggioFrequencyId = String(record.solfeggioFrequencyId ?? ''); + subscriptionLevelId = String(record.subscriptionLevelId ?? ''); + parentCategoryId = String( record.parentCategoryId ?? (record.category as Record | undefined)?.parentId ?? '' - ) - ); - let categoryId = $state(String(record.categoryId ?? '')); + ); + categoryId = String(record.categoryId ?? ''); + }); let parentOptions = $derived(categories.filter((c) => c.parentId === null)); @@ -56,6 +61,8 @@ parentCategoryId = target.value; categoryId = ''; } + + let contentKey = $derived(record.id ?? 'new');
@@ -200,12 +207,14 @@ > Content -
+
+ {#key record.id} -
+ {/key} +
{#if fieldErrors.content}

{fieldErrors.content}

{/if}