+ {:else}
+
+ test test test
+
{/if}
{#if ae_tmp.show__direct_download}
diff --git a/src/lib/elements/element_manage_event_file_li_direct.svelte b/src/lib/elements/element_manage_event_file_li_direct.svelte
index 91b7f85a..a8c1068e 100644
--- a/src/lib/elements/element_manage_event_file_li_direct.svelte
+++ b/src/lib/elements/element_manage_event_file_li_direct.svelte
@@ -21,16 +21,13 @@
}: Props = $props();
import { liveQuery } from 'dexie';
- import { untrack } from 'svelte';
import type { key_val } from '$lib/stores/ae_stores';
- import { ae_api } from '$lib/stores/ae_stores';
// import { ae_util } from '$lib/ae_utils/ae_utils';
import Element_manage_event_file_li from '$lib/elements/element_manage_event_file_li.svelte';
// import { core_func } from '$lib/ae_core_functions';
import { db_events } from '$lib/ae_events/db_events';
- import { events_func } from '$lib/ae_events_functions';
// import { events_loc, events_sess, events_slct, events_trigger } from '$lib/stores/ae_events_stores';
// export let show_convert_btn: null|boolean = null;
@@ -41,30 +38,26 @@
ae_tmp.show__direct_download = false;
// let ae_triggers: key_val = {};
- // WHY: When a parent page loads with try_cache:false (e.g. presenter detail),
- // the fresh API data (including event_session_type_code) is NOT written to Dexie.
- // The liveQuery below then sees stale Dexie records missing that field, so
- // the PDF→image convert button condition silently fails.
+ // WHY: v_event_file joins event_session only via event_file.event_session_id.
+ // Files with for_type='event_presenter' have event_session_id=NULL on the file record
+ // itself, so event_session_type_code is structurally always NULL from the API for these
+ // files — even if the presenter is in a poster session. Refreshing from the API does not
+ // help; the view cannot join session type for presenter-linked files.
//
- // Using $effect (not onMount) because link_to_id arrives AFTER mount when the
- // parent presenter liveQuery resolves — onMount fires too early and misses it.
- // untrack() prevents the function body's internals from registering as deps.
- $effect(() => {
- if (!link_to_id) return;
- const _id = link_to_id;
- const _type = link_to_type;
- const _cfg = $ae_api;
- untrack(() => {
- events_func.load_ae_obj_li__event_file({
- api_cfg: _cfg,
- for_obj_type: _type,
- for_obj_id: _id,
- enabled: 'all',
- hidden: 'all',
- try_cache: true
- });
- });
- });
+ // Solution: derive the session type via the Dexie chain:
+ // presenter.event_presentation_id → presentation.event_session_id → session.type_code
+ // Sessions are guaranteed in Dexie because the pres_mgmt layout loads inc_session_li:true.
+ let lq__context_session_type_code = $derived(
+ liveQuery(async () => {
+ if (link_to_type !== 'event_presenter' || !link_to_id) return null;
+ const presenter = await db_events.presenter.get(link_to_id);
+ if (!presenter?.event_presentation_id) return null;
+ const presentation = await db_events.presentation.get(presenter.event_presentation_id);
+ if (!presentation?.event_session_id) return null;
+ const session = await db_events.session.get(presentation.event_session_id);
+ return session?.type_code ?? null;
+ })
+ );
let dq__where_val: string = `for_type`;
let dq__where_eq_val = $derived(link_to_type);
@@ -97,6 +90,7 @@
{allow_moderator}
{container_class_li}
{display_mode}
+ context_session_type_code={$lq__context_session_type_code ?? null}
{log_lvl}
/>
{:catch error}