kobalte icon indicating copy to clipboard operation
kobalte copied to clipboard

Can't add same file to `FileField` just after removing it

Open maciek50322 opened this issue 9 months ago • 0 comments

Describe the bug After deleting file from field, trying to add the same file doesn't work.

To Reproduce Steps to reproduce the behavior:

  1. Use something like that (has delete triggers)
    <FileField>
      <FileField.Trigger>
      Choose
      </FileField.Trigger>
      <FileField.HiddenInput />
      <FileField.ItemList>
        {(file) => {
          return (
            <FileField.Item>
              <FileField.ItemName />
              <FileField.ItemDeleteTrigger>
                  DELETE
              </FileField.ItemDeleteTrigger>
            </FileField.Item>
          );
        }}
      </FileField.ItemList>
    </FileField>
    
  2. Add single file, it shows up
  3. Click delete trigger, it hides
  4. Add the same single file, nothing shows up

Expected behavior At step 4 same item should show up. That's from simple <input type="file" /> behaviour, the input could just be reset after each add.

Aside from this, idk if it's possible but... Same file can be added twice if there was some file added in between. With the new behaviour it would be possible to add same file without anything in between. Could there be mechanism to detect if file was already added, and if so just skip it?

maciek50322 avatar Mar 17 '25 13:03 maciek50322