mirror of
https://github.com/transloadit/uppy.git
synced 2026-01-23 02:25:07 +00:00
don't restore currentUploads if no files (#6098)
if there are no files, no need to restore currentUploads. if we do restore currentUploads (as we currently do), and if the upload for some reason completes without completing all files (for example reproduced by #5366) and the user next time re-adds some of the *same* files as before, the upload would use only a subset of the files the user selected (only those that are from the restored currentUploads subset), which is wrong.
This commit is contained in:
parent
648f245af0
commit
d766c30f2f
2 changed files with 6 additions and 1 deletions
5
.changeset/kind-bottles-battle.md
Normal file
5
.changeset/kind-bottles-battle.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"@uppy/golden-retriever": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix: Don't restore `currentUploads` if no files are being restored.
|
||||||
|
|
@ -174,7 +174,7 @@ export default class GoldenRetriever<
|
||||||
|
|
||||||
this.uppy.setState({
|
this.uppy.setState({
|
||||||
recoveredState: hasFiles ? recoveredState : null, // recoveredState is used to control the UI (to show the "recovered" state), only set it if we actually have files
|
recoveredState: hasFiles ? recoveredState : null, // recoveredState is used to control the UI (to show the "recovered" state), only set it if we actually have files
|
||||||
currentUploads,
|
currentUploads: hasFiles ? currentUploads : {}, // if there are no files, no need to restore currentUploads. if we do, and the upload completes (but without completing all files) and the user re-adds some of the *same* files as before, the upload would use a subset of the files the user selected
|
||||||
files: filesWithBlobs,
|
files: filesWithBlobs,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue