π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
fix(media): keep the rest of the upload batch when one file fails
Gilad Resisi29478ed6deb5
diff --git a/apps/frontend/src/components/media/new.uploader.tsx b/apps/frontend/src/components/media/new.uploader.tsxindex 187f49e98..c678467a2 100644--- a/apps/frontend/src/components/media/new.uploader.tsx+++ b/apps/frontend/src/components/media/new.uploader.tsx@@ -222,6 +222,10 @@ export function useUppyUploader(props: {});});uppy2.on('error', (result) => {+ // a single file failing leaves the batch running, 'complete' reports it with the rest+ if (Object.keys(uppy2.getState().currentUploads).length) {+ return;+ }uppy2.cancelAll();setLocked(false);props.onEnd();@@ -232,10 +236,20 @@ export function useUppyUploader(props: {});uppy2.on('complete', async (result) => {console.log(result);- for (const file of [...result.successful]) {+ for (const file of [...result.successful, ...(result.failed || [])]) {uppy2.removeFile(file.id);}+ if (result.failed?.length) {+ toast.show(+ t(+ 'some_files_failed_to_upload',+ 'Some files failed to upload, please try again'+ ),+ 'warning'+ );+ }+props.onEnd();// Sort results by original add order to maintain file sequenceconst sortedSuccessful = [...result.successful].sort((a, b) => {