From 3043f987937f47ca0582f5275373f668012698ca Mon Sep 17 00:00:00 2001 From: geromegrignon Date: Fri, 14 Aug 2020 07:01:36 +0200 Subject: [PATCH] fix: remove OnPush change detection --- .../edit-in-place/src/lib/editable.component.ts | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/projects/ngneat/edit-in-place/src/lib/editable.component.ts b/projects/ngneat/edit-in-place/src/lib/editable.component.ts index 38c0a0b..5f6751b 100644 --- a/projects/ngneat/edit-in-place/src/lib/editable.component.ts +++ b/projects/ngneat/edit-in-place/src/lib/editable.component.ts @@ -1,6 +1,4 @@ import { - ChangeDetectionStrategy, - ChangeDetectorRef, Component, ContentChild, ElementRef, @@ -25,7 +23,6 @@ import { Mode } from './mode'; selector: 'editable', template: ` `, styles: [':host {cursor: pointer;}'], - changeDetection: ChangeDetectionStrategy.OnPush, }) export class EditableComponent implements OnInit { @Input() openBindingEvent = this.config.openBindingEvent || 'click'; @@ -44,11 +41,7 @@ export class EditableComponent implements OnInit { private readonly editMode$: Observable = this.editMode.asObservable(); public viewHandler: Subscription; - constructor( - private readonly el: ElementRef, - @Inject(EDITABLE_CONFIG) readonly config: EditableConfig, - private readonly cdr: ChangeDetectorRef - ) {} + constructor(private readonly el: ElementRef, @Inject(EDITABLE_CONFIG) readonly config: EditableConfig) {} public get currentView(): TemplateRef { if (!this.viewModeTpl && !this.editModeTpl) { @@ -88,7 +81,6 @@ export class EditableComponent implements OnInit { } public displayEdition(group: boolean = false): void { - this.cdr.markForCheck(); this.mode = Mode.EDIT; if (!group) { this.editMode.next(true); @@ -96,13 +88,11 @@ export class EditableComponent implements OnInit { } public saveEdition(): void { - this.cdr.markForCheck(); this.save.next(); this.mode = Mode.VIEW; } public cancelEdition(): void { - this.cdr.markForCheck(); this.cancel.next(); this.mode = Mode.VIEW; }