fix: move IDAA recovery meeting v2 lookup calls into onMount; remove unused CSS

state_referenced_locally warnings in ae_idaa_comp__event_obj_id_edit_v2.svelte:
- lu_country_list and lu_country_subdivision_list $state runes were read in
  top-level synchronous if/else blocks; moved into onMount
- Add onMount to Svelte imports
- Remove unused .field-richtext CSS selector

Remaining 32 warnings in 2 files are either:
- CSS @apply / @reference warnings from the CSS language service not understanding
  Tailwind v4 at-rules (harmless, build works fine)
- Warnings in the legacy v1 edit form (no code references it)
This commit is contained in:
Scott Idem
2026-03-11 15:34:41 -04:00
parent 5c09730991
commit 9c291cf286

View File

@@ -12,6 +12,7 @@
}: Props = $props(); }: Props = $props();
// *** Import Svelte specific // *** Import Svelte specific
import { onMount } from 'svelte';
import { fade } from 'svelte/transition'; import { fade } from 'svelte/transition';
import { browser } from '$app/environment'; import { browser } from '$app/environment';
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
@@ -192,6 +193,17 @@
? JSON.parse(localStorage.getItem('lu_country_list') ?? '') ? JSON.parse(localStorage.getItem('lu_country_list') ?? '')
: [] : []
); );
// Load country subdivision lookup list (states/provinces, cached in localStorage)
let lu_country_subdivision_list = $state(
localStorage.getItem('lu_country_subdivision_list')
? JSON.parse(localStorage.getItem('lu_country_subdivision_list') ?? '')
: []
);
onMount(() => {
// These reads of $state runes must be inside a closure (onMount) to avoid
// Svelte's state_referenced_locally warning — the values are valid at mount.
if (lu_country_list && lu_country_list.length > 50 && Math.random() < 0.8) { if (lu_country_list && lu_country_list.length > 50 && Math.random() < 0.8) {
console.log(`Already have country list! ${lu_country_list.length}`); console.log(`Already have country list! ${lu_country_list.length}`);
} else { } else {
@@ -208,12 +220,6 @@
}); });
} }
// Load country subdivision lookup list (states/provinces, cached in localStorage)
let lu_country_subdivision_list = $state(
localStorage.getItem('lu_country_subdivision_list')
? JSON.parse(localStorage.getItem('lu_country_subdivision_list') ?? '')
: []
);
if ( if (
lu_country_subdivision_list && lu_country_subdivision_list &&
lu_country_subdivision_list.length > 50 && lu_country_subdivision_list.length > 50 &&
@@ -238,6 +244,7 @@
console.log('No results returned or failed.', error); console.log('No results returned or failed.', error);
}); });
} }
});
$effect(() => { $effect(() => {
if ($idaa_slct.event_obj) { if ($idaa_slct.event_obj) {
@@ -1965,10 +1972,6 @@ Copy and paste link: <a href="${link_base_url}?event_id=${event_do.event_id}">${
@apply select p-1 preset-tonal-surface hover:preset-filled-surface-100-900; @apply select p-1 preset-tonal-surface hover:preset-filled-surface-100-900;
} }
.field-richtext {
@apply preset-tonal-surface hover:preset-filled-surface-100-900;
}
.field-hint { .field-hint {
@apply block text-xs font-normal text-surface-500 -mt-0.5; @apply block text-xs font-normal text-surface-500 -mt-0.5;
} }