mirror of
https://github.com/alexta69/metube.git
synced 2026-03-02 22:57:01 +00:00
Fix bulk delete error by making delById more defensive
- Extract map reference to local variable before iteration - Change from forEach to for-of loop for better error handling - Add null check on map before iterating - Add @popperjs/core peer dependency for ng-bootstrap - Update .gitignore to exclude package-lock.json Co-authored-by: alexta69 <7450369+alexta69@users.noreply.github.com>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,6 +7,7 @@
|
||||
|
||||
# dependencies
|
||||
/ui/node_modules
|
||||
/ui/package-lock.json
|
||||
|
||||
# profiling files
|
||||
chrome-profiler-events*.json
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user