Refresh of lookups is more likely.

This commit is contained in:
Scott Idem
2025-01-13 15:39:10 -05:00
parent 321c48513f
commit 5d6df59ee1

View File

@@ -93,8 +93,10 @@ if ($idaa_slct.event_id) {
console.log(`Event Object started: ${$idaa_slct.event_obj}`);
}
// $ae_loc.lu_time_zone_list = [];
if ($ae_loc.lu_time_zone_list && $ae_loc.lu_time_zone_list.length > 0) {
let lu_time_zone_list = localStorage.getItem('lu_time_zone_list') ? JSON.parse(localStorage.getItem('lu_time_zone_list') ?? '') : [];
// $ae_loc.lu_time_zone_list = []; // Reset the list
// Refresh the list at least 20% of the time.
if ($ae_loc.lu_time_zone_list && $ae_loc.lu_time_zone_list.length > 0 && Math.random() < 0.8) {
console.log('Already have time zone list!', $ae_loc.lu_time_zone_list);
} else {
console.log('No time zone list');
@@ -144,17 +146,17 @@ if ($ae_loc.lu_time_zone_list && $ae_loc.lu_time_zone_list.length > 0) {
// });
}
let lu_country_list = localStorage.getItem('lu_country_list') ? JSON.parse(localStorage.getItem('lu_country_list')) : [];
$ae_loc.lu_country_list = [];
let lu_country_list = localStorage.getItem('lu_country_list') ? JSON.parse(localStorage.getItem('lu_country_list') ?? '') : [];
// $ae_loc.lu_country_list = []; // Reset the list
// Refresh the list at least 20% of the time.
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}`, lu_country_list);
} else {
console.log('No country list');
let lu_country_li_get_promise = core_func.load_ae_obj_li__country({
api_cfg: $ae_api,
log_lvl: 1
log_lvl: log_lvl
})
.then(function (lu_country_li_get_result) {
if (lu_country_li_get_result) {
@@ -173,17 +175,17 @@ if (lu_country_list && lu_country_list.length > 50 && Math.random() > 0.8) {
});
}
let lu_country_subdivision_list = localStorage.getItem('lu_country_subdivision_list') ? JSON.parse(localStorage.getItem('lu_country_subdivision_list')) : [];
$ae_loc.lu_country_subdivision_list = [];
let lu_country_subdivision_list = localStorage.getItem('lu_country_subdivision_list') ? JSON.parse(localStorage.getItem('lu_country_subdivision_list') ?? '') : [];
// $ae_loc.lu_country_subdivision_list = []; // Reset the list
// Refresh the list at least 20% of the time.
if (lu_country_subdivision_list && lu_country_subdivision_list.length > 50 && Math.random() > 0.8) {
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}`, lu_country_subdivision_list);
} else {
console.log('No country subdivision list. Requesting new list.');
let lu_country_subdivision_li_get_promise = core_func.load_ae_obj_li__country_subdivision({
api_cfg: $ae_api,
log_lvl: 1
log_lvl: log_lvl
})
.then(function (lu_country_subdivision_li_get_result) {
/* We need to save the country subdivision list to localStore */
@@ -204,21 +206,6 @@ if (lu_country_subdivision_list && lu_country_subdivision_list.length > 50 && Ma
}
// onMount(() => {
// console.log('** Component Mounted: ** Edit - Event Obj');
// });
// onDestroy(() => {
// console.log('** Component Destroyed: ** Edit - Event Obj');
// });
// afterUpdate(() => {
// console.log('** Component Updated: ** Edit - Event Obj');
// });
$: if ($idaa_slct.event_obj) {
if (log_lvl) {
console.log('Selected Event object changed?', $idaa_slct.event_obj);