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 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-04-22 09:22:11 -04:00
parent f8e34b10b8
commit e15a26f6c6

View File

@@ -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
});