Skip to content

Commit

Permalink
fix: remove OnPush change detection
Browse files Browse the repository at this point in the history
  • Loading branch information
geromegrignon committed Aug 14, 2020
1 parent 3e442c7 commit 3043f98
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions projects/ngneat/edit-in-place/src/lib/editable.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ContentChild,
ElementRef,
Expand All @@ -25,7 +23,6 @@ import { Mode } from './mode';
selector: 'editable',
template: ` <ng-container *ngTemplateOutlet="currentView"></ng-container> `,
styles: [':host {cursor: pointer;}'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class EditableComponent implements OnInit {
@Input() openBindingEvent = this.config.openBindingEvent || 'click';
Expand All @@ -44,11 +41,7 @@ export class EditableComponent implements OnInit {
private readonly editMode$: Observable<boolean> = 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<any> {
if (!this.viewModeTpl && !this.editModeTpl) {
Expand Down Expand Up @@ -88,21 +81,18 @@ export class EditableComponent implements OnInit {
}

public displayEdition(group: boolean = false): void {
this.cdr.markForCheck();
this.mode = Mode.EDIT;
if (!group) {
this.editMode.next(true);
}
}

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;
}
Expand Down

0 comments on commit 3043f98

Please sign in to comment.