ui: NavigationTree: do not modify list while iterating

iterating over a nodeinterfaces children while removing them
will lead to 'child' being undefined

instead collect the children to remove in a separate list
and iterate over them

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-03-10 10:10:46 +01:00 committed by Dietmar Maurer
parent 6396bace3d
commit 3c5b523631

View File

@ -188,11 +188,13 @@ Ext.define('PBS.view.main.NavigationTree', {
}
}
let toremove = [];
list.eachChild((child) => {
if (!newSet[child.data.path]) {
list.removeChild(child, true);
toremove.push(child);
}
});
toremove.forEach((child) => list.removeChild(child, true));
if (view.pathToSelect !== undefined) {
let path = view.pathToSelect;