mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: stuck uploader progress.
This commit is contained in:
@@ -79,7 +79,7 @@ const createUploader = () => {
|
||||
(p) => {
|
||||
newFile.$id = p.$id;
|
||||
newFile.progress = p.progress;
|
||||
newFile.completed = p.progress === 100 ? true : false;
|
||||
newFile.completed = p.progress === 100;
|
||||
updateFile(p.$id, newFile);
|
||||
}
|
||||
);
|
||||
@@ -94,6 +94,12 @@ const createUploader = () => {
|
||||
return n;
|
||||
});
|
||||
},
|
||||
removeAtIndex: (itemIndex: number) => {
|
||||
update((n) => {
|
||||
n.files = n.files.filter((_file, index) => index !== itemIndex);
|
||||
return n;
|
||||
});
|
||||
},
|
||||
removeFile: async (file: Models.File) => {
|
||||
if (file.chunksTotal === file.chunksUploaded) {
|
||||
return update((n) => {
|
||||
|
||||
+5
-1
@@ -29,7 +29,7 @@
|
||||
|
||||
async function create() {
|
||||
try {
|
||||
uploader.uploadFile(
|
||||
const uploadPromise = uploader.uploadFile(
|
||||
bucketId,
|
||||
$createFile.id ?? ID.unique(),
|
||||
$createFile.files[0],
|
||||
@@ -47,7 +47,11 @@
|
||||
trackEvent(Submit.FileCreate, {
|
||||
customId: !!$createFile.id
|
||||
});
|
||||
|
||||
await uploadPromise;
|
||||
} catch (e) {
|
||||
uploader.removeAtIndex(0);
|
||||
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: e.message
|
||||
|
||||
Reference in New Issue
Block a user