box / box/box-ui-elements

[Uploader] Unable to re-add an individual file that has been cancelled.

Open
#4,395 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
551
Forks
351
Avg merge
5d 9h
Merged PRs (30d)
31

Description

**Environment:**

- Elements version: 25.4.0

**Desktop (please complete the following information):**

- OS: macOS Sequoia
- Browser: Safari, Firefox, Chrome

**Steps to reproduce the problem:**

1. Visit [the uploader doc page](https://developer.box.com/guides/embed/ui-elements/uploader/). It even happens here. Easier than coming up with a demo app.
2. Drop two files on the uploader area. Do not start an upload.
3. Cancel one of them.
4. Drop the same file you just cancelled
5. Scratch your head wondering why the file didn't show up in the list

**What is the expected behavior? (Screenshots can be helpful here)**

The cancelled file should reappear as a item in the item list.

**What went wrong? (Screenshots, console logs, or HAR files can be helpful here)**

The `state.itemIds` object keys ([stored here in the code](https://github.com/box/box-ui-elements/blob/f885f8c2bfc7aaa8cacb2ecb260ae86cc9a38874/src/elements/content-uploader/ContentUploader.tsx#L112)) for the cancelled file were not removed. If a file with a name that matches a key in the `itemIds` object then that file will not be accepted. You can delete the key matching the filename from `state.itemIds`, ignoring the longer file id key for the same file, and it will accept the file into the file list again.

The only way to drop the cancelled file again is to remove all files from the list. This resets the `itemIds` object and so no key collision happens, thus accepting the cancelled file again.

**Link to application or sample code:**

Link to application? How about the docs. :) https://developer.box.com/guides/embed/ui-elements/uploader/

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.