Remove icon input field from the internal list when removing the icon

This commit is contained in:
varjolintu 2023-01-24 18:59:04 +02:00
parent 6447e32fe6
commit b62523b756
2 changed files with 8 additions and 0 deletions

View file

@ -235,6 +235,8 @@ kpxcObserverHelper.handleObserverAdd = async function(target) {
kpxc.prepareCredentials();
}
kpxcIcons.deleteHiddenIcons();
};
// Removes monitored elements

View file

@ -167,6 +167,12 @@ kpxcUI.deleteHiddenIcons = function(iconList, attr) {
icon.removeIcon(attr);
iconList.splice(index, 1);
deletedIcons.push(icon.inputField);
// Delete the input field from detected fields so the icon can be detected again
const inputFieldIndex = kpxc.inputs.indexOf(icon.inputField);
if (inputFieldIndex >= 0) {
kpxc.inputs.splice(inputFieldIndex, 1);
}
}
}