I’m currently using a custom addUploader
function and am just curious how to trigger the Dashboard UI after the upload fn is complete. Because it doesn’t evaluate the promise result of the uploader function, I’m currently setting file properties as they are processed by the uploader.
For example, on errors:
function setFileError<M extends Meta, B extends Body>(uppy: Uppy, file: UppyFile<M, B>, error: string | null) {
uppy.setFileState(file.id, {
error: error
});
}
And on progress:
function setFileProgress<M extends Meta, B extends Body>(uppy: Uppy, file: UppyFile<M, B>, percentage: number, startNow?: boolean) {
uppy.setFileState(file.id, {
progress: {
bytesTotal: file.progress.bytesTotal,
bytesUploaded: 0,
uploadStarted: startNow ? Date.now() : (file.progress.uploadStarted || Date.now()),
percentage: percentage,
uploadComplete: Math.round(percentage) >= 100
},
error: null
})
}
But the errors don’t show and the uploading status bar at the bottom never goes to an error state (it stays like it’s pending upload). Similarly, I’m not sure how to handle setting the file states when the upload to complete so the dashboard displays the correct UI. Any help would be appreciated!