Doing general clean up to remove old code and keep removing the _random bits that I find. Bug fix for new hosted files not showing immediately for BB Posts. Just directly updating the selected Post and its linked_li_json.

This commit is contained in:
Scott Idem
2026-02-11 12:39:20 -05:00
parent ae03cbb27f
commit 5bea72f02e
10 changed files with 42 additions and 160 deletions

View File

@@ -9,7 +9,7 @@
let log_lvl: number = $state(1);
// *** Import Svelte specific
import { page } from '$app/state';
// import { page } from '$app/state';
import { browser } from '$app/environment';
// *** Import other supporting libraries
@@ -38,7 +38,7 @@
$idaa_loc.recovery_meetings.search_version++;
}
let event_id_random_li: Array<string> = $state([]);
let event_id_li: Array<string> = $state([]);
let search_debounce_timer: any = null;
let last_search_id = 0;
@@ -96,7 +96,7 @@
// If 'Remote First' is toggled (Admin only), we clear results immediately to show fresh state.
if (remote_first) {
event_id_random_li = [];
event_id_li = [];
}
// Snapshot parameters to ensure the Fast Path and Revalidation are using the same criteria.
@@ -117,8 +117,7 @@
.filter((ev) => {
// Resilient account check
const acct_match =
ev.account_id === account_id ||
ev.account_id_random === account_id;
ev.account_id === account_id;
if (!acct_match) return false;
if (qry_type && ev.type !== qry_type) return false;
@@ -162,7 +161,7 @@
}
local_ids = local_results
.map((e) => String(e.id || e.event_id_random))
.map((e) => String(e.id))
.filter(Boolean);
// Update UI immediately. This eliminates the "white page" during searching.
@@ -171,7 +170,7 @@
console.log(
`[Search #${current_search_id}] Fast Path complete. Found ${local_ids.length} items locally.`
);
event_id_random_li = local_ids;
event_id_li = local_ids;
if (local_ids.length > 0) {
$idaa_sess.recovery_meetings.qry__status = 'done';
}
@@ -228,7 +227,7 @@
});
const api_ids = api_results
.map((e: any) => String(e.id || e.event_id_random))
.map((e: any) => String(e.id))
.filter(Boolean);
// UI PROTECTION: Preserve results if API returns nothing (0 results)
@@ -258,7 +257,7 @@
}
$idaa_slct.event_obj_li = api_results;
event_id_random_li = api_ids;
event_id_li = api_ids;
// Snapshot last used filters for future protection checks
$idaa_sess.recovery_meetings.status_qry__last_request_str =
@@ -283,7 +282,7 @@
// If the API failed (e.g. 400/500), we should NOT preserve results from a
// previous successful search as it's misleading.
// We clear the list so the 'No recovery meetings found' / Error message shows.
event_id_random_li = [];
event_id_li = [];
}
}
}
@@ -312,9 +311,9 @@
show_edit_btn={true}
/>
{#if Array.isArray(event_id_random_li) && event_id_random_li.length}
{#if Array.isArray(event_id_li) && event_id_li.length}
<Comp__event_obj_li_wrapper
{event_id_random_li}
{event_id_li}
link_to_type={'account'}
link_to_id={$ae_loc.account_id}
limit={$idaa_loc.recovery_meetings.qry__limit}