Skip to content

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

@maciek50322

Description

@maciek50322

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions