From f297c7c0181ded13b961de7b7b81bd3e3be5d935 Mon Sep 17 00:00:00 2001
From: Scott Idem
Date: Fri, 15 May 2026 11:46:10 -0400
Subject: [PATCH] =?UTF-8?q?fix:=20account=5Fname=20not=20showing=20on=20ev?=
=?UTF-8?q?ents=20page=20=E2=80=94=20stale=20Dexie=20cache=20+=20duplicate?=
=?UTF-8?q?=20assignment?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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
---
src/lib/ae_core/ae_core__site.ts | 38 ++++++++++++++++-------
src/routes/+layout.ts | 4 +--
src/routes/events/+page.svelte | 4 +--
src/routes/events/+page.ts | 2 +-
src/routes/events/[event_id]/+page.svelte | 4 +--
5 files changed, 33 insertions(+), 19 deletions(-)
diff --git a/src/lib/ae_core/ae_core__site.ts b/src/lib/ae_core/ae_core__site.ts
index ba9f67e0..1b9184c2 100644
--- a/src/lib/ae_core/ae_core__site.ts
+++ b/src/lib/ae_core/ae_core__site.ts
@@ -221,23 +221,37 @@ async function _refresh_site_domain_background({
});
// WHY: The fast-path returns stale Dexie cache, then this background refresh
- // runs after the page renders. If cfg_json changed server-side (e.g. a Novi
- // API key was added), the stale cfg is already in $ae_loc. We push the fresh
- // cfg_json into the store here so any layout tracking it (e.g. IDAA Novi
- // verification) gets notified and can retry with the correct config.
+ // runs after the page renders. Push any fields that may have been missing from
+ // the stale cache (e.g. account_name, cfg_json) back into $ae_loc so the UI
+ // reflects the correct values without requiring a second full page reload.
+ const loc_patch: Record = {};
+
if (result.cfg_json) {
const current_cfg = get(ae_loc).site_cfg_json;
- if (
- JSON.stringify(current_cfg) !==
- JSON.stringify(result.cfg_json)
- ) {
- ae_loc.update((loc) => ({
- ...loc,
- site_cfg_json: result.cfg_json
- }));
+ if (JSON.stringify(current_cfg) !== JSON.stringify(result.cfg_json)) {
+ loc_patch.site_cfg_json = result.cfg_json;
}
}
+ if (result.account_name) {
+ const current_name = get(ae_loc).account_name;
+ // Only overwrite the default placeholder — don't stomp a real value.
+ if (!current_name || current_name === 'Account Name Not Set' || current_name === 'Ghost Account') {
+ loc_patch.account_name = result.account_name;
+ }
+ }
+
+ if (result.account_code) {
+ const current_code = get(ae_loc).account_code;
+ if (!current_code || current_code === 'not_set' || current_code === 'ghost') {
+ loc_patch.account_code = result.account_code;
+ }
+ }
+
+ if (Object.keys(loc_patch).length > 0) {
+ ae_loc.update((loc) => ({ ...loc, ...loc_patch }));
+ }
+
return result;
}
} catch (error: any) {
diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts
index 8991c7c2..66b18b1b 100644
--- a/src/routes/+layout.ts
+++ b/src/routes/+layout.ts
@@ -472,8 +472,8 @@ export async function load({ fetch, params, parent, route, url }) {
// });
// }
- ae_loc_init['account_name'] =
- json_data.account_name || 'Account Name Not Set';
+ // account_name is already set above (line ~385). This was a duplicate that
+ // overwrote it with a different fallback string — removed.
// ae_acct['api'] = ae_api_init; // DO NOT USE: This overwrites our isolated clone from line 65
ae_acct['loc'] = ae_loc_init;
diff --git a/src/routes/events/+page.svelte b/src/routes/events/+page.svelte
index c61a0a31..a6616b0a 100644
--- a/src/routes/events/+page.svelte
+++ b/src/routes/events/+page.svelte
@@ -88,7 +88,7 @@ onMount(() => {
{:else if !$ae_loc.trusted_access}
Restricted Access
- You access to the presentation management system is limited.
+ Your access to the presentation management system is limited.
{/if}