mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-23 18:29:09 +00:00
* 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:  All of the downward peaks are `setState()` calls and GC. Now it takes around 60ms, and looks like this:  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.  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.  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> |
||
|---|---|---|
| .. | ||
| getDroppedFiles | ||
| canvasToBlob.js | ||
| dataURItoBlob.js | ||
| dataURItoBlob.test.js | ||
| dataURItoFile.js | ||
| dataURItoFile.test.js | ||
| emitSocketProgress.js | ||
| EventTracker.js | ||
| findAllDOMElements.js | ||
| findDOMElement.js | ||
| FOCUSABLE_ELEMENTS.js | ||
| generateFileID.js | ||
| generateFileID.test.js | ||
| getBytesRemaining.js | ||
| getBytesRemaining.test.js | ||
| getETA.js | ||
| getETA.test.js | ||
| getFileNameAndExtension.js | ||
| getFileNameAndExtension.test.js | ||
| getFileType.js | ||
| getFileType.test.js | ||
| getFileTypeExtension.js | ||
| getFileTypeExtension.test.js | ||
| getSocketHost.js | ||
| getSocketHost.test.js | ||
| getSpeed.js | ||
| getSpeed.test.js | ||
| getTimeStamp.js | ||
| hasProperty.js | ||
| index.js | ||
| isDOMElement.js | ||
| isDragDropSupported.js | ||
| isObjectURL.js | ||
| isObjectURL.test.js | ||
| isPreviewSupported.js | ||
| isPreviewSupported.test.js | ||
| isTouchDevice.js | ||
| isTouchDevice.test.js | ||
| microtip.scss | ||
| mimeTypes.js | ||
| prettyBytes.js | ||
| prettyBytes.test.js | ||
| prettyETA.js | ||
| prettyETA.test.js | ||
| ProgressTimeout.js | ||
| RateLimitedQueue.js | ||
| RateLimitedQueue.test.js | ||
| sampleImageDataURI.js | ||
| secondsToTime.js | ||
| secondsToTime.test.js | ||
| settle.js | ||
| settle.test.js | ||
| toArray.js | ||
| toArray.test.js | ||
| Translator.js | ||
| Translator.test.js | ||