refactor: clean up try_cache defaults and add SWR to sponsorship loaders

- Remove vestigial try_cache param from generate_qr_code (never used in body)
- Remove vestigial try_cache from ae_core_functions: load_ae_obj_id__site_domain,
  update_ae_obj_id_crud, update_ae_obj_id_crud_v2 (none referenced it in body)
- Add proper SWR pattern to load_ae_obj_id__sponsorship_cfg and
  load_ae_obj_id__sponsorship; change defaults from false to true
- Change load_ae_obj_id__event_file default try_cache from false to true
  (consistent with load_ae_obj_li__event_file)
- Change load_ae_obj_id__hosted_file default try_cache from false to true
  (consistent with load_ae_obj_li__hosted_file)
- Remove stale try_cache arg from element_ae_crud.svelte caller
This commit is contained in:
Scott Idem
2026-03-11 14:57:23 -04:00
parent 50a20ebc44
commit fde3801ea6
6 changed files with 82 additions and 61 deletions

View File

@@ -52,13 +52,11 @@ const ae_promises: key_val = {}; // Promise<any>;
async function load_ae_obj_id__site_domain({
api_cfg,
fqdn,
try_cache = false,
timeout = 7000,
log_lvl = 0
}: {
api_cfg: any;
fqdn: string;
try_cache?: boolean;
timeout?: number;
log_lvl?: number;
}) {
@@ -273,7 +271,6 @@ async function update_ae_obj_id_crud({
field_name,
new_field_value,
params = {},
try_cache = false,
log_lvl = 0
}: {
api_cfg: any;
@@ -282,9 +279,8 @@ async function update_ae_obj_id_crud({
object_reload?: boolean;
field_name: string;
new_field_value: any;
params: any | key_val;
try_cache: boolean;
log_lvl: number;
params?: any | key_val;
log_lvl?: number;
}) {
let patch_result: any = null;
@@ -365,7 +361,6 @@ async function update_ae_obj_id_crud_v2({
field_name,
new_field_value,
params = {},
try_cache = false,
log_lvl = 0
}: {
api_cfg: any;
@@ -375,7 +370,6 @@ async function update_ae_obj_id_crud_v2({
field_name: string;
new_field_value: any;
params?: any | key_val;
try_cache?: boolean;
log_lvl?: number;
}) {
if (log_lvl) {

View File

@@ -12,7 +12,7 @@ export async function load_ae_obj_id__hosted_file({
api_cfg,
hosted_file_id,
view = 'default',
try_cache = false,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any;

View File

@@ -19,7 +19,6 @@ export async function generate_qr_code({
obj_id,
str, // For encoding a string (like a URL) into a QR code.
return_blob = true, // blob or url?
try_cache = false,
log_lvl = 0
}: {
api_cfg: any;
@@ -31,7 +30,6 @@ export async function generate_qr_code({
obj_id?: string;
str?: string;
return_blob?: boolean;
try_cache?: boolean;
log_lvl?: number;
}) {
if (log_lvl) {