Fixed a file upload and management bug. Trying to get to a good stopping point.

This commit is contained in:
Scott Idem
2025-07-07 18:34:40 -04:00
parent b028bd7b32
commit 32c1899cb6

View File

@@ -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
}
});
</script>