fix(util-registry): filtering activeUtilInstances when a util is destroyed

This commit is contained in:
Johannes Eder 2021-08-24 12:15:13 +02:00 committed by Sarah Vaupel
parent 5078b56c16
commit 5b4ac75874

View File

@ -104,9 +104,10 @@ export class UtilRegistry {
if(DEBUG_MODE > 2) {
console.log('Destroying Util: ', {util});
}
let utilIndex = this._activeUtilInstancesWrapped.indexOf(util);
util.destroy();
if (utilIndex >= 0) this._activeUtilInstancesWrapped.splice(utilIndex, 1);
this._activeUtilInstancesWrapped = this._activeUtilInstancesWrapped.filter(utilWrapped => {
return utilWrapped.element === util._element;
});
});
}