feat(leads): standardize exhibit and lead tracking on V3 API and base ID keys

This commit is contained in:
Scott Idem
2026-02-07 18:58:20 -05:00
parent aa5c795287
commit acf69c3deb
7 changed files with 654 additions and 217 deletions

View File

@@ -88,13 +88,15 @@
if (!event_id) return;
if (log_lvl) console.log(`🔎 [Trace] Exhibit Search #${current_search_id}: START (remote=${remote_first}, event=${event_id}, str=${params.str})`);
untrack(() => {
$events_sess.leads.submit_status__search = 'searching';
});
const qry_str = params.str;
// 1. Local Search
// 1. FAST PATH: Local IDB Search
if (!remote_first) {
try {
let local_results = await db_events.exhibit
@@ -135,9 +137,11 @@
});
const local_ids = local_results
.map((e) => String(e.event_exhibit_id))
.map((e) => String(e.id || e.event_exhibit_id))
.filter(Boolean);
if (current_search_id === last_search_id) {
if (log_lvl) console.log(`✅ [Trace] Exhibit Search #${current_search_id}: Local path found ${local_ids.length} items.`);
untrack(() => {
exhibit_id_li = local_ids;
});
@@ -147,7 +151,7 @@
}
}
// 2. Remote Revalidation
// 2. REVALIDATE: API Request
try {
let order_by_li: any = {};
switch (params.sort) {
@@ -180,8 +184,11 @@
if (current_search_id === last_search_id) {
const api_ids = results
.map((e: any) => String(e.event_exhibit_id))
.map((e: any) => String(e.id || e.event_exhibit_id))
.filter(Boolean);
if (log_lvl) console.log(`📦 [Trace] Exhibit Search #${current_search_id}: API revalidation found ${api_ids.length} items.`);
untrack(() => {
exhibit_id_li = api_ids;
$events_sess.leads.submit_status__search = 'done';
@@ -189,6 +196,7 @@
}
} catch (error) {
if (current_search_id === last_search_id) {
console.error('Exhibit revalidation failed:', error);
untrack(() => {
$events_sess.leads.submit_status__search = 'error';
});