Merge pull request #876 from alexta69/copilot/fix-clear-completed-error

Fix undefined access error when bulk deleting downloads
This commit is contained in:
Alex
2026-01-10 18:24:02 +02:00
committed by GitHub
3 changed files with 11 additions and 6 deletions

1
.gitignore vendored
View File

@@ -7,6 +7,7 @@
# dependencies
/ui/node_modules
/ui/package-lock.json
# profiling files
chrome-profiler-events*.json

View File

@@ -38,6 +38,7 @@
"@fortawesome/free-solid-svg-icons": "^7.1.0",
"@ng-bootstrap/ng-bootstrap": "^20.0.0",
"@ng-select/ng-select": "^21.1.0",
"@popperjs/core": "^2.11.8",
"bootstrap": "^5.3.6",
"ngx-cookie-service": "^21.1.0",
"ngx-socket-io": "~4.9.3",
@@ -59,4 +60,4 @@
"typescript-eslint": "8.47.0",
"vitest": "^4.0.8"
}
}
}

View File

@@ -118,12 +118,15 @@ export class DownloadsService {
}
public delById(where: State, ids: string[]) {
ids.forEach(id => {
const obj = this[where].get(id)
if (obj) {
obj.deleting = true
const map = this[where];
if (map) {
for (const id of ids) {
const obj = map.get(id);
if (obj) {
obj.deleting = true;
}
}
});
}
return this.http.post('delete', {where: where, ids: ids});
}