Skip to content

Commit 9db786c

Browse files
Your Nameclaude
andcommitted
fix(@uppy/transloadit): show processing UI when restoring an assembly
When Golden Retriever restores a Transloadit assembly after a page refresh, the UI was not updated to reflect that the assembly was still being processed. This caused the Upload button to appear and files to look like they were ready to upload again, even though the assembly was already running in the background. Fix by setting `allowNewUpload: false` and emitting `postprocess-progress` for each file when restoring an in-progress assembly, so the Dashboard shows the encoding indicator. When the assembly eventually completes via the AssemblyWatcher, `allowNewUpload` is reset to `true`. Fixes #6017 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 23cbd4a commit 9db786c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

packages/@uppy/transloadit/src/index.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,10 @@ export default class Transloadit<
451451
this.completedFiles[file.id] = true
452452
this.uppy.emit('postprocess-complete', file)
453453
})
454+
// Allow new uploads now that this assembly is complete.
455+
// This is especially important when restoring an assembly after a page
456+
// refresh, where allowNewUpload is set to false to prevent re-uploading.
457+
this.uppy.setState({ allowNewUpload: true })
454458
})
455459

456460
watcher.on('assembly-error', (id: string, error: Error) => {
@@ -738,6 +742,23 @@ export default class Transloadit<
738742
this.restored = (async () => {
739743
const files = restoreState()
740744
restoreAssemblies(Object.keys(files))
745+
746+
// If the assembly is still in progress, update the UI to reflect that.
747+
// This prevents the Upload button from being shown and shows the
748+
// processing indicator for each file.
749+
if (previousAssembly.ok !== 'ASSEMBLY_COMPLETED') {
750+
this.uppy.setState({ allowNewUpload: false })
751+
Object.values(files).forEach(({ id: fileId }) => {
752+
const file = this.uppy.getFile(fileId)
753+
if (file) {
754+
this.uppy.emit('postprocess-progress', file, {
755+
mode: 'indeterminate',
756+
message: this.i18n('encoding'),
757+
})
758+
}
759+
})
760+
}
761+
741762
await updateAssembly()
742763
this.restored = null
743764
})()

0 commit comments

Comments
 (0)