Fix archive content upload not patching record after file upload
Svelte 4 store nested property mutations don't call set()/update(), so $effect on $idaa_slct never fired after upload. Replaced store property binds with local $state variables that Svelte 5 proxies track natively. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -49,6 +49,12 @@ let disable_submit_btn = $state(false);
|
||||
|
||||
let slct_hosted_file_kv: key_val = $state({});
|
||||
|
||||
// Local $state for upload bind targets — Svelte 4 store mutations don't trigger $effect,
|
||||
// so we can't bind directly to $idaa_slct.archive_content_obj.* for reactivity.
|
||||
let upload_complete_local: boolean = $state(false);
|
||||
let hosted_file_id_li_local: string[] = $state([]);
|
||||
let hosted_file_obj_li_local: key_val[] = $state([]);
|
||||
|
||||
if ($idaa_slct.archive_content_id) {
|
||||
console.log(
|
||||
`Archive Content ID selected: ${$idaa_slct.archive_content_id}`
|
||||
@@ -354,14 +360,17 @@ async function handle_hosted_files_uploaded(
|
||||
|
||||
$effect(() => {
|
||||
if (
|
||||
$idaa_slct.archive_content_obj?.upload_complete &&
|
||||
$idaa_slct.archive_content_obj?.hosted_file_id_li?.length &&
|
||||
$idaa_slct.archive_content_obj.hosted_file_obj_li?.length
|
||||
upload_complete_local &&
|
||||
hosted_file_id_li_local.length &&
|
||||
hosted_file_obj_li_local.length
|
||||
) {
|
||||
handle_hosted_files_uploaded(
|
||||
$idaa_slct.archive_content_obj.hosted_file_id_li,
|
||||
$idaa_slct.archive_content_obj.hosted_file_obj_li
|
||||
hosted_file_id_li_local,
|
||||
hosted_file_obj_li_local
|
||||
);
|
||||
upload_complete_local = false;
|
||||
hosted_file_id_li_local = [];
|
||||
hosted_file_obj_li_local = [];
|
||||
}
|
||||
});
|
||||
|
||||
@@ -564,18 +573,9 @@ $effect(() => {
|
||||
link_to_type="archive_content"
|
||||
link_to_id={$idaa_slct.archive_content_obj
|
||||
.archive_content_id}
|
||||
bind:hosted_file_id_li={
|
||||
$idaa_slct.archive_content_obj
|
||||
.hosted_file_id_li
|
||||
}
|
||||
bind:hosted_file_obj_li={
|
||||
$idaa_slct.archive_content_obj
|
||||
.hosted_file_obj_li
|
||||
}
|
||||
bind:upload_complete={
|
||||
$idaa_slct.archive_content_obj
|
||||
.upload_complete
|
||||
}
|
||||
bind:hosted_file_id_li={hosted_file_id_li_local}
|
||||
bind:hosted_file_obj_li={hosted_file_obj_li_local}
|
||||
bind:upload_complete={upload_complete_local}
|
||||
log_lvl={1}>
|
||||
{#snippet label()}
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user