Skip to content

Commit

Permalink
perf(module:auto-complete): do not run change detection when the prom…
Browse files Browse the repository at this point in the history
…ise resolves (#7138)
  • Loading branch information
arturovt committed Feb 24, 2022
1 parent ec248c9 commit e95d941
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/auto-complete/autocomplete-trigger.directive.ts
Expand Up @@ -22,6 +22,7 @@ import {
forwardRef,
Inject,
Input,
NgZone,
OnDestroy,
Optional,
ViewContainerRef
Expand Down Expand Up @@ -90,6 +91,7 @@ export class NzAutocompleteTriggerDirective implements AfterViewInit, ControlVal
private overlayOutsideClickSubscription!: Subscription;

constructor(
private ngZone: NgZone,
private elementRef: ElementRef,
private overlay: Overlay,
private viewContainerRef: ViewContainerRef,
Expand Down Expand Up @@ -117,7 +119,7 @@ export class NzAutocompleteTriggerDirective implements AfterViewInit, ControlVal
}

writeValue(value: NzSafeAny): void {
Promise.resolve(null).then(() => this.setTriggerValue(value));
this.ngZone.runOutsideAngular(() => Promise.resolve(null).then(() => this.setTriggerValue(value)));
}

registerOnChange(fn: (value: {}) => {}): void {
Expand Down

0 comments on commit e95d941

Please sign in to comment.