I am done. Just saving things for the night. Not a good day.

This commit is contained in:
Scott Idem
2026-02-25 20:17:03 -05:00
parent 95a56d25bf
commit b1162b9f08
6 changed files with 267 additions and 16 deletions

View File

@@ -97,6 +97,10 @@
let last_executed_key = ''; // Search Guard Key
// Stable LiveQuery Pattern (Aether UI V3)
// Use `$derived.by(() => ...)` to build a stable observable instance from
// explicit, plain dependencies (`event_session_id_li`, `event_id`). This
// ensures the `liveQuery` is recreated only when those inputs change and
// avoids accidental recreation from surrounding reactive state.
let lq__event_session_obj_li = $derived.by(() => {
const ids = event_session_id_li;
const event_id = $events_slct?.event_id;

View File

@@ -21,10 +21,19 @@
import Session_page_menu from './session_page_menu.svelte';
import Comp_event_presentation_obj_li from '../../../../ae_comp__event_presentation_obj_li.svelte';
// STABILITY FIX: Use URL params directly for queries.
// STABILITY FIX: Capture URL params as plain constants for the liveQuery
// closures so the observable sees a stable identifier value. Capturing
// the raw `data.params` or a reactive store reference here can lead to
// the liveQuery being recreated or seeing transient values on cold-start.
const url_session_id = data.params.session_id;
const url_event_id = data.params.event_id;
// KNOWN ISSUE (TODO): This page currently depends on related records
// (presentations, hosted files, presenters) already existing in IndexedDB.
// On a cold start (empty IDB) the dependent LQs may not re-run in the
// expected order and the UI can require manual refreshes. Do NOT copy
// this pattern for critical views until the refactor is implemented.
// Sync stores in the background
let ae_acct = $derived(data[data.account_id]);
$effect(() => {
@@ -89,7 +98,7 @@
</svelte:head>
<section class="ae_events_pres_mgmt_event_session container mx-auto py-1 px-2 pb-16 space-y-6">
<!-- Pass observable STORES to child components (they use $) -->
<Session_page_menu {data} {lq__event_session_obj} {lq__auth__event_presenter_obj} />
@@ -105,11 +114,13 @@
<!-- Presentation List Section -->
<div class="w-full">
<!--
CRITICAL FIX: Use the pre-loaded data (data.initial_session_obj) as a fallback
until the liveQuery store ($lq...) emits its first value.
This guarantees immediate rendering on first load.
-->
<!--
CRITICAL FIX: Use the pre-loaded data (data.initial_session_obj) as a fallback
until the `liveQuery` store ($lq...) emits its first value. This avoids
a blank first-draw when IndexedDB is empty on a cold start — the LQ
will take over once the DB write completes. Prefer blocking loads
where possible; use this fallback when you must load asynchronously.
-->
<Comp_event_presentation_obj_li
lq__event_presentation_obj_li={$lq__event_presentation_obj_li ?? data.initial_session_obj?.event_presentation_li ?? []}
{log_lvl}

View File

@@ -73,6 +73,10 @@
// Stable LiveQuery Pattern (Aether UI V3)
// Re-wrapped in $derived to ensure the observable instance remains stable
// unless the underlying dependencies (ids, search context) change.
// Important: keep the `liveQuery` closure free of transient reactive
// references — capture stable values (ids, search keys) so the observable
// isn't recreated unnecessarily on every render. Use `search_id_li` or
// other plain arrays/values as explicit dependencies.
let lq__journal_entry_obj_li = $derived(
liveQuery(async () => {
const ids = search_id_li;