box / box/box-ui-elements

ContentUploader: Why is there no `complete` event when an `error` event occurs?

Open
#2,943 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
551
Forks
351
Avg merge
5d 9h
Merged PRs (30d)
31

Description

Say someone is uploading multiple files in a ContentUploader element. If even one file results in an `error` event being fired but all others succeed why is there still no `complete` event firing? The files that did not fail are still uploaded but there's no `complete` event emitted with its useful info that we can capture and still use. `complete` doesn't necessarily equate to `success`. Just that a particular upload set has completed.

I have listeners on each event and would like to still let my users know that some files were uploaded and some had errors.

The use case here is after a successful round of uploading files I'm firing off an xhr request to my server with the `complete` Files array so I can send an email to the people who need to know it happened. However if I have one file of many that results in an error, maybe a bad filename or just a glitch in The Matrix 🐈‍⬛ , then I don't get any information about the successful uploads, just the one file that errors. So I'm left with sending _that_ information to the server instead which could fire off a different email saying "uploads may have happened but something broke so go check anyways" which is an awful user experience.

I'm pondering capturing every upload event and sending an xhr request to the server which will capture all uploads for later processing. But that will have to rely on a periodic event to do the processing since the error event might happen first so it can't trigger the later processing.

IMHO, There really should to be a `complete` event after the uploads are done, whether or not everything was successful. Perhaps it becomes the payload is arrays for successful and error upload file results and the current `complete` event becomes a `success` event if nothing bad happens.

matte

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.