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 5da205e8..c3e75957 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 @@ -272,13 +272,16 @@ async function handle_hosted_files_uploaded(hosted_file_id_li: string[], hosted_ // 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 ?? []; + // let new_linked_li_json = [...$idaa_slct.post_obj.linked_li_json ?? {}]; // Initialize with existing linked_li_json or an empty array + let new_linked_li_json = $idaa_slct.post_obj.linked_li_json ?? []; // Initialize with existing linked_li_json or an empty array if (!$idaa_slct.post_obj.linked_li_json) { // $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.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]; + // new_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({ @@ -370,6 +373,7 @@ $effect(() => { $effect(() => { if (upload_complete && hosted_file_id_li?.length && hosted_file_obj_li?.length) { handle_hosted_files_uploaded(hosted_file_id_li, hosted_file_obj_li); + upload_complete = false; // Reset the upload complete flag } });