uppy
uppy copied to clipboard
Events sometimes emitted with undefined file
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.
Can we make this issue more specific? It's not really actionable at the moment.
I updated the description
When does this happen?
Is it when the user deletes the file before it's finished uploading?
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.