Sorry. Quick save to make something live before deadline.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user