Bladeren bron

meta: Comment on what we want to do about close, resetProgress, clearUploadedFiles, etc in the next major (#4865)

Comment on what we want to do about close, resetProgress, clearUploadedFiles, etc in the next major
Artur Paikin 1 jaar geleden
bovenliggende
commit
4753a05754
1 gewijzigde bestanden met toevoegingen van 7 en 1 verwijderingen
  1. 7 1
      packages/@uppy/core/src/Uppy.ts

+ 7 - 1
packages/@uppy/core/src/Uppy.ts

@@ -554,7 +554,7 @@ export class Uppy<M extends Meta, B extends Body> {
     this.setState(undefined) // so that UI re-renders with new options
   }
 
-  // todo next major: rename to something better? (it doesn't just reset progress)
+  // todo next major: remove
   resetProgress(): void {
     const defaultProgress: Omit<FileProgressNotStarted, 'bytesTotal'> = {
       percentage: 0,
@@ -580,6 +580,8 @@ export class Uppy<M extends Meta, B extends Body> {
     this.emit('reset-progress')
   }
 
+  // @todo next major: rename to `clear()`, make it also cancel ongoing uploads
+  // or throw and say you need to cancel manually
   protected clearUploadedFiles(): void {
     this.setState({ ...defaultUploadState, files: {} })
   }
@@ -1773,6 +1775,10 @@ export class Uppy<M extends Meta, B extends Body> {
   /**
    * Uninstall all plugins and close down this Uppy instance.
    */
+  // @todo next major: rename to `destroy`.
+  // Cancel local uploads, cancel remote uploads, DON'T cancel assemblies
+  // document that if you do want to cancel assemblies, you need to call smth manually.
+  // Potentially remove reason, as it’s confusing, just come up with a default behaviour.
   close({ reason }: { reason?: FileRemoveReason } | undefined = {}): void {
     this.log(
       `Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`,