Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add definition for addFiles method #3556

Merged
merged 2 commits into from
May 13, 2022
Merged

add definition for addFiles method #3556

merged 2 commits into from
May 13, 2022

Conversation

mrbatista
Copy link
Contributor

No description provided.

@Murderlon
Copy link
Member

@arturi @aduh95 do we want to continue to expose this or remove it in the next major? I recall it being initially introduced for internal purposes but there was some hesitation for making it public?

@aduh95
Copy link
Contributor

aduh95 commented Mar 11, 2022

It was introduced in #1949 to provide a more performant alternative to addFile. I agree we should either document it or remove it, I'm more on the "document it" side if the perf argument still holds.

@Murderlon
Copy link
Member

If we want to document it should also be added to the docs like addFile

@arturi
Copy link
Contributor

arturi commented Mar 14, 2022

Document and expose would be my vote. I think it makes sense for use cases when you have a 100 files pre-uploaded or similar, this would be way faster that calling .addFile in a loop.

@Murderlon
Copy link
Member

Cool. @mrbatista could you update the docs as well?

@aduh95
Copy link
Contributor

aduh95 commented Mar 14, 2022

For reference, addFile documentation can be found here:

### `uppy.addFile(fileObject)`

I suggest adding the addFiles section right below. Let us know if you need help.

@chiefGui
Copy link

Hey guys! Any ETA for this?

We've been using Uppy since 2018 and always had to create some proxy queue to don't bloat UI when the user adds multiple files at once.

@Murderlon
Copy link
Member

We've been using Uppy since 2018 and always had to create some proxy queue to don't bloat UI when the user adds multiple files at once.

Note that it is available and has been, it's just not typed or documented, so you can use it now. When we document this we can merge this PR.

@chiefGui
Copy link

@Murderlon Yep. It's just I'd like to avoid explicit type declaration, but it works for now.

For anyone in need:

declare module '@uppy/core' {
  // eslint-disable-next-line
  export interface Uppy {
    addFiles<TMeta extends IndexedObject<any> = Record<string, unknown>>(
      files: AddFileOptions<TMeta>[]
    ): void
  }
}

I am placing this in the same file I'm calling .addFiles() (because of TypeScript v4.5.x). If you're on a lower version, please go with the .d.ts solution.

@arturi arturi merged commit 0788552 into transloadit:main May 13, 2022
github-actions bot added a commit that referenced this pull request May 14, 2022
| Package                | Version | Package                | Version |
| ---------------------- | ------- | ---------------------- | ------- |
| @uppy/audio            |   0.3.1 | @uppy/provider-views   |   2.1.0 |
| @uppy/aws-s3           |   2.1.0 | @uppy/react            |   2.2.0 |
| @uppy/aws-s3-multipart |   2.3.0 | @uppy/react-native     |   0.3.0 |
| @uppy/companion-client |   2.1.0 | @uppy/screen-capture   |   2.1.0 |
| @uppy/core             |   2.2.0 | @uppy/status-bar       |   2.2.0 |
| @uppy/dashboard        |   2.2.0 | @uppy/svelte           |   1.0.8 |
| @uppy/drag-drop        |   2.1.0 | @uppy/transloadit      |   2.2.0 |
| @uppy/file-input       |   2.1.0 | @uppy/tus              |   2.3.0 |
| @uppy/google-drive     |   2.1.0 | @uppy/url              |   2.1.0 |
| @uppy/image-editor     |   1.2.0 | @uppy/webcam           |   2.2.0 |
| @uppy/instagram        |   2.1.0 | @uppy/xhr-upload       |   2.1.0 |
| @uppy/locales          |   2.1.0 | @uppy/zoom             |   1.1.0 |
| @uppy/onedrive         |   2.1.0 | @uppy/robodog          |   2.6.0 |
| @uppy/progress-bar     |   2.1.0 | uppy                   |  2.10.0 |

- @uppy/audio: fix types (Merlijn Vos / #3689)
- @uppy/aws-s3-multipart,@uppy/aws-s3,@uppy/core,@uppy/react,@uppy/transloadit,@uppy/tus,@uppy/xhr-upload: proposal: Cancel assemblies optional (Mikael Finstad / #3575)
- @uppy/aws-s3-multipart: export interface AwsS3MultipartOptions (Matteo Padovano / #3709)
- @uppy/companion-client: refactor to ESM (Antoine du Hamel / #3693)
- @uppy/companion: Only deploy on companion changes (kiloreux / #3677)
- @uppy/core: add definition for addFiles method (Matteo Padovano / #3556)
- @uppy/core: wrap plugins in div.uppy-Root and set dir attrubute in UIPlugin (Artur Paikin / #3692)
- @uppy/google-drive: refactor to ESM (Antoine du Hamel / #3683)
- @uppy/image-editor: refactor to ESM (Antoine du Hamel / #3685)
- @uppy/instagram: refactor to ESM (Antoine du Hamel / #3696)
- @uppy/locales: Add `save` translation to Spanish locale (Juan Carlos Alonso / #3678)
- @uppy/locales: refactor to ESM (Antoine du Hamel / #3707)
- @uppy/onedrive: refactor to ESM (Antoine du Hamel / #3694)
- @uppy/progress-bar: refactor to ESM (Antoine du Hamel / #3706)
- @uppy/provider-views: refactor to ESM (Antoine du Hamel / #3715)
- @uppy/react: Support React 18 in @uppy/react (Merlijn Vos / #3680)
- @uppy/screen-capture: refactor to ESM (Antoine du Hamel / #3698)
- @uppy/status-bar: refactor to ESM (Antoine du Hamel / #3697)
- @uppy/transloadit: add rate limiting for assembly creation and status polling (Antoine du Hamel / #3718)
- @uppy/tus: refactor to ESM (Antoine du Hamel / #3724)
- @uppy/url: refactor to ESM (Antoine du Hamel / #3713)
- @uppy/webcam: refactor to ESM (Antoine du Hamel / #3686)
- @uppy/xhr-upload: refactor to ESM (Antoine du Hamel / #3695)
- @uppy/zoom: refactor to ESM (Antoine du Hamel / #3699)
- meta: e2e: fix failing test (Antoine du Hamel / #3722)
- test: harden linter rule for JSX/ESM validation (Antoine du Hamel / #3681)
- test: harden linter rules for ESM/CJS validation (Antoine du Hamel / #3674)
- test: Increase retries to trigger longer retryDelay in tus (Artur Paikin / #3726)
- test: Remove `it.only` from e2e test (Merlijn Vos / #3690)
- tests: Make Cypress more stable & add e2e test for error events when upload fails (Merlijn Vos / #3662)
Murderlon added a commit that referenced this pull request May 16, 2022
* main:
  meta: fix dev env Vite's config
  Release: [email protected] (#3727)
  add definition for addFiles method (#3556)
  @uppy/provider-views: refactor to ESM (#3715)
  @uppy/tus: refactor to ESM (#3724)
  Increase retries to trigger longer retryDelay in tus (#3726)
  @uppy/transloadit: add rate limiting for assembly creation and status polling (#3718)
  core: wrap plugins in div.uppy-Root and set dir attrubute in UIPlugin (#3692)
  e2e: fix failing test (#3722)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants