From dac7fc99da06b2458408c5cc0bc759046f394a3e Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Mon, 9 Mar 2026 17:53:24 -0400 Subject: [PATCH] feat(idaa/archives): fire-and-forget page load + Create New Archive/Content buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - +page.ts: remove await on archive load so navigation is not blocked; liveQuery renders from Dexie cache immediately, API result updates reactively. Replace error(404) with console.warn — soft failure is correct for IDAA. - ae_idaa_comp__archive_obj_li: add Create New Archive button (trusted+edit_mode only) with in-flight spinner and creating guard to prevent double-submit. Layout adjusted to justify-between to accommodate the new button. - ae_idaa_comp__archive_content_obj_li: add Create New Archive Content button with same spinner/guard pattern; pre-populates original_timezone from parent archive so staff do not need to re-select it for every content item. --- .../(idaa)/archives/[archive_id]/+page.ts | 19 ++--- ...e_idaa_comp__archive_content_obj_li.svelte | 60 ++++++++++++++++ .../ae_idaa_comp__archive_obj_li.svelte | 70 ++++++++++++++++--- 3 files changed, 128 insertions(+), 21 deletions(-) diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.ts b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.ts index 02ccd4cd..43c8a910 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.ts +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.ts @@ -2,7 +2,6 @@ import type { PageLoad } from './$types'; console.log(`ae_p_idaa_archives [archive_id] +page.ts start`); -import { error } from '@sveltejs/kit'; import { browser } from '$app/environment'; import { archives_func } from '$lib/ae_archives/ae_archives_functions'; @@ -27,8 +26,11 @@ export const load = (async ({ params, parent }) => { archive_id ); } - // Load archive object - const load_archive_obj = await archives_func + // NOTE: Fire in background — do NOT await. Newly created archives are already in Dexie + // (saved by create_ae_obj__archive), so the liveQuery renders immediately. For direct + // links or refreshes, the archive loads from the API and Dexie updates reactively. + // Awaiting here blocked the SvelteKit navigation, causing a visible "refresh" delay. + archives_func .load_ae_obj_id__archive({ api_cfg: ae_acct.api, archive_id: archive_id, @@ -40,18 +42,9 @@ export const load = (async ({ params, parent }) => { }) .then((results) => { if (!results) { - error(404, { - message: 'IDAA Archives - Archive not found' - }); - } else { - // ae_acct.slct.post_obj = results; + console.warn(`ae IDAA Archives [archive_id] +page.ts: Archive ${archive_id} not found via API or Cache.`); } }); - - if (log_lvl) { - console.log(`load_archive_obj = `, load_archive_obj); - } - ae_acct.slct.archive_obj = load_archive_obj; } // WARNING: Precaution against shared data between sites and presentations. diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_li.svelte b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_li.svelte index bea2fa5f..3242a821 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_li.svelte +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_li.svelte @@ -22,9 +22,12 @@ slct_trigger } from '$lib/stores/ae_stores'; import { idaa_loc, idaa_sess, idaa_slct } from '$lib/stores/ae_idaa_stores'; + import { archives_func } from '$lib/ae_archives/ae_archives_functions'; import AE_Comp_Hosted_Files_Download_Button from '$lib/ae_core/ae_comp__hosted_files_download_button.svelte'; + let creating = $state(false); // true while create API call is in-flight + let ae_promises: key_val = $state({}); // let ae_tmp: key_val = {}; // let ae_triggers: key_val = {}; @@ -63,6 +66,63 @@
+ {#if $ae_loc.trusted_access && $ae_loc.edit_mode} +
+ +
+ {/if} + {#if $lq__archive_content_obj_li && $lq__archive_content_obj_li.length}