From e15a26f6c65b233ad673afb09ba8c2fc441ec41b Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Wed, 22 Apr 2026 09:22:11 -0400 Subject: [PATCH] fix(launcher): load location files into Dexie on location select/refresh refresh_location_config() was missing inc_file_li:true, so location-level files were never fetched from the API and lq__location_event_file_obj_li always returned empty from Dexie. Files only appeared when Pres Mgmt had previously loaded them on the same device. Also added a reactive $effect so files load immediately when the operator switches rooms, rather than waiting up to 60s for the next timer tick. Co-Authored-By: Claude Sonnet 4.6 --- .../(launcher)/launcher_background_sync.svelte | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte b/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte index 04edbc1c..7567d019 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte @@ -154,6 +154,17 @@ onDestroy(() => { if (timer__file_sync) clearInterval(timer__file_sync); }); +// WHY: refresh_location_config() runs on a 60s timer. Without this effect, +// switching locations leaves the new location's file list empty until the +// next timer tick. Watching event_location_id here fires an immediate fetch +// whenever the operator selects a different room. +$effect(() => { + const location_id = $events_slct.event_location_id; + if (location_id) { + refresh_location_config(); + } +}); + /** * API Refresh: Event */ @@ -440,9 +451,13 @@ async function refresh_location_config() { if (!location_id) return; try { + // WHY: inc_file_li must be true so location-level files reach Dexie. + // Without it, lq__location_event_file_obj_li in the layout finds nothing and + // the location file list in the Launcher menu never renders. await events_func.load_ae_obj_id__event_location({ api_cfg: $ae_api, event_location_id: location_id, + inc_file_li: true, try_cache: true, log_lvl: 0 });