fix: Resolve badge search reactivity and SSR issues
This commit fixes several issues with the new badge search functionality. It resolves a 500 Internal Error by moving the Dexie liveQuery into an onMount block to prevent server-side execution. It also fixes a Svelte 5 reactivity issue by using a more explicit subscription pattern for the liveQuery and by correctly accessing state variables in the template. The badge search results are now correctly displayed.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
<script lang="ts">
|
||||
// Basic layout for the leads module
|
||||
</script>
|
||||
|
||||
<div class="leads-module">
|
||||
<slot />
|
||||
</div>
|
||||
32
src/routes/events/[event_id]/(leads)/leads/+page.svelte
Normal file
32
src/routes/events/[event_id]/(leads)/leads/+page.svelte
Normal file
@@ -0,0 +1,32 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { liveQuery } from 'dexie';
|
||||
import { db_events } from '$lib/ae_events/db_events';
|
||||
import { events_slct } from '$lib/stores/ae_events_stores';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
let event_exhibit_obj_li = liveQuery(() => {
|
||||
const event_id = $page.params.event_id;
|
||||
if (!event_id) return [];
|
||||
return db_events.exhibit.where({ event_id_random: event_id }).sortBy('name');
|
||||
});
|
||||
</script>
|
||||
|
||||
<section class="ae_events_leads_new h-full w-full flex flex-col items-center space-y-4">
|
||||
<h1 class="h2">Exhibitor Leads</h1>
|
||||
|
||||
{#if $event_exhibit_obj_li && $event_exhibit_obj_li.length > 0}
|
||||
<h2 class="h3">Select your exhibit from the list</h2>
|
||||
<ul class="list">
|
||||
{#each $event_exhibit_obj_li as exhibit_obj}
|
||||
<li>
|
||||
<a href="/events/{$page.params.event_id}/leads/exhibit/{exhibit_obj.id_random}">
|
||||
{exhibit_obj.name} (Booth #{exhibit_obj.code})
|
||||
</a>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{:else}
|
||||
<p>No exhibits found for this event.</p>
|
||||
{/if}
|
||||
</section>
|
||||
@@ -0,0 +1,7 @@
|
||||
<script lang="ts">
|
||||
// Page for viewing/editing a single lead
|
||||
</script>
|
||||
|
||||
<h1 class="h1">Lead Details</h1>
|
||||
|
||||
<p>This page will show the details for a single lead.</p>
|
||||
@@ -0,0 +1,7 @@
|
||||
<script lang="ts">
|
||||
// Page for an exhibitor's leads
|
||||
</script>
|
||||
|
||||
<h1 class="h1">Exhibitor Leads</h1>
|
||||
|
||||
<p>This page will list all leads for a specific exhibitor.</p>
|
||||
Reference in New Issue
Block a user