From d05f37488d2b4e56a9017df83e1401c8a1236cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Wed, 31 Jul 2019 14:46:49 +0200 Subject: [PATCH] core: use setFileState inside retryUpload (#1759) Makes it a bit easier to follow. It also logs a warning now when you do `.retryUpload(SomeNonsenseFileID)` instead of silently adding an invalid object to the state. --- packages/@uppy/core/src/index.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/@uppy/core/src/index.js b/packages/@uppy/core/src/index.js index f538ace53..cb6713895 100644 --- a/packages/@uppy/core/src/index.js +++ b/packages/@uppy/core/src/index.js @@ -660,13 +660,9 @@ class Uppy { } retryUpload (fileID) { - const updatedFiles = Object.assign({}, this.getState().files) - const updatedFile = Object.assign({}, updatedFiles[fileID], - { error: null, isPaused: false } - ) - updatedFiles[fileID] = updatedFile - this.setState({ - files: updatedFiles + this.setFileState(fileID, { + error: null, + isPaused: false }) this.emit('upload-retry', fileID)