Sorry. Quick save to make something live before deadline.

This commit is contained in:
Scott Idem
2026-03-25 18:31:39 -04:00
parent 1de563203d
commit ab294c2a0b
2 changed files with 49 additions and 10 deletions

View File

@@ -1,4 +1,6 @@
import type { key_val } from '$lib/stores/ae_stores';
import { ae_loc } from '$lib/stores/ae_stores';
import { get } from 'svelte/store';
import { api } from '$lib/api/api';
import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
@@ -198,6 +200,25 @@ async function _refresh_site_domain_background({
properties_to_save: properties_to_save__site_domain,
log_lvl
});
// 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.
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
}));
}
}
return result;
}
} catch (error: any) {