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:
Mikael Finstad 2025-12-09 13:36:47 +07:00 committed by GitHub
parent 648f245af0
commit d766c30f2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"@uppy/golden-retriever": patch
---
Fix: Don't restore `currentUploads` if no files are being restored.

View file

@ -174,7 +174,7 @@ export default class GoldenRetriever<
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
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,
})