mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-18 00:55:35 +00:00
drop current uploads similar to removeUpload , fixes the done button not working post upload
This commit is contained in:
parent
64346ce64d
commit
55ca6ce71e
1 changed files with 23 additions and 0 deletions
|
|
@ -1841,6 +1841,29 @@ export class Uppy<
|
|||
},
|
||||
},
|
||||
})
|
||||
|
||||
// Drop any currentUpload whose fileIDs are now all complete. This
|
||||
// mirrors what `#removeUpload` does at the end of `#runUpload`, but
|
||||
// is needed for completion paths that bypass `#runUpload` — notably
|
||||
// SSE-driven Transloadit assembly completion during GoldenRetriever
|
||||
// restore (no Resume click → no `uppy.restore(uploadID)` → orphaned
|
||||
// entry in `currentUploads`, which then makes `uppy.clear()` throw
|
||||
// when an uploader has `individualCancellation: false`).
|
||||
const { currentUploads, files } = this.getState()
|
||||
const updatedCurrentUploads = Object.fromEntries(
|
||||
Object.entries(currentUploads).filter(([, upload]) =>
|
||||
upload.fileIDs.some((id) => {
|
||||
const f = files[id]
|
||||
return f && !f.progress.complete && !f.error
|
||||
}),
|
||||
),
|
||||
)
|
||||
if (
|
||||
Object.keys(updatedCurrentUploads).length !==
|
||||
Object.keys(currentUploads).length
|
||||
) {
|
||||
this.setState({ currentUploads: updatedCurrentUploads })
|
||||
}
|
||||
})
|
||||
|
||||
this.on('restored', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue