Finally getting the event session list to use the LiveQuery with a list of IDs to work correctly. Now replacing old version. Well... maybe some more testing tomorrow.

This commit is contained in:
Scott Idem
2025-05-22 18:19:20 -04:00
parent a75f40bf8d
commit 14f4adeafa
3 changed files with 37 additions and 29 deletions

View File

@@ -77,29 +77,29 @@ let event_session_id_random_li: Array<string> = $state([]);
// OMG THIS WORKS!!! 2024-09-17
// Using the $: seems to have fixed it along with the async await?
let lq__event_session_obj_li = $derived(liveQuery(async () => {
// console.log(`*** LiveQuery: lq__event_session_obj_li *** event_session_id_random_li`, $state.snapshot(event_session_id_random_li));
// if (!event_session_id_random_li) {
// // return [];
// return;
// }
if (event_session_id_random_li.length) {
console.log(`*** LiveQuery: lq__event_session_obj_li *** time to bulkGet`, $state.snapshot(event_session_id_random_li));
let results = await db_events.sessions
.bulkGet(event_session_id_random_li);
// let lq__event_session_obj_li = $derived(liveQuery(async () => {
// // console.log(`*** LiveQuery: lq__event_session_obj_li *** event_session_id_random_li`, $state.snapshot(event_session_id_random_li));
// // if (!event_session_id_random_li) {
// // // return [];
// // return;
// // }
// if (event_session_id_random_li.length) {
// console.log(`*** LiveQuery: lq__event_session_obj_li *** time to bulkGet`, $state.snapshot(event_session_id_random_li));
// let results = await db_events.sessions
// .bulkGet(event_session_id_random_li);
return results;
} else {
let results = await db_events.sessions
.where('event_id')
.equals($events_slct?.event_id ?? '') // null or undefined does not reset things like '' does
.reverse()
.sortBy('name');
// return results;
// } else {
// let results = await db_events.sessions
// .where('event_id')
// .equals($events_slct?.event_id ?? '') // null or undefined does not reset things like '' does
// .reverse()
// .sortBy('name');
return results;
}
// return results;
// }
}));
// }));
let lq__event_location_obj_li = $derived(liveQuery(async () => {
@@ -244,8 +244,8 @@ function process_search_string(search_str: string) {
// like_presentation_search_qry_str: lk_search_str_new,
// like_presenter_search_qry_str: lk_search_str_new,
// params: params,
try_cache: false,
log_lvl: 0,
try_cache: true,
log_lvl: log_lvl,
});
}
@@ -262,8 +262,8 @@ async function handle_search__event_session(
'qry__hidden': $events_loc.pres_mgmt.qry_hidden ?? 'not_hidden',
'qry__limit': $events_loc.pres_mgmt.qry_limit__sessions ?? 35,
},
try_cache=false,
log_lvl=1,
try_cache = true,
log_lvl = 0,
}: {
ft_search_str?: string,
lk_search_str?: string,
@@ -289,7 +289,7 @@ async function handle_search__event_session(
search_delay += 50+random_delay;
}
log_lvl = 2;
// log_lvl = 1;
let count = 0;
let request_loop = setInterval(() => {
@@ -327,7 +327,7 @@ async function handle_search__event_session(
location_name: and_lk_location_name,
params: params,
try_cache: try_cache,
log_lvl: 0,
log_lvl: log_lvl,
})
.then(function (search_results) {
// Processing the results from the search.