Enhance: Implement exhaustive background caching and recursive data loading
- Implemented aggressive room-wide background caching engine in LauncherBackgroundSync.svelte. - Added inc_file_li and inc_all_file_li support to Event and Event Location object loaders for total room coverage. - Switched to proven V1 download path (/hosted_file/) to resolve V3 CRUD binary delivery issues. - Optimized Electron bridge with download locking and flat-hash storage matching legacy 'perfect' logic. - Standardized all Electron IPC methods and parameters to snake_case. - Added visual sync progress indicator for room caching status.
This commit is contained in:
@@ -10,6 +10,7 @@ import { load_ae_obj_li__event_device } from './ae_events__event_device';
|
||||
import { load_ae_obj_li__event_location } from './ae_events__event_location';
|
||||
import { load_ae_obj_li__event_session } from './ae_events__event_session';
|
||||
import { load_ae_obj_li__event_badge_template } from '$lib/ae_events/ae_events__event_badge_template';
|
||||
import { load_ae_obj_li__event_file } from '$lib/ae_events/ae_events__event_file';
|
||||
|
||||
const ae_promises: key_val = {};
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { api } from '$lib/api/api';
|
||||
import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
|
||||
import { db_events } from '$lib/ae_events/db_events';
|
||||
import type { ae_EventLocation } from '$lib/types/ae_types';
|
||||
import { load_ae_obj_li__event_file } from '$lib/ae_events/ae_events__event_file';
|
||||
|
||||
const ae_promises: key_val = {};
|
||||
|
||||
@@ -12,12 +13,18 @@ export async function load_ae_obj_id__event_location({
|
||||
api_cfg,
|
||||
event_location_id,
|
||||
view = 'default',
|
||||
inc_file_li = false,
|
||||
inc_session_li = false,
|
||||
inc_all_file_li = false,
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
event_location_id: string;
|
||||
view?: string;
|
||||
inc_file_li?: boolean;
|
||||
inc_session_li?: boolean;
|
||||
inc_all_file_li?: boolean;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventLocation | null> {
|
||||
@@ -58,7 +65,11 @@ export async function load_ae_obj_id__event_location({
|
||||
}
|
||||
}
|
||||
|
||||
return ae_promises.load__event_location_obj || null;
|
||||
if (!ae_promises?.load__event_location_obj) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return await _handle_nested_loads(ae_promises.load__event_location_obj, { api_cfg, inc_file_li, log_lvl });
|
||||
}
|
||||
|
||||
// Updated 2026-01-20 to V3
|
||||
@@ -66,6 +77,7 @@ export async function load_ae_obj_li__event_location({
|
||||
api_cfg,
|
||||
for_obj_type = 'event',
|
||||
for_obj_id,
|
||||
inc_file_li = false,
|
||||
enabled = 'enabled',
|
||||
hidden = 'not_hidden',
|
||||
limit = 100,
|
||||
@@ -82,6 +94,7 @@ export async function load_ae_obj_li__event_location({
|
||||
api_cfg: any;
|
||||
for_obj_type?: string;
|
||||
for_obj_id: string;
|
||||
inc_file_li?: boolean;
|
||||
enabled?: 'enabled' | 'all' | 'not_enabled';
|
||||
hidden?: 'hidden' | 'all' | 'not_hidden';
|
||||
limit?: number;
|
||||
@@ -136,9 +149,35 @@ export async function load_ae_obj_li__event_location({
|
||||
}
|
||||
}
|
||||
|
||||
if (ae_promises.load__event_location_obj_li) {
|
||||
for (const location of ae_promises.load__event_location_obj_li) {
|
||||
await _handle_nested_loads(location, { api_cfg, inc_file_li, log_lvl });
|
||||
}
|
||||
}
|
||||
|
||||
return ae_promises.load__event_location_obj_li || [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle nested data loads for a single location object.
|
||||
*/
|
||||
async function _handle_nested_loads(location_obj: any, { api_cfg, inc_file_li, log_lvl }: any) {
|
||||
const current_location_id = location_obj.event_location_id_random || location_obj.event_location_id || location_obj.id;
|
||||
|
||||
if (inc_file_li) {
|
||||
location_obj.event_file_li = await load_ae_obj_li__event_file({
|
||||
api_cfg,
|
||||
for_obj_type: 'event_location',
|
||||
for_obj_id: current_location_id,
|
||||
enabled: 'all',
|
||||
limit: 25,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
|
||||
return location_obj;
|
||||
}
|
||||
|
||||
// Updated 2026-01-20 to V3
|
||||
export async function create_ae_obj__event_location({
|
||||
api_cfg,
|
||||
|
||||
Reference in New Issue
Block a user