Skip to content

Commit

Permalink
gr.update(value=[]) for gr.File() clears it (#6980)
Browse files Browse the repository at this point in the history
* bug fix

* add changeset

* Update js/file/shared/File.svelte

Co-authored-by: aliabid94 <aabid94@gmail.com>

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: aliabid94 <aabid94@gmail.com>
  • Loading branch information
3 people committed Jan 11, 2024
1 parent 8b5174c commit 523b6bc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/little-knives-switch.md
@@ -0,0 +1,6 @@
---
"@gradio/file": patch
"gradio": patch
---

fix:`gr.update(value=[])` for `gr.File()` clears it
2 changes: 1 addition & 1 deletion js/file/shared/File.svelte
Expand Up @@ -20,7 +20,7 @@
label={label || "File"}
/>

{#if value}
{#if value && (Array.isArray(value) ? value.length > 0 : true)}
<FilePreview {i18n} {selectable} on:select {value} {height} />
{:else}
<Empty unpadded_box={true} size="large"><File /></Empty>
Expand Down
2 changes: 1 addition & 1 deletion js/file/shared/FileUpload.svelte
Expand Up @@ -67,7 +67,7 @@
label={label || "File"}
/>

{#if value}
{#if value && (Array.isArray(value) ? value.length > 0 : false)}
<ModifyUpload {i18n} on:clear={handle_clear} absolute />
<FilePreview {i18n} on:select {selectable} {value} {height} />
{:else}
Expand Down

0 comments on commit 523b6bc

Please sign in to comment.