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:
@@ -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