fix(web): update upload summary when removing items (#27035) (#27139)

This commit is contained in:
Nicolas-micuda-becker
2026-03-23 16:02:09 +01:00
committed by GitHub
parent 2dd785e3e2
commit b98a227bbd

View File

@@ -80,7 +80,34 @@ function createUploadStore() {
}; };
const removeItem = (id: string) => { const removeItem = (id: string) => {
uploadAssets.update((uploadingAsset) => uploadingAsset.filter((a) => a.id != id)); uploadAssets.update((uploadingAsset) => {
const assetToRemove = uploadingAsset.find((a) => a.id === id);
if (assetToRemove) {
stats.update((stats) => {
switch (assetToRemove.state) {
case UploadState.DONE: {
stats.success--;
break;
}
case UploadState.DUPLICATED: {
stats.duplicates--;
break;
}
case UploadState.ERROR: {
stats.errors--;
break;
}
}
stats.total--;
return stats;
});
}
return uploadingAsset.filter((a) => a.id != id);
});
}; };
const dismissErrors = () => const dismissErrors = () =>