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:
@@ -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,21 +193,6 @@
|
|||||||
? JSON.parse(localStorage.getItem('lu_country_list') ?? '')
|
? 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)
|
// Load country subdivision lookup list (states/provinces, cached in localStorage)
|
||||||
let lu_country_subdivision_list = $state(
|
let lu_country_subdivision_list = $state(
|
||||||
@@ -214,30 +200,51 @@
|
|||||||
? JSON.parse(localStorage.getItem('lu_country_subdivision_list') ?? '')
|
? JSON.parse(localStorage.getItem('lu_country_subdivision_list') ?? '')
|
||||||
: []
|
: []
|
||||||
);
|
);
|
||||||
if (
|
|
||||||
lu_country_subdivision_list &&
|
onMount(() => {
|
||||||
lu_country_subdivision_list.length > 50 &&
|
// These reads of $state runes must be inside a closure (onMount) to avoid
|
||||||
Math.random() < 0.8
|
// 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(
|
console.log(`Already have country list! ${lu_country_list.length}`);
|
||||||
`Already have country subdivision list! ${lu_country_subdivision_list.length}`
|
} else {
|
||||||
);
|
core_func
|
||||||
} else {
|
.load_ae_obj_li__country({ api_cfg: $ae_api, log_lvl: log_lvl })
|
||||||
core_func
|
.then(function (result) {
|
||||||
.load_ae_obj_li__country_subdivision({ api_cfg: $ae_api, log_lvl: log_lvl })
|
if (result) {
|
||||||
.then(function (result) {
|
lu_country_list = result;
|
||||||
if (result) {
|
localStorage.setItem('lu_country_list', JSON.stringify(result));
|
||||||
lu_country_subdivision_list = result;
|
}
|
||||||
localStorage.setItem(
|
})
|
||||||
'lu_country_subdivision_list',
|
.catch(function (error: any) {
|
||||||
JSON.stringify(result)
|
console.log('No results returned or failed.', error);
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.catch(function (error: any) {
|
if (
|
||||||
console.log('No results returned or failed.', error);
|
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(() => {
|
$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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user