Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@uppy/transloadit: fix multiple upload batches & run again #5478

Merged
merged 2 commits into from
Sep 30, 2024

Conversation

Murderlon
Copy link
Member

No description provided.

@Murderlon Murderlon self-assigned this Sep 30, 2024
Copy link
Contributor

Diff output files
diff --git a/packages/@uppy/core/lib/Uppy.js b/packages/@uppy/core/lib/Uppy.js
index c452412..e957f23 100644
--- a/packages/@uppy/core/lib/Uppy.js
+++ b/packages/@uppy/core/lib/Uppy.js
@@ -317,6 +317,8 @@ export class Uppy {
           ...files[fileID].progress,
           ...defaultProgress,
         },
+        tus: undefined,
+        transloadit: undefined,
       };
     });
     this.setState({
diff --git a/packages/@uppy/transloadit/lib/index.js b/packages/@uppy/transloadit/lib/index.js
index 3d215e3..6a57bc2 100644
--- a/packages/@uppy/transloadit/lib/index.js
+++ b/packages/@uppy/transloadit/lib/index.js
@@ -216,20 +216,21 @@ export default class Transloadit extends BasePlugin {
             files,
             results,
           });
+          return files;
         };
-        const restoreAssemblies = () => {
+        const restoreAssemblies = ids => {
           _classPrivateFieldLooseBase(this, _createAssemblyWatcher)[_createAssemblyWatcher](
             previousAssembly.assembly_id,
           );
-          _classPrivateFieldLooseBase(this, _connectAssembly)[_connectAssembly](this.assembly);
+          _classPrivateFieldLooseBase(this, _connectAssembly)[_connectAssembly](this.assembly, ids);
         };
         const updateAssembly = () => {
           var _this$assembly;
           return (_this$assembly = this.assembly) == null ? void 0 : _this$assembly.update();
         };
         this.restored = (async () => {
-          restoreState();
-          restoreAssemblies();
+          const files = restoreState();
+          restoreAssemblies(Object.keys(files));
           await updateAssembly();
           this.restored = null;
         })();
@@ -263,7 +264,7 @@ export default class Transloadit extends BasePlugin {
           _classPrivateFieldLooseBase(this, _createAssemblyWatcher)[_createAssemblyWatcher](
             assembly.status.assembly_id,
           );
-          _classPrivateFieldLooseBase(this, _connectAssembly)[_connectAssembly](assembly);
+          _classPrivateFieldLooseBase(this, _connectAssembly)[_connectAssembly](assembly, fileIDs);
         } catch (err) {
           fileIDs.forEach(fileID => {
             const file = this.uppy.getFile(fileID);
@@ -657,7 +658,7 @@ async function _cancelAssembly2(assembly) {
   this.uppy.emit("transloadit:assembly-cancelled", assembly);
   this.assembly = undefined;
 }
-function _connectAssembly2(assembly) {
+function _connectAssembly2(assembly, ids) {
   const {
     status,
   } = assembly;
@@ -676,7 +677,7 @@ function _connectAssembly2(assembly) {
   assembly.on("execution-progress", details => {
     this.uppy.emit("transloadit:execution-progress", details);
     if (details.progress_combined != null) {
-      for (const file of this.uppy.getFiles()) {
+      for (const file of this.uppy.getFilesByIds(ids)) {
         this.uppy.emit("postprocess-progress", file, {
           mode: "determinate",
           value: details.progress_combined / 100,

@Murderlon Murderlon changed the title @uppy/transloadit: fix multiple upload batchs & run again @uppy/transloadit: fix multiple upload batches & run again Sep 30, 2024
@Murderlon Murderlon merged commit 20291e1 into main Sep 30, 2024
17 checks passed
@Murderlon Murderlon deleted the transloadit-run-again branch September 30, 2024 09:22
@github-actions github-actions bot mentioned this pull request Sep 30, 2024
github-actions bot added a commit that referenced this pull request Sep 30, 2024
| Package           | Version | Package           | Version |
| ----------------- | ------- | ----------------- | ------- |
| @uppy/core        |   4.2.1 | uppy              |   4.4.1 |
| @uppy/transloadit |   4.1.2 |                   |         |

- @uppy/transloadit: fix multiple upload batches & run again (Merlijn Vos / #5478)
- meta: build(deps): bump docker/build-push-action from 6.7.0 to 6.8.0 (dependabot[bot] / #5477)
- meta: build(deps): bump vite from 5.2.11 to 5.4.8 (dependabot[bot] / #5471)
- @uppy/svelte: build(deps-dev): bump rollup from 4.18.0 to 4.22.4 (dependabot[bot] / #5470)
- meta: build(deps): bump vite from 5.2.11 to 5.4.6 (dependabot[bot] / #5466)
Murderlon added a commit that referenced this pull request Oct 7, 2024
* main: (319 commits)
  build(deps): bump docker/build-push-action from 6.8.0 to 6.9.0 (#5483)
  Release: uppy@4.4.1 (#5479)
  @uppy/transloadit: fix multiple upload batches & run again (#5478)
  build(deps): bump docker/build-push-action from 6.7.0 to 6.8.0 (#5477)
  build(deps): bump vite from 5.2.11 to 5.4.8 (#5471)
  build(deps-dev): bump rollup from 4.18.0 to 4.22.4 (#5470)
  build(deps): bump vite from 5.2.11 to 5.4.6 (#5466)
  Release: uppy@4.4.0 (#5467)
  @uppy/tus: fix retry check for status code 400 (#5461)
  meta: fix AwsS3 endpoint option in private/dev
  build(deps): bump body-parser from 1.20.2 to 1.20.3 (#5462)
  build(deps-dev): bump vite from 5.3.1 to 5.3.6 (#5459)
  @uppy/tus: set response from tus-js-client (#5456)
  docs: fix assemblyOptions example for React (#5450)
  docs: rename Edgly to Smart CDN (#5449)
  @uppy/tus: correctly type tus on UppyFile (#5454)
  docs: remove old legacy CDN reference
  @uppy/xhr-upload: pass files to onBeforeRequest (#5447)
  @uppy/svelte: fix generated module to not bundle Svelte (#5446)
  Bump svelte from 4.2.18 to 4.2.19 (#5440)
  ...
Murderlon added a commit that referenced this pull request Oct 15, 2024
* main: (65 commits)
  `.handleInputChange()` - use `.currentTarget`; clear the input using `''` (#5381)
  build(deps): bump @blakeembrey/template from 1.1.0 to 1.2.0 (#5448)
  Update packages/@uppy/locales/src/fr_FR.ts (#5472)
  @uppy/svelte: use SvelteKit as the build tool (#5484)
  @uppy/xhr-upload: add response to upload-error callback (#5486)
  tus: Avoid duplicate `upload-error` event (#5485)
  Fix redis emitter (#5474)
  build(deps): bump docker/build-push-action from 6.8.0 to 6.9.0 (#5483)
  Release: uppy@4.4.1 (#5479)
  @uppy/transloadit: fix multiple upload batches & run again (#5478)
  build(deps): bump docker/build-push-action from 6.7.0 to 6.8.0 (#5477)
  build(deps): bump vite from 5.2.11 to 5.4.8 (#5471)
  build(deps-dev): bump rollup from 4.18.0 to 4.22.4 (#5470)
  build(deps): bump vite from 5.2.11 to 5.4.6 (#5466)
  Release: uppy@4.4.0 (#5467)
  @uppy/tus: fix retry check for status code 400 (#5461)
  meta: fix AwsS3 endpoint option in private/dev
  build(deps): bump body-parser from 1.20.2 to 1.20.3 (#5462)
  build(deps-dev): bump vite from 5.3.1 to 5.3.6 (#5459)
  @uppy/tus: set response from tus-js-client (#5456)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant