Files
OSIT-AE-App-Svelte/src/routes/events/+page.ts
Scott Idem f297c7c018 fix: account_name not showing on events page — stale Dexie cache + duplicate assignment
Two Svelte-side bugs causing account_name to always show 'Account Name Not Set':

1. ae_core__site.ts: background site_domain refresh only pushed cfg_json back
   into $ae_loc after a stale cache hit. Now also pushes account_name and
   account_code when the store holds a placeholder value.

2. +layout.ts: duplicate ae_loc_init['account_name'] assignment at line ~475
   was overwriting the correct one at line ~385 with a different fallback string
   ('Account Name Not Set' vs 'Ghost Account'). Removed the duplicate.

Also includes user-intentional changes during testing:
- events/+page.svelte: typo fix ('You access' -> 'Your access'); Pres Mgmt /
  Launcher / Badges / Leads buttons now gated on trusted_access && edit_mode
- events/+page.ts: event list limit 25 -> 7
- events/[event_id]/+page.svelte: user edit
2026-05-15 11:46:10 -04:00

52 lines
1.4 KiB
TypeScript

/** @type {import('./$types').PageLoad} */
import { browser } from '$app/environment';
import { events_func } from '$lib/ae_events/ae_events_functions';
export async function load({ parent }) {
const log_lvl: number = 0;
const parent_data = await parent();
const account_id = parent_data.account_id;
const ae_acct = parent_data[account_id];
// const event_id = ae_acct.slct.event_id; // From root +layout.ts
// if (!event_id) {
// if (log_lvl) {
// console.log(`INFO: events +layout.ts: The event_id was not found in the parent_data.`);
// }
// }
if (browser) {
if (log_lvl) console.log(`ae_events +page.ts (Non-Blocking Refresh)`);
// if (event_id) {
// // Refresh the specific selected event
// events_func.load_ae_obj_id__event({
// api_cfg: ae_acct.api,
// event_id: event_id,
// log_lvl: log_lvl
// });
// }
// Refresh the list of events for the account
events_func.load_ae_obj_li__event({
api_cfg: ae_acct.api,
for_obj_type: 'account',
for_obj_id: account_id,
// inc_session_li: false,
hidden: 'all', // 'not_hidden'
enabled: 'enabled',
limit: 7,
try_cache: true,
log_lvl: log_lvl
});
}
parent_data[account_id] = ae_acct;
return parent_data;
}