diff --git a/src/routes/events/[event_id]/(launcher)/launcher_presentation_view.svelte b/src/routes/events/[event_id]/(launcher)/launcher_presentation_view.svelte index 1e6eb572..93ed660b 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_presentation_view.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_presentation_view.svelte @@ -12,10 +12,18 @@ 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 + // Staggered Load: Trigger deep fetch only when the presentation ID changes. + // WHY: The SWR pattern in load_ae_obj_id__event_presentation always fires a + // background API call that writes to Dexie. That Dexie write triggers the + // liveQuery upstream, which updates the lq__event_presentation_obj prop, + // which re-runs this $effect — creating an infinite loop that crashes the tab. + // Guarding on last_loaded_id breaks the loop: the effect only makes an API + // call when we see a new presentation ID, not on every downstream prop update. + let last_loaded_id: string | null = null; $effect(() => { const id = lq__event_presentation_obj?.event_presentation_id; - if (id) { + if (id && id !== last_loaded_id) { + last_loaded_id = id; events_func.load_ae_obj_id__event_presentation({ api_cfg: $ae_api, event_presentation_id: id,