feat(events): restore inc_file_counts opt-in, session list layout + button polish

- Add `inc_file_counts` flag to `load_ae_obj_id__event_session` — maps to
  backend alt view (v_event_session_w_file_count) when true; default stays
  lightweight. Callers never pass raw view names.
- Preserve-on-write fallback in `_refresh_session_id_background` keeps
  cached file_count/file_count_all if API response omits them.
- Session detail +page.ts uses `inc_file_counts: true` so SvelteKit prefetch
  no longer clobbers counts via bulkPut on hover.
- Remove explicit `view: 'alt'` from launcher +page.ts (now invalid param).
- Session list link: flex-1 + min-w-0 for full-row width; name flex-1 pushes
  badge group right; code + file_count stacked in flex-col items-end.
- Hover styling: button-like appearance with slow fade-out (duration-500) /
  fast snap-in (hover:duration-150).
- Session +page.svelte: use url_session_id (string) for link_to_id props and
  auth__kv.session[] index — fixes TS type error from number|undefined.
- IDAA layout: dormant tech notice banner (guarded by 1==3, remove when ready).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-04-01 16:38:13 -04:00
parent 214fca3713
commit d12a4bf71f
7 changed files with 170 additions and 30 deletions

View File

@@ -20,9 +20,9 @@ export async function load_ae_obj_id__event_session({
inc_all_file_li = false,
inc_presentation_li = false,
inc_presenter_li = false,
inc_file_counts = false,
enabled = 'enabled',
hidden = 'not_hidden',
view = 'default',
limit = 100,
offset = 0,
try_cache = true,
@@ -34,14 +34,18 @@ export async function load_ae_obj_id__event_session({
inc_all_file_li?: boolean;
inc_presentation_li?: boolean;
inc_presenter_li?: boolean;
// When true, uses v_event_session_w_file_count (backend 'alt' view) which includes
// file_count / file_count_all. Default false — the base view is cheaper and sufficient
// for most callers. Use true when the caller needs counts (e.g. session detail page load).
inc_file_counts?: boolean;
enabled?: 'enabled' | 'all' | 'not_enabled';
hidden?: 'hidden' | 'all' | 'not_hidden';
view?: string;
limit?: number;
offset?: number;
try_cache?: boolean;
log_lvl?: number;
}): Promise<ae_EventSession | null> {
const view = inc_file_counts ? 'alt' : 'default';
const start_time = performance.now();
if (log_lvl) {
console.log(
@@ -178,6 +182,26 @@ async function _refresh_session_id_background({
`📦 [Trace] _refresh_session_id: Received from API at ${elapsed}ms (id=${processed_obj.id})`
);
// PRESERVE AGGREGATE COUNTS: The individual session API view (view=default)
// does not compute file_count / file_count_all — those come from the list
// view SQL query. bulkPut replaces the full IDB record, so if we write
// undefined here we clobber the counts the list search already stored.
// WHY: SvelteKit link prefetching triggers this path on hover over session
// links in the search results list, causing the file count badge to blip.
// FIX: Read the cached counts and keep them if the API didn't return new ones.
if (try_cache && (processed_obj.file_count_all == null || processed_obj.file_count == null)) {
try {
const cached_id = processed_obj.id || processed_obj.event_session_id;
const cached = cached_id ? await db_events.session.get(cached_id) : null;
if (cached) {
if (processed_obj.file_count_all == null && cached.file_count_all != null)
processed_obj.file_count_all = cached.file_count_all;
if (processed_obj.file_count == null && cached.file_count != null)
processed_obj.file_count = cached.file_count;
}
} catch (_) { /* non-critical — best-effort count preservation */ }
}
if (try_cache) {
await db_save_ae_obj_li__ae_obj({
db_instance: db_events,

View File

@@ -43,6 +43,7 @@ export interface PresMgmtLocState {
show_content__session_search_room_name: boolean;
show_content__session_view: string | null;
show_content__session_qr: boolean;
hide__session_code: boolean;
hide__session_msg: boolean;
hide__session_poc: boolean;
hide__session_poc_biography: boolean;
@@ -159,6 +160,7 @@ export const pres_mgmt_loc_defaults: PresMgmtLocState = {
show_content__session_search_room_name: false,
show_content__session_view: null,
show_content__session_qr: false,
hide__session_code: true, // Default hidden; toggle in ae_comp__events_menu_opts to show
hide__session_msg: true,
hide__session_poc: true,
hide__session_poc_biography: true,