diff --git a/app/src/lib/components/ChatBoxAttachment.svelte b/app/src/lib/components/ChatBoxAttachment.svelte index 86df4b4..cc08222 100644 --- a/app/src/lib/components/ChatBoxAttachment.svelte +++ b/app/src/lib/components/ChatBoxAttachment.svelte @@ -33,11 +33,9 @@ continue; } - $uploadedItems$.push({ - id: slug(file.name), - file: file, - loading: true, - errored: false + uploadedItems$.update((files) => { + files.push({ id: slug(file.name), file: file, loading: true, errored: false }); + return files; }); } diff --git a/app/src/lib/components/ChatBoxAttachmentPreview.svelte b/app/src/lib/components/ChatBoxAttachmentPreview.svelte index 8ec9682..597984f 100644 --- a/app/src/lib/components/ChatBoxAttachmentPreview.svelte +++ b/app/src/lib/components/ChatBoxAttachmentPreview.svelte @@ -1,15 +1,15 @@
- {#each selectedFiles as file, index} -
+ {#each validItems as { file, id, loading } (id)} +
+
+ {#if loading} + + {:else} + + {/if} +

{file.name}

@@ -48,7 +57,8 @@ variant="ghost" size="icon" class="text-zinc-400 hover:text-white hover:bg-zinc-700/70" - on:click={() => removeFile(index)} + disabled={loading} + on:click={() => removeFile(id)} >