From 97c5fbf1556a94b5ec2d7756e018e5fd6b531fc1 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 23 Sep 2024 14:57:11 +0300 Subject: [PATCH] [angular-18 | DONE | REMOVED] Remove not needed this.cdr.detectChanges(); for performance issues --- src/app/app.component.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 1f2d745..39d0945 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -170,8 +170,7 @@ export class AppComponent implements OnInit, OnDestroy { @Inject(DOCUMENT) private document, private transferState: TransferState, @Inject(PLATFORM_ID) private platformId: any, - private rendererFactory: RendererFactory2, - private cdr: ChangeDetectorRef + private rendererFactory: RendererFactory2 ) { this.subscriptions.push(router.events.forEach((event) => { if (event instanceof NavigationEnd) { @@ -212,13 +211,11 @@ export class AppComponent implements OnInit, OnDestroy { this.subscriptions.push(this.layoutService.hasQuickContact.subscribe(hasQuickContact => { if (this.showQuickContact !== hasQuickContact) { this.showQuickContact = hasQuickContact; - this.cdr.detectChanges(); } })); this.subscriptions.push(this.quickContactService.isDisplayed.subscribe(display => { if (this.displayQuickContact !== display) { this.displayQuickContact = display; - this.cdr.detectChanges(); } })); } @@ -248,7 +245,6 @@ export class AppComponent implements OnInit, OnDestroy { entries.forEach(entry => { if (this.bottomNotIntersecting !== (!entry.isIntersecting)) { this.bottomNotIntersecting = !entry.isIntersecting; - this.cdr.detectChanges(); } }); }, options);