Skip to content

Commit e9b866e

Browse files
authored
Use remove component method (#664)
use removeComponent method on component removed
1 parent eb7c305 commit e9b866e

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/lib/utils/options/sources/component.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ export class ComponentSource extends OptionsComponent {
3535
}
3636

3737
private removeComponent(component: AbstractComponent<any>) {
38-
const name = component.componentName;
39-
let index = this.knownComponents.indexOf(name);
38+
let index = this.knownComponents.indexOf(component.componentName);
4039
if (index !== -1) {
41-
this.knownComponents.slice(index, 1);
40+
this.knownComponents.splice(index, 1);
4241
for (let declaration of component.getOptionDeclarations()) {
4342
this.owner.removeDeclarationByName(declaration.name);
4443
}
@@ -56,9 +55,6 @@ export class ComponentSource extends OptionsComponent {
5655
}
5756

5857
private onComponentRemoved(e: ComponentEvent) {
59-
const declarations = e.component.getOptionDeclarations();
60-
for (let declaration of declarations) {
61-
this.owner.removeDeclarationByName(declaration.name);
62-
}
58+
this.removeComponent(e.component);
6359
}
6460
}

0 commit comments

Comments
 (0)