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();
// *** Import Svelte specific
import { onMount } from 'svelte';
import { fade } from 'svelte/transition';
import { browser } from '$app/environment';
import { goto } from '$app/navigation';
@@ -192,21 +193,6 @@
? JSON.parse(localStorage.getItem('lu_country_list') ?? '')
: []
);
if (lu_country_list && lu_country_list.length > 50 && Math.random() < 0.8) {
console.log(`Already have country list! ${lu_country_list.length}`);
} else {
core_func
.load_ae_obj_li__country({ api_cfg: $ae_api, log_lvl: log_lvl })
.then(function (result) {
if (result) {
lu_country_list = result;
localStorage.setItem('lu_country_list', JSON.stringify(result));
}
})
.catch(function (error: any) {
console.log('No results returned or failed.', error);
});
}
// Load country subdivision lookup list (states/provinces, cached in localStorage)
let lu_country_subdivision_list = $state(
@@ -214,30 +200,51 @@
? JSON.parse(localStorage.getItem('lu_country_subdivision_list') ?? '')
: []
);
if (
lu_country_subdivision_list &&
lu_country_subdivision_list.length > 50 &&
Math.random() < 0.8
) {
console.log(
`Already have country subdivision list! ${lu_country_subdivision_list.length}`
);
} else {
core_func
.load_ae_obj_li__country_subdivision({ api_cfg: $ae_api, log_lvl: log_lvl })
.then(function (result) {
if (result) {
lu_country_subdivision_list = result;
localStorage.setItem(
'lu_country_subdivision_list',
JSON.stringify(result)
);
}
})
.catch(function (error: any) {
console.log('No results returned or failed.', error);
});
}
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) {
console.log(`Already have country list! ${lu_country_list.length}`);
} else {
core_func
.load_ae_obj_li__country({ api_cfg: $ae_api, log_lvl: log_lvl })
.then(function (result) {
if (result) {
lu_country_list = result;
localStorage.setItem('lu_country_list', JSON.stringify(result));
}
})
.catch(function (error: any) {
console.log('No results returned or failed.', error);
});
}
if (
lu_country_subdivision_list &&
lu_country_subdivision_list.length > 50 &&
Math.random() < 0.8
) {
console.log(
`Already have country subdivision list! ${lu_country_subdivision_list.length}`
);
} else {
core_func
.load_ae_obj_li__country_subdivision({ api_cfg: $ae_api, log_lvl: log_lvl })
.then(function (result) {
if (result) {
lu_country_subdivision_list = result;
localStorage.setItem(
'lu_country_subdivision_list',
JSON.stringify(result)
);
}
})
.catch(function (error: any) {
console.log('No results returned or failed.', error);
});
}
});
$effect(() => {
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;
}
.field-richtext {
@apply preset-tonal-surface hover:preset-filled-surface-100-900;
}
.field-hint {
@apply block text-xs font-normal text-surface-500 -mt-0.5;
}