From 2eb4ddf1eb09e0cc6efc66f7f0588ccf68799328 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Mon, 7 Jul 2025 17:16:23 -0400 Subject: [PATCH] Sort of bug fix for file uploads --- .../bb/ae_idaa_comp__post_obj_id_edit.svelte | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_obj_id_edit.svelte b/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_obj_id_edit.svelte index dcb64655..0d3f035c 100644 --- a/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_obj_id_edit.svelte +++ b/src/routes/idaa/(idaa)/bb/ae_idaa_comp__post_obj_id_edit.svelte @@ -270,22 +270,23 @@ async function handle_delete_post_obj( async function handle_hosted_files_uploaded(hosted_file_id_li: string[], hosted_file_obj_li: any[]) { console.log(`*** handle_hosted_files_uploaded() *** ${hosted_file_id_li}`); + // NOTE: No longer directly updating the $idaa_slct.post_obj.hosted_file_obj_li. This will be updated when the PATCH API for Post update finishes. // We need to add the record to the $idaa_slct.post_obj.hosted_file_obj_li and then update the post_obj.linked_li_json with the new value. + let new_linked_li_json = $idaa_slct.post_obj.linked_li_json ?? []; if (!$idaa_slct.post_obj.linked_li_json) { - $idaa_slct.post_obj.linked_li_json = hosted_file_obj_li; + // $idaa_slct.post_obj.linked_li_json = hosted_file_obj_li; + new_linked_li_json = hosted_file_obj_li; } else { - // $idaa_slct.post_obj.linked_li_json.append(hosted_file_obj_li); - $idaa_slct.post_obj.linked_li_json.push(...hosted_file_obj_li); + // $idaa_slct.post_obj.linked_li_json.push(...hosted_file_obj_li); + new_linked_li_json = [...new_linked_li_json]; } prom_api__post_obj = posts_func.update_ae_obj__post({ api_cfg: $ae_api, post_id: $idaa_slct.post_id, data_kv: { - linked_li_json: JSON.stringify($idaa_slct.post_obj.linked_li_json), - // hosted_file_id_random: hosted_file_obj_li[0].hosted_file_id_random, - // filename: hosted_file_obj_li[0].filename, - // file_extension: hosted_file_obj_li[0].extension, + // linked_li_json: JSON.stringify($idaa_slct.post_obj.linked_li_json), + linked_li_json: JSON.stringify(new_linked_li_json), }, log_lvl: log_lvl })