Open Murderlon opened 2 years ago
We have internal, non-documented:
plugin-added
plugin-removed
Reusing the upload-progress
and upload-error
names for a different event is unfortunate as code that is not properly migrated will still register a listener for an existing event but for a different one.
our file-related events are a bit messy. some include a UppyFile
object, other include fileId
, some don't include anything.
in a future major we should probably refactor all file related events to either
fileId
UppyFile
object (from uppy.getFile()
)@mifi this could be improved in a minor version by adding the missing property (either fileId
or file
depending on the choice done for the future) in existing events in addition to the current properties (and documenting that the other one is deprecated)
yes, but it will still be messy because fileId
, file
etc are not properties, they are instead positional arguments, so some events would be (fileId, file)
, others (file)
, others (file, fileId)
One way or another I think we would need a breaking change. But I'm starting to change my mind on the renaming of all events. It's incredibly challenging to get right for little user value. Yes the current names are confusing, but with good docs we get away with it and we would prevent breaking changes.
That being said we should definitely make the arguments consistent and up-to-date (no stale file
's)
@mifi for positional arguments, there is indeed no backward compatible solution.
Initial checklist
Problem
Event names are sometimes confusing and seem inconsistent.
Solution
@uppy/core
Always send file(s) instead of ID(s)
Renaming we decided not to do.
* Rename `files-added` to `file-batch-added`. Or at least a better name to differentiate with `file-added` better * Rename `upload` to `upload-start` * Rename `progress` to `upload-progress` (total progress) * Rename `upload-progress` to `file-progress` (individual progress) * Rename `complete` to `upload-complete` (success or error) * Rename `upload-error` to `file-error` (one file upload error) * Rename `error` to `upload-error` (entire upload error) * Rename `cancel-all` to `upload-cancel`@uppy/transloadit
transloadit:assembly-created
) and sometimes not (transloadit:upload
). We should always or never prefix with assembly because we are always talking about the same thing.transloadit:result
andtransloadit:complete
. Potentially refactor to only have*:complete
uppy.on('error')
is extended with anassembly
property when the upload fails. This is a bit confusing, I suggest making suretransloadit:complete
also fires with it fails, with the assembly context, and keeperror
generic / consistent no matter the upload plugin.Related
These should also be taken into account:
Alternatives
upload-error
) which would be both deprecated and new at once.