Closed marclelamy closed 2 weeks ago
Can reproduce with the following modifications to the minimal-appdir example:
// app/page.tsx
"use client";
import { useUploadThing } from "~/utils/uploadthing";
export default function Home() {
const { startUpload } = useUploadThing("videoAndImage", {
skipPolling: true,
onBeforeUploadBegin: (files) => {
console.log("Uploading", files.length, "files");
return files;
},
onUploadBegin: (name) => {
console.log("Beginning upload of", name);
},
onClientUploadComplete: (res) => {
console.log("Upload Completed.", res.length, "files uploaded");
},
onUploadProgress(p) {
console.log("onUploadProgress", p);
},
});
return (
<main>
<input
type="file"
multiple
onChange={async (e) => {
const files = Array.from(e.target.files ?? []);
// Do something with files
// Then start the upload
await startUpload(files);
}}
/>
</main>
);
}
Provide environment information
Describe the bug
When uploading multiple files using useUploadThing() hook and displaying the progress to the user, the progress number goes back. I assume it's because the onUploadProgress callback is called whenever the status of a file changes
I'm expecting two possible things:
My guess is the callback is being called on every file update and because files upload is happening at the same time, a smaller file can be at 80% while other at 20%.
Link to reproduction
couldn't start the localhost due to error β¨― Failed to load SWC binary for linux/x64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc
To reproduce
This is what I use in my app to make it happen
Additional information
π¨βπ§βπ¦ Contributing
Code of Conduct