feat(offline): implement Dexie fallbacks and fix type stability in Events module
- Offline Resilience: Added local Dexie fallbacks to load_ae_obj_id__* and load_ae_obj_li__* functions for Events, Sessions, Locations, Exhibits, and Badges. - Type Safety: Standardized ae_Event and ae_EventSession interfaces in ae_types.ts; resolved Promise assignment errors in load functions (+page.ts). - Bug Fixes: Corrected duplication in ae_events__event_location.ts and ae_events__event_badge_template.ts; fixed missing try_cache parameters. - UI Stability: Fixed Dexie LiveQuery subscription pattern in bulk print view and ensured proper property access in layout load functions.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
import { ae_api } from '$lib/stores/ae_stores';
|
||||
import { events_slct } from '$lib/stores/ae_events_stores';
|
||||
import Comp_badge_obj_view from '../[badge_id]/ae_comp__badge_obj_view.svelte';
|
||||
import type { ae_EventBadge } from '$lib/types/ae_types';
|
||||
|
||||
interface Props {
|
||||
data: any; // PageData from SvelteKit
|
||||
@@ -17,8 +18,8 @@
|
||||
|
||||
let lq__filtered_badges = $derived(
|
||||
liveQuery(async () => {
|
||||
const filters: { printed_status?: string; type_code?: string } = {};
|
||||
if (printed_status_filter) filters.printed_status = printed_status_filter;
|
||||
const filters: { printed_status?: "all" | "printed" | "not_printed"; type_code?: string } = {};
|
||||
if (printed_status_filter) filters.printed_status = printed_status_filter as any;
|
||||
if (badge_type_code_filter) filters.type_code = badge_type_code_filter;
|
||||
|
||||
// Fetch badges using the search function, with a high limit for bulk printing
|
||||
@@ -29,7 +30,7 @@
|
||||
...filters,
|
||||
log_lvl: 0
|
||||
});
|
||||
return result || [];
|
||||
return (result || []) as ae_EventBadge[];
|
||||
})
|
||||
);
|
||||
|
||||
@@ -76,12 +77,10 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{#await lq__filtered_badges}
|
||||
<p>Loading badges for printing...</p>
|
||||
{:then badges_to_print}
|
||||
{#if badges_to_print.length > 0}
|
||||
{#if $lq__filtered_badges}
|
||||
{#if $lq__filtered_badges.length > 0}
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
{#each badges_to_print as badge_obj (badge_obj.event_badge_id_random)}
|
||||
{#each $lq__filtered_badges as badge_obj (badge_obj.event_badge_id_random)}
|
||||
<div class="badge-print-container">
|
||||
<Comp_badge_obj_view
|
||||
{event_id}
|
||||
@@ -96,7 +95,7 @@
|
||||
{:else}
|
||||
<p>No badges found matching your criteria for printing.</p>
|
||||
{/if}
|
||||
{:catch error}
|
||||
<p class="text-error-500">Error loading badges: {error.message}</p>
|
||||
{/await}
|
||||
{:else}
|
||||
<p>Loading badges for printing...</p>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user