fix(pres_mgmt): fix hidden sessions toggle not showing hidden sessions
Three related fixes for the hide/show toggle in Pres Mgmt: 1. ae_events__event_session.ts: remove redundant search_query.and hide filter and instead pass `hidden` to api.search_ae_obj as a URL param. The backend StatusFilterParams defaults to hidden='not_hidden', so without this the API always filtered to hide=0 regardless of intent. 2. pres_mgmt/+page.svelte (SCENARIO 2): capture qry_hidden as a $derived.by dependency so the liveQuery instance is recreated on toggle — prevents hidden sessions briefly appearing before the debounce fires (blink fix). 3. pres_mgmt/+page.svelte (API call): use params.qry_hidden snapshot instead of the live store to prevent race if user toggles during a pending search. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -738,11 +738,6 @@ export async function search__event_session({
|
||||
search_query.and.push({ field: 'enable', op: 'eq', value: 1 });
|
||||
else if (enabled === 'not_enabled')
|
||||
search_query.and.push({ field: 'enable', op: 'eq', value: 0 });
|
||||
if (hidden === 'hidden')
|
||||
search_query.and.push({ field: 'hide', op: 'eq', value: 1 });
|
||||
else if (hidden === 'not_hidden')
|
||||
search_query.and.push({ field: 'hide', op: 'eq', value: 0 });
|
||||
|
||||
if (location_name) {
|
||||
search_query.and.push({
|
||||
field: 'event_location_name',
|
||||
@@ -774,6 +769,7 @@ export async function search__event_session({
|
||||
view,
|
||||
limit,
|
||||
offset,
|
||||
hidden,
|
||||
log_lvl
|
||||
});
|
||||
|
||||
|
||||
@@ -106,6 +106,10 @@ let last_executed_key = ''; // Search Guard Key
|
||||
let lq__event_session_obj_li = $derived.by(() => {
|
||||
const ids = event_session_id_li;
|
||||
const event_id = $events_slct?.event_id;
|
||||
// Captured as a $derived.by dependency so the liveQuery instance is recreated
|
||||
// when qry_hidden changes — ensures SCENARIO 2 immediately reflects the new
|
||||
// filter without waiting for the debounced search to set event_session_id_li.
|
||||
const qry_hidden = pres_mgmt_loc.current.qry_hidden;
|
||||
|
||||
return liveQuery(async () => {
|
||||
// SCENARIO 1: Specific IDs provided (Search Results)
|
||||
@@ -117,6 +121,8 @@ let lq__event_session_obj_li = $derived.by(() => {
|
||||
}
|
||||
|
||||
// SCENARIO 2: Fallback broad search (Only if no active filters)
|
||||
// Applies the same hide filter as the search fast path to prevent hidden
|
||||
// sessions briefly appearing on initial load before the debounce fires.
|
||||
if (
|
||||
event_id &&
|
||||
!pres_mgmt_loc.current.fulltext_search_qry_str &&
|
||||
@@ -126,11 +132,16 @@ let lq__event_session_obj_li = $derived.by(() => {
|
||||
console.log(
|
||||
`Session Page LQ: Fallback search for event: ${event_id}`
|
||||
);
|
||||
return await db_events.session
|
||||
const all = await db_events.session
|
||||
.where('event_id')
|
||||
.equals(event_id)
|
||||
.limit(50)
|
||||
.sortBy('name');
|
||||
return all.filter((s: any) => {
|
||||
if (qry_hidden === 'not_hidden') return !s.hide;
|
||||
if (qry_hidden === 'hidden') return !!s.hide;
|
||||
return true; // 'all'
|
||||
});
|
||||
}
|
||||
|
||||
return [];
|
||||
@@ -310,7 +321,7 @@ async function handle_search_refresh(params: any) {
|
||||
ft_presentation_search_qry_str: qry_str || null,
|
||||
location_name: location_name || null,
|
||||
enabled: pres_mgmt_loc.current.qry_enabled ?? 'enabled',
|
||||
hidden: pres_mgmt_loc.current.qry_hidden ?? 'not_hidden',
|
||||
hidden: params.qry_hidden ?? 'not_hidden',
|
||||
limit: pres_mgmt_loc.current.qry_limit__sessions ?? 100,
|
||||
try_cache: true,
|
||||
log_lvl: 0
|
||||
|
||||
Reference in New Issue
Block a user