perf(launcher): implement staggered data loading for sessions and presentations

- Optimized session list load to be shell-only, preventing initial request storms.\n- Moved deep data fetching (presenters/files) into the Presentation component level using Svelte effects.\n- Deferred child collection lookups until components are rendered in the DOM.\n- Fixed ae_api import in launcher_presentation_view.\n- Hardened background refresh logic to respect requested views.
This commit is contained in:
Scott Idem
2026-02-10 17:30:30 -05:00
parent 8a05e48514
commit be53e12d63
4 changed files with 51 additions and 6 deletions

View File

@@ -153,9 +153,13 @@ export async function load_ae_obj_li__event_presentation({
_refresh_presentation_li_background({ api_cfg, for_obj_type, for_obj_id, inc_file_li, inc_presenter_li, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl: 0 });
// Warm cache for nested loads in the background (FIRE AND FORGET)
// DEPRECATED Optimization: Don't fire child loads for every item in a list here.
// Let the specific Presentation component handle its own children to stagger requests.
/*
cached_li.forEach(p => {
_handle_nested_loads(p, { api_cfg, inc_file_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl: 0 });
});
*/
return cached_li;
}

View File

@@ -198,7 +198,8 @@ export async function load_ae_obj_li__event_session({
// Background refresh (non-blocking)
_refresh_session_li_background({
api_cfg, for_obj_type, for_obj_id, view,
inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li,
// Optimization: Disable nested loads for list members to prevent request storms
inc_file_li: false, inc_all_file_li: false, inc_presentation_li: false, inc_presenter_li: false,
enabled, hidden, limit, offset, order_by_li, try_cache,
log_lvl: log_lvl > 1 ? log_lvl : 0
});
@@ -231,6 +232,14 @@ async function _refresh_session_li_background({ api_cfg, for_obj_type, for_obj_i
await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'session', obj_li: processed, properties_to_save, log_lvl });
if (log_lvl) console.log(`💾 [Trace] _refresh_session_li: Saved to IDB cache.`);
}
// Fire nested loads for each session only if explicitly requested (usually only for single objects)
if (inc_file_li || inc_presentation_li) {
processed.forEach(s => {
_handle_nested_loads(s, { api_cfg, inc_file_li, inc_all_file_li, inc_presentation_li, inc_presenter_li, enabled, hidden, limit, offset, try_cache, log_lvl: 0 });
});
}
return processed;
}
} catch (e) {

View File

@@ -53,10 +53,10 @@ export async function load({ params, parent, url }) {
api_cfg: ae_acct.api,
for_obj_type: 'event_location',
for_obj_id: event_location_id,
inc_file_li: true,
inc_all_file_li: true,
inc_presentation_li: true,
inc_presenter_li: true,
inc_file_li: false, // Optimized: Shell load for lists
inc_all_file_li: false,
inc_presentation_li: false, // Optimized: Shell load for lists
inc_presenter_li: false,
enabled: 'enabled',
hidden: 'all',
view: 'alt', // Standardized View for file counts and extended metadata
@@ -69,6 +69,22 @@ export async function load({ params, parent, url }) {
);
}
const session_id = url.searchParams.get('session_id');
if (browser && session_id) {
if (log_lvl) console.log(`Triggering deep load for session_id: ${session_id}`);
events_func.load_ae_obj_id__event_session({
api_cfg: ae_acct.api,
event_session_id: session_id,
inc_file_li: true,
inc_all_file_li: true,
inc_presentation_li: true,
inc_presenter_li: true,
view: 'alt',
try_cache: true,
log_lvl: 0
});
}
// WARNING: Precaution against shared data between sites and sessions.
data[account_id] = ae_acct;

View File

@@ -7,10 +7,26 @@
import { liveQuery } from 'dexie';
import { db_events } from '$lib/ae_events/db_events';
import { ae_loc } from '$lib/stores/ae_stores';
import { ae_loc, ae_api } from '$lib/stores/ae_stores';
import { events_loc, events_sess } from '$lib/stores/ae_events_stores';
import { events_func } from '$lib/ae_events_functions';
import Event_launcher_file_cont from './launcher_file_cont.svelte';
// Staggered Load: Trigger deep fetch only when component is active
$effect(() => {
const id = lq__event_presentation_obj?.event_presentation_id;
if (id) {
events_func.load_ae_obj_id__event_presentation({
api_cfg: $ae_api,
event_presentation_id: id,
inc_file_li: true,
inc_presenter_li: true,
try_cache: true,
log_lvl: 0
});
}
});
// Event File (Directly linked to presentation)
let lq__event_file_obj_li = $derived(
liveQuery(async () => {