Skip to content
This repository has been archived by the owner on Jan 29, 2019. It is now read-only.

Commit

Permalink
fix: iteration bug in removeAllFiles method (#48)
Browse files Browse the repository at this point in the history
* Fixed bug in removeAllFiles

Not all files were being removed. This was caused
by the 'files' array being modified during the
call to removeFile.

* Simpify removeAllFiles

* Refactored as requested.
  • Loading branch information
johnkingsley authored and alexsasharegan committed May 8, 2018
1 parent d7cc0d6 commit 1e973aa
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/components/VueTransmit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -584,15 +584,13 @@ export default Vue.extend({
this.getFilesWithStatus(...statuses).map(this.removeFile);
},
removeAllFiles(cancelInProgressUploads = false): void {
let f: VTransmitFile;
for (f of this.files) {
if (
f.status !== UploadStatuses.Uploading ||
cancelInProgressUploads
) {
this.removeFile(f);
}
}
this.files
.filter(
f =>
f.status !== UploadStatuses.Uploading ||
cancelInProgressUploads
)
.map(this.removeFile);
},
triggerBrowseFiles(): void {
if (this.inputEl) {
Expand Down

0 comments on commit 1e973aa

Please sign in to comment.