uppy icon indicating copy to clipboard operation
uppy copied to clipboard

Events sometimes emitted with undefined file

Open mifi opened this issue 2 years ago • 2 comments

This has caused many errors like «cannot read properies of undefined» in the wild. I think we should prevent events from being emitted after a file has been set to undefined. See #3811

Event that sometimes get emitted with file argument undefined:

  • [ ] upload-error
  • [ ] upload-started
  • [ ] upload-progress
  • [ ] upload-success
  • [ ] preprocess-progress
  • [ ] preprocess-complete
  • [ ] postprocess-progress
  • [ ] postprocess-complete
  • [ ] dashboard:file-edit-complete
  • [ ] file-added
  • [ ] file-removed

So we need to search for all occurrences of each of these, and make sure that we don't emit an undefined file argument.

For example here: https://github.com/transloadit/uppy/blob/3121fae11b0907b804219baa8676f646353bd821/packages/%40uppy/transloadit/src/index.js#L619

we should probably return before emitting any events, or maybe better make sure files are only ever deleted after an upload has finished or failed.

mifi avatar Jun 06 '22 17:06 mifi

Can we make this issue more specific? It's not really actionable at the moment.

Murderlon avatar Jun 07 '22 10:06 Murderlon

I updated the description

mifi avatar Jun 07 '22 22:06 mifi

When does this happen?

Is it when the user deletes the file before it's finished uploading?

heloineto avatar Dec 21 '23 17:12 heloineto

We haven't seen this happen anymore so the issue is not reproducible. Luckily we are migrating everything to TS, then we can make sure things are happening correctly.

Murderlon avatar Jan 02 '24 12:01 Murderlon