Skip to content

Commit

Permalink
perf(io): do not detect any changes when there is no component
Browse files Browse the repository at this point in the history
  • Loading branch information
gund committed Aug 27, 2022
1 parent 9a03765 commit 8e7dbce
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions projects/ng-dynamic-component/src/lib/io/io.service.ts
Expand Up @@ -136,6 +136,10 @@ export class IoService implements OnDestroy {
* or when setting them for the first time
*/
update(inputs: InputsType, outputs: OutputsType) {
if (!this.compRef) {
return;
}

const changes = this.updateIO(inputs, outputs);

const compChanged = this.componentInstChanged;
Expand All @@ -159,6 +163,11 @@ export class IoService implements OnDestroy {
* Usually must be called from the `DoCheck` lifecycle hook
*/
maybeUpdate() {
if (!this.compRef) {
this._disconnectOutputs();
return;
}

if (this.componentInstChanged) {
this.updateInputs(true);
this.bindOutputs();
Expand Down

0 comments on commit 8e7dbce

Please sign in to comment.