Commit graph

80 commits

Author SHA1 Message Date
Renée Kooi
2b91a96c95
Release 2020-01-15 16:39:45 +01:00
Renée Kooi
1463ee79ce
Improve performance of adding and removing files (#1949)
* core: add an addFiles() method that only updates state once

Previously, adding 1300-ish files took around 260ms, and looked like
this in Firefox's performance tab:

![Flamegraph](https://i.imgur.com/08veuoU.png)

All of the downward peaks are `setState()` calls and GC.

Now it takes around 60ms, and looks like this:

![Flamegraph](https://i.imgur.com/xFdwVBV.png)

Here, most of the time is spent generating file IDs and guessing file
types. Those would be areas to look at next.

* dashboard: prevent frequent state update if nothing changed

After the last commit, `addFiles()` still spends a lot of time in
`emit()` and `hideAllPanels()`. The reason is that `addFiles()` still
emits all the hundreds of file-added events, and the Dashboard responds
to each with `hideAllPanels()`, which does a state update. But this all
happens synchronously, and the state almost certainly did not change
since the last `file-added` event that fired a millisecond ago.

This adds a check to avoid the state update if it is not necessary.

![Flamegraph](https://i.imgur.com/KhuD035.png)

Adding 1300 files takes about 40ms now.

With this change, the `addFiles()` call is no longer the slowest
part—now preact rendering all the items is!

* utils: optimize generateFileID and getFileNameAndExtension

Replaces some clever things with more mundane and faster things!

Now, generateFileID is a bunch of string concatenations.
Now, getFileNameAndExtension uses `lastIndexOf()` instead of a regex.

![Flamegraph](https://i.imgur.com/ZQ1IhxI.png)

Adding 1300 files takes about 25ms.

* dashboard: use preact-virtual-list

* thumbnail-generator: add `lazy` option

* dashboard: request thumbnails once file item renders the first time

* dashboard: fork preact-virtual-list

* core: add removeFiles() to remove files in bulk

* Implement removeFile() in terms of removeFiles()

* thumbnail-generator: only queue files that can be previewed

* rename size constants to accommodate WIDTH/HEIGHT

* Use new uppy.addFiles in DragDrop and FileInput

* utils: fix getFileNameAndExtension() type

* Rip out the lazy thumbnail generation

* Rip out virtualization.

* Remove virtualization leftovers

* tell future people that this is intentionally verbose

* Update package-lock.json

* henlo i am spell

* Make `addFiles()` respect maxNumberOfFiles

* core: show an informer error if some files fail in bulk add

* locales: fix quotes to make build:locale-pack happy

Co-authored-by: Artur Paikin <artur@arturpaikin.com>
2020-01-13 12:29:08 +01:00
Renée Kooi
18180d5778
Release 2019-12-16 12:53:23 +01:00
Artur Paikin
5cfd5495ff thumbnail-generator: Add webp to the list of supported types (#1961)
* Add webp to the list of supported types

* add webp to tests too
2019-12-04 11:07:47 +01:00
Renée Kooi
c370dba0b6
Release 2019-11-04 10:56:06 +01:00
Aaron Ross
44bcea6d03 add UppyFile.response typing (#1882)
* add UppyFile.response typing

* add some `file.response` type tests
2019-10-25 16:23:30 +02:00
Renée Kooi
0f269fc054
utils: accept sync functions in wrapPromiseFunction() (#1910)
* utils: add failing test for wrapPromiseFunction(syncFn)

* utils: promisify non-promise-returning functions in wrapPromiseFunction()
2019-10-25 11:07:06 +02:00
Renée Kooi
4e32e61d7c
Release 2019-10-09 21:00:46 +02:00
Renée Kooi
12e005019e
aws-s3-multipart: fix queueing behaviours (#1855)
* aws-s3-multipart: prevent deadlock in rate limit queue

* utils: fix RateLimitedQueue thrashing when aborting all items

* aws-s3-multipart: only send abort request if upload was already created, fixes #1146
2019-10-09 19:55:29 +02:00
Renée Kooi
bb8b66d918
Use more cancellation-friendly strategy for limit: N uploads (#1736)
* xhr-upload: redo limit option using different strategy

* xhr-upload: fix marking requests as done

* Move duplicate createEventTracker definitions to @uppy/utils

* tus: new cancellation for local uploads

* tus: fix cancelling queued uploads

* tus: fix wrong name

* aws-s3-multipart: smol refactor

* aws-s3-multipart: new cancellation style

* aws-s3: new cancellation

* utils: port limitPromises test to RateLimitedQueue

* timing fix?

* tus: new cancellation on websocket

* xhr-upload: implement cancellation for remote uploads

* aws-s3-multipart: port to new cancellation

* utils: remove limitPromises

* xhr-upload: remove pause/resume code

* xhr-upload: clean up event listeners

* xhr-upload: extract progress timer to separate class

* Move ProgressTimeout class to utils

* utils: update typings

* Fix lint

* tus: make pause/resume respect the rate limiting queue

* tus: try to explain some of the tricky things at play in the Tus#upload method

* aws-s3-multipart: add missing { abort: true }

* aws-s3-multipart: make pause/resume respect the rate limiting queue

* eslintrc.json - fixed eslint warnings for jsdoc

* Revert "eslintrc.json - fixed eslint warnings for jsdoc"

This reverts commit 50b24773ce.

* eslintrc.json - allow indentation in jsdoc comments

* xhr-upload: fix promise return value

* tus: fix promise return value

* tus: add missing `return () => {}`

* utils: typing export type fixes

* tus: add more jsdoc

* companion-client: add missing SocketOptions type

* utils: fix more export typings

* core,companion-client,tus: more typings tweaking

* companion-client: test fix 😩

* companion-client: add type for Socket#open

* tus: fix emit() call

* add local cancellation fuzz....ish? test
2019-09-25 15:21:17 +02:00
Artur Paikin
e82ac0f137
core: Don’t add/overwrite existing files, allow duplicates from different folders (#1767)
* Add file.data.relativePath to the file.id

* Don’t add/overwrite a file if a file with the same id already exsists, issue a warning

* override @uppy/tus fingerprint to uppy’s file.id

* combine cordove/react native handling, don’t log twice

* always use onError for errors in addFile

* use file.meta.relativePath instead of file.data.relativePath

what do you think, @lakesare?

* update tests to include allowing/diallowing duplicates and file.id generation with relativePath

* update tus-js-client

* refactor error handling for addFile and upload into a mutual  _showOrLogErrorAndThrow method

* explain duplicate files and relativePath

* throw TypeError vs Error when allowedFileTypes is not an array

* fix tests

* tweak docs

* Emit restriction-failed for all restriction errors, move it to _showOrLogErrorAndThrow
2019-09-19 16:43:51 +03:00
Artur Paikin
056a7114a1 Release 2019-08-30 15:24:04 +03:00
Evgenia Karunus
cc8c6540af getDroppedFiles.js: handle exceptions better (#1797)
* @utils/getDroppedFiles.js - mild refactoring

* @utils/getDroppedFiles.js - added .info and .log on drop error

* @utils/getDroppedFiles.js - one more refactor

* @utils/getDroppedFiles.js - log error objects instead of strings
2019-08-30 14:45:21 +03:00
Renée Kooi
c62ec3665d Update eslint to v6 (#1777)
* Update eslint

* Do eslint --fix

* Do not access Object.prototype method 'hasOwnProperty' from target object

* utils: add hasProperty

* eslint --fix

* Disable quote-props for locale files

* add back quotes in locale files

* revert locale files to state on master

* Update react-scripts
2019-08-13 21:45:30 +03:00
Artur Paikin
bd2beedcff Release 2019-07-18 17:21:42 +02:00
Artur Paikin
4aef626a52
core: Added heic file type, refactor getFileType (#1734)
* add .heic and .heif file types

* refactor getFileType — we don’t need special condition for isRemote anymore
2019-07-17 19:54:06 +02:00
Renée Kooi
b42f904f2b core: adjust ID generation to keep non-latin characters (#1722)
* core: add test for ID generation with non-latin names

* core: adjust ID generation to keep non-latin characters

This shouldn't be bc-breaking!

Now, non-latin characters are encoded as their charcode in base 32, so
files that only differ by name in a non-latin language will generate
different IDs.
2019-07-17 16:12:51 +02:00
Artur Paikin
7873f057ca
utils: prettyBytes 1000 --> 1024 (#1732)
* Replace prettier-bytes with its copy, only use 1024 instead of 1000 to justify KB vs kB

* Add tests

* added License

* pretty-bytes to @uppy/utils/lib/prettyBytes everywhere
2019-07-16 15:21:47 +02:00
Evgenia Karunus
f88b0c5bc1 Add translations for aria labels in provider views (#1696)
* @uppy/provider-views - added translations for aria-labels

* @uppy/locales - added translations for provider views
2019-07-05 15:37:13 +03:00
Artur Paikin
81a45a01ed eslint jsdoc fixes 2019-06-25 18:27:48 +03:00
Renée Kooi
a6d3132848
core: make meta.name not required in addFile() (#1629) 2019-06-19 10:34:58 +02:00
Evgenia Karunus
6bcf2040e9 Feature/accessibility (#1507)
* @uppy/provider-views - added accessibility

* @uppy/provider-views - simplified checkbox css

* @uppy/dashboard - on tab set focus to the current verlay

* @uppy/dashboard - factored out code related to focus into a separate file

* @uppy/dashboard, and connected plugins - made focus travel well, and be managed in a single place in Dashboard

* @uppy/dashboard - made modal opener button focus keep focus on modal close

* @uppy/dashboard - focus management for uploaded-files

* @uppy/dashboard - made informer read messages without interruption

* @uppy/provider-views - removed the bug of focus jumping on safari

* @uppy/dashboard - made focus travel well in instagram in firefox

* @uppy - moved lodash.debounce dependency from / to @uppy/dashboard

* everywhere - made <ul>s not focusable for firefox

* @uppy/provider-views - unnested scss, copypasted alex's :focus changes

* Added JSDoc eslint package and rules, and fixed some JSDoc comments

* .eslintrc - made jsdoc errors warnings instead

* package-lock.json for new package.json

* eslint fix

* @uppy/dashboard - avoid forcing focus when we are inline

* @uppy/dashboard - in firefox, made sure superfocus is not switching back to uppy

* @uppy/dashboard - no focus jump for .info() inline,  fix for firefox

Made focus not interrupt .info() when we are in the inline mode;
Made firefox start superfocusing when we either tab into, or click on some element in Uppy

* @uppy/dashboard - only listen to click/focus on uppy

* @uppy/dashboard - started trapping focus in inline mode too

* @uppy/dashboard - restricted trapFocus() event listener to this.el

* @uppy/core - started throttling progress emits.

1. To fix heat up in firefox
2. To fix focus in firefox

* @uppy/core - fixed tests by adding .flush()-s for progress emits

* @uppy/dashboard - stopped trapping focus in inline mode, made background inert

* @uppy/dashboard - added MutationObserver polyfill

* tests - made locale-packs.js pass

* REVERTED last 3 commits that introduced inert

Inert requires too many polyfills, atm tests fail in IE 10.0, wicg-inert library reportedly has performance issues. We decided to at least wait until _some_ browser introduce inert html property natively.

* @uppy/dashboard - IE11 fix for focusing

* @uppy/dashboard - fix for a bug in Safari for long uploads with checkbox clicking

* RERUN TESTS - tiny commit to rerun tests

* @uppy/dashboard - removed useless touchstart event listener

* Cancel superFocus in recordIfFocusedOnUppyRecently, when focus moves away from Uppy

* @uppy/provider-views - made Filter not swallow letters

* @uppy/dashboard - stopped superfocus from refocusing if we're already in the overlay
2019-06-11 19:10:32 +03:00
Artur Paikin
28d235fe2f Release 2019-06-05 19:07:20 +03:00
Evgenia Karunus
8be2004826 Feature/replace dnd in drag drop package (#1565)
* /examples/dev - added drag-drop plugin dev environment

* @uppy/drag-drop - moved isDragDropSupported() to @uppy/utils

* @uppy/drag-drop - got rid of drag-drop npm library

* examples/dev - made compiled files placed in /output instead of /lib

* ~/examples/dev - made watchify only watch files once

* @uppy/drag-drop - add onPaste

* /examples/dev - readded html css override-attempts

* @uppy/drag-drop - made whole area clickable, and made it accessible

* @uppy/drag-drop - removed excessive outline in firefox

* REVERTED last 2 commits
2019-06-05 17:04:34 +03:00
Evgenia Karunus
450ab8ceb1 @uppy/utils - made getDroppedFiles.js work for IE11 (#1630) 2019-06-04 19:19:39 +03:00
Renée Kooi
a508cf7c44 core: use uploadStarted: null instead of false (#1628)
* core: use `uploadStarted: null` instead of false

Fixes #1615

* Update jest snapshots
2019-06-04 19:16:36 +03:00
Evgenia Karunus
2476e97459 getDroppedFiles.js - made .relativePath of nonfoldered files null (#1602) 2019-05-29 19:37:51 +03:00
Renée Kooi
1407763f5f
Fix more type import cycles 2019-05-20 11:31:21 +02:00
Renée Kooi
007195355a
Fix type import cycles 2019-05-20 11:29:10 +02:00
Renée Kooi
3b1d5b933f
Update eslint-plugin-compat and eslint-plugin-jest 2019-05-20 11:29:10 +02:00
Renée Kooi
f97b3931bb
Upgrade eslint. 2019-05-20 11:28:44 +02:00
Artur Paikin
5c9e1a836d Release 2019-05-17 19:17:03 +03:00
Evgenia Karunus
3fdaaa8bab mimeTypes.js - added pdf&txt mime types 2019-05-16 06:11:02 +05:00
Renée Kooi
1ad322497f
Release 2019-05-08 15:27:15 +02:00
Renée Kooi
3efb5662b9
Commit improved code formatting suggestion
Co-Authored-By: Tiarhai <garyedwardthomas@yahoo.ie>
2019-04-28 13:16:01 +01:00
Tiarhai
b9863c5029 Status Bar: Hide seconds if more than 1 hour 2019-04-27 21:56:42 +01:00
Artur Paikin
0f95529cc5 Release 2019-04-19 15:46:25 +03:00
Renée Kooi
e55757455d
dashboard,utils: fix import paths 2019-04-18 16:55:39 +02:00
Evgenia Karunus
97ad62b4cc UrlPlugin - made sure url drop/paste is browser-compatible 2019-04-17 21:12:03 +02:00
Evgenia Karunus
bcd9472da5 getDroppedFiles.js - moved into @uppy/utils, refactored 2019-04-17 01:30:32 +02:00
Artur Paikin
7ae8af44ab Release 2019-04-04 19:31:09 +03:00
Ifedapo Olarewaju
62305be8b9 companion-client: remove the use of window.location 2019-04-01 14:44:03 +01:00
Artur Paikin
a0355dbbe8 use stubs instead of removed locales 2019-03-19 14:45:56 +03:00
Artur Paikin
27899d944f Release 2019-03-08 20:47:42 +03:00
Artur Paikin
f94bc77deb Publish
- uppy@0.30.2
 - @uppy/aws-s3-multipart@0.30.2
 - @uppy/aws-s3@0.30.2
 - @uppy/companion-client@0.28.2
 - @uppy/companion@0.17.2
 - @uppy/core@0.30.2
 - @uppy/dashboard@0.30.2
 - @uppy/drag-drop@0.30.2
 - @uppy/dropbox@0.30.2
 - @uppy/file-input@0.30.2
 - @uppy/form@0.30.2
 - @uppy/golden-retriever@0.30.2
 - @uppy/google-drive@0.30.2
 - @uppy/informer@0.30.2
 - @uppy/instagram@0.30.2
 - @uppy/progress-bar@0.30.2
 - @uppy/provider-views@0.30.2
 - @uppy/react@0.30.2
 - @uppy/redux-dev-tools@0.30.2
 - @uppy/robodog@0.30.2
 - @uppy/status-bar@0.30.2
 - @uppy/store-default@0.28.2
 - @uppy/store-redux@0.28.2
 - @uppy/thumbnail-generator@0.30.2
 - @uppy/transloadit@0.30.2
 - @uppy/tus@0.30.2
 - @uppy/url@0.30.2
 - @uppy/utils@0.30.2
 - @uppy/webcam@0.30.2
 - @uppy/xhr-upload@0.30.2
2019-02-22 22:43:58 +03:00
Artur Paikin
a5c39e9a35 Release 2019-02-21 19:09:22 +03:00
Artur Paikin
4dcef4c3b9 Release 2019-02-15 23:55:18 +03:00
Renée Kooi
24ec8f81d5
Merge branch 'master' into feature/tl-preset 2019-01-21 10:55:27 +01:00
Renée Kooi
5800fe9ed6
Merge branch 'master' into feature/tl-preset 2019-01-17 16:54:44 +01:00
Artur Paikin
3ddf4c7548 Release 2019-01-15 19:21:04 +03:00