From d766c30f2f1f0da2aab686b034efb03d7a2fcc5f Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Tue, 9 Dec 2025 13:36:47 +0700 Subject: [PATCH] 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. --- .changeset/kind-bottles-battle.md | 5 +++++ packages/@uppy/golden-retriever/src/index.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/kind-bottles-battle.md diff --git a/.changeset/kind-bottles-battle.md b/.changeset/kind-bottles-battle.md new file mode 100644 index 000000000..bee22d893 --- /dev/null +++ b/.changeset/kind-bottles-battle.md @@ -0,0 +1,5 @@ +--- +"@uppy/golden-retriever": patch +--- + +Fix: Don't restore `currentUploads` if no files are being restored. diff --git a/packages/@uppy/golden-retriever/src/index.ts b/packages/@uppy/golden-retriever/src/index.ts index 92bd7dc0d..0898c374a 100644 --- a/packages/@uppy/golden-retriever/src/index.ts +++ b/packages/@uppy/golden-retriever/src/index.ts @@ -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, })