DEV: prevents uppy to act on destroyed object (#14224)

DEV: prevents uppy to act on destroyed object (#14224)

diff --git a/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js b/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js
index 3636c05..788a441 100644
--- a/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js
+++ b/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js
@@ -147,6 +147,10 @@ export default Mixin.create({
     });
 
     this._uppyInstance.on("progress", (progress) => {
+      if (this.isDestroying || this.isDestroyed) {
+        return;
+      }
+
       this.set("uploadProgress", progress);
     });
 
diff --git a/app/assets/javascripts/discourse/app/mixins/upload.js b/app/assets/javascripts/discourse/app/mixins/upload.js
index 780b375..ff7a73b 100644
--- a/app/assets/javascripts/discourse/app/mixins/upload.js
+++ b/app/assets/javascripts/discourse/app/mixins/upload.js
@@ -103,6 +103,10 @@ export default Mixin.create({
     });
 
     $upload.on("fileuploadprogressall", (e, data) => {
+      if (this.isDestroying || this.isDestroyed) {
+        return;
+      }
+
       const progress = parseInt((data.loaded / data.total) * 100, 10);
       this.set("uploadProgress", progress);
     });
diff --git a/app/assets/javascripts/discourse/app/mixins/uppy-upload.js b/app/assets/javascripts/discourse/app/mixins/uppy-upload.js
index 101fce1..5c9cbb8 100644
--- a/app/assets/javascripts/discourse/app/mixins/uppy-upload.js
+++ b/app/assets/javascripts/discourse/app/mixins/uppy-upload.js
@@ -128,6 +128,10 @@ export default Mixin.create({
     this._uppyInstance.use(UppyChecksum, { capabilities: this.capabilities });
 
     this._uppyInstance.on("progress", (progress) => {
+      if (this.isDestroying || this.isDestroyed) {
+        return;
+      }
+
       this.set("uploadProgress", progress);
     });
 

GitHub sha: 8bb331e63fc483e1ddfb09b07bdf12a9463a12b7

This commit appears in #14224 which was approved by CvX. It was merged by jjaffeux.