@uppy/status-bar
Advanced tools
Comparing version 3.2.0 to 3.2.1
# @uppy/status-bar | ||
## 3.2.1 | ||
Released: 2023-07-06 | ||
Included in: Uppy v3.11.0 | ||
- @uppy/status-bar: remove throttled component (Artur Paikin / #4396) | ||
- @uppy/status-bar: fix ETA when Uppy recovers its state (Antoine du Hamel / #4525) | ||
## 3.2.0 | ||
@@ -4,0 +12,0 @@ |
import { h } from 'preact'; | ||
import classNames from 'classnames'; | ||
import throttle from 'lodash/throttle.js'; | ||
import prettierBytes from '@transloadit/prettier-bytes'; | ||
@@ -239,6 +238,2 @@ import prettyETA from '@uppy/utils/lib/prettyETA'; | ||
} | ||
const ThrottledProgressDetails = throttle(ProgressDetails, 500, { | ||
leading: true, | ||
trailing: true | ||
}); | ||
function ProgressBarUploading(props) { | ||
@@ -269,3 +264,3 @@ const { | ||
if (supportsUploadProgress) { | ||
return h(ThrottledProgressDetails, { | ||
return h(ProgressDetails, { | ||
numUploads: numUploads, | ||
@@ -272,0 +267,0 @@ complete: complete, |
@@ -10,3 +10,3 @@ function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; } | ||
const packageJson = { | ||
"version": "3.2.0" | ||
"version": "3.2.1" | ||
}; | ||
@@ -85,3 +85,15 @@ import locale from './locale.js'; | ||
} = this.uppy.getState(); | ||
_classPrivateFieldLooseBase(this, _previousSpeed)[_previousSpeed] = null; | ||
_classPrivateFieldLooseBase(this, _previousETA)[_previousETA] = null; | ||
if (recoveredState) { | ||
_classPrivateFieldLooseBase(this, _previousUploadedBytes)[_previousUploadedBytes] = Object.values(recoveredState.files).reduce((pv, _ref) => { | ||
let { | ||
progress | ||
} = _ref; | ||
return pv + progress.bytesUploaded; | ||
}, 0); | ||
// We don't set `#lastUpdateTime` at this point because the upload won't | ||
// actually resume until the user asks for it. | ||
this.uppy.emit('restore-confirmed'); | ||
@@ -92,4 +104,2 @@ return undefined; | ||
_classPrivateFieldLooseBase(this, _previousUploadedBytes)[_previousUploadedBytes] = 0; | ||
_classPrivateFieldLooseBase(this, _previousSpeed)[_previousSpeed] = null; | ||
_classPrivateFieldLooseBase(this, _previousETA)[_previousETA] = null; | ||
return this.uppy.upload().catch(() => { | ||
@@ -216,9 +226,13 @@ // Error logged in Core | ||
function _computeSmoothETA2(totalBytes) { | ||
var _classPrivateFieldLoo, _classPrivateFieldLoo2; | ||
if (totalBytes.total === 0 || totalBytes.remaining === 0) { | ||
return 0; | ||
} | ||
// When state is restored, lastUpdateTime is still nullish at this point. | ||
(_classPrivateFieldLoo2 = (_classPrivateFieldLoo = _classPrivateFieldLooseBase(this, _lastUpdateTime))[_lastUpdateTime]) != null ? _classPrivateFieldLoo2 : _classPrivateFieldLoo[_lastUpdateTime] = performance.now(); | ||
const dt = performance.now() - _classPrivateFieldLooseBase(this, _lastUpdateTime)[_lastUpdateTime]; | ||
if (dt === 0) { | ||
var _classPrivateFieldLoo; | ||
return Math.round(((_classPrivateFieldLoo = _classPrivateFieldLooseBase(this, _previousETA)[_previousETA]) != null ? _classPrivateFieldLoo : 0) / 100) / 10; | ||
var _classPrivateFieldLoo3; | ||
return Math.round(((_classPrivateFieldLoo3 = _classPrivateFieldLooseBase(this, _previousETA)[_previousETA]) != null ? _classPrivateFieldLoo3 : 0) / 100) / 10; | ||
} | ||
@@ -231,4 +245,4 @@ const uploadedBytesSinceLastTick = totalBytes.uploaded - _classPrivateFieldLooseBase(this, _previousUploadedBytes)[_previousUploadedBytes]; | ||
if (uploadedBytesSinceLastTick <= 0) { | ||
var _classPrivateFieldLoo2; | ||
return Math.round(((_classPrivateFieldLoo2 = _classPrivateFieldLooseBase(this, _previousETA)[_previousETA]) != null ? _classPrivateFieldLoo2 : 0) / 100) / 10; | ||
var _classPrivateFieldLoo4; | ||
return Math.round(((_classPrivateFieldLoo4 = _classPrivateFieldLooseBase(this, _previousETA)[_previousETA]) != null ? _classPrivateFieldLoo4 : 0) / 100) / 10; | ||
} | ||
@@ -235,0 +249,0 @@ const currentSpeed = uploadedBytesSinceLastTick / dt; |
{ | ||
"name": "@uppy/status-bar", | ||
"description": "A progress bar for Uppy, with many bells and whistles.", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"license": "MIT", | ||
@@ -33,8 +33,7 @@ "main": "lib/index.js", | ||
"classnames": "^2.2.6", | ||
"lodash": "^4.17.21", | ||
"preact": "^10.5.13" | ||
}, | ||
"peerDependencies": { | ||
"@uppy/core": "^3.2.1" | ||
"@uppy/core": "^3.3.0" | ||
} | ||
} |
import { h } from 'preact' | ||
import classNames from 'classnames' | ||
import throttle from 'lodash/throttle.js' | ||
import prettierBytes from '@transloadit/prettier-bytes' | ||
@@ -286,7 +285,2 @@ import prettyETA from '@uppy/utils/lib/prettyETA' | ||
const ThrottledProgressDetails = throttle(ProgressDetails, 500, { | ||
leading: true, | ||
trailing: true, | ||
}) | ||
function ProgressBarUploading (props) { | ||
@@ -309,2 +303,3 @@ const { | ||
} = props | ||
const showUploadNewlyAddedFiles = newFiles && isUploadStarted | ||
@@ -322,3 +317,3 @@ | ||
return ( | ||
<ThrottledProgressDetails | ||
<ProgressDetails | ||
numUploads={numUploads} | ||
@@ -325,0 +320,0 @@ complete={complete} |
@@ -100,2 +100,4 @@ import { UIPlugin } from '@uppy/core' | ||
// When state is restored, lastUpdateTime is still nullish at this point. | ||
this.#lastUpdateTime ??= performance.now() | ||
const dt = performance.now() - this.#lastUpdateTime | ||
@@ -134,3 +136,11 @@ if (dt === 0) { | ||
this.#previousSpeed = null | ||
this.#previousETA = null | ||
if (recoveredState) { | ||
this.#previousUploadedBytes = Object.values(recoveredState.files) | ||
.reduce((pv, { progress }) => pv + progress.bytesUploaded, 0) | ||
// We don't set `#lastUpdateTime` at this point because the upload won't | ||
// actually resume until the user asks for it. | ||
this.uppy.emit('restore-confirmed') | ||
@@ -141,4 +151,2 @@ return undefined | ||
this.#previousUploadedBytes = 0 | ||
this.#previousSpeed = null | ||
this.#previousETA = null | ||
return this.uppy.upload().catch(() => { | ||
@@ -145,0 +153,0 @@ // Error logged in Core |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
165460
5
2567
- Removedlodash@^4.17.21