Skip to content

Commit bb6a40f

Browse files
committed
perf(field-container): implementa ChangeDetectionStrategy.OnPush
O componente que é usado internamente possuia detecção de mudança padrão, com este commit passar a utilizar OnPush tornando-o mais performatico, checando seus bindings apenas quando algum dos seus input/evento for disparado.
1 parent e9fe5d0 commit bb6a40f

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

projects/ui/src/lib/components/po-field/po-field-container/po-field-container-bottom/po-field-container-bottom.component.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ describe('PoFieldContainerBottomComponent', () => {
1717
beforeEach(() => {
1818
fixture = TestBed.createComponent(PoFieldContainerBottomComponent);
1919
component = fixture.componentInstance;
20-
21-
fixture.detectChanges();
2220
});
2321

2422
it('should be created', () => {

projects/ui/src/lib/components/po-field/po-field-container/po-field-container-bottom/po-field-container-bottom.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input } from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
22

33
/**
44
* @docsPrivate
@@ -10,7 +10,8 @@ import { Component, Input } from '@angular/core';
1010
*/
1111
@Component({
1212
selector: 'po-field-container-bottom',
13-
templateUrl: './po-field-container-bottom.component.html'
13+
templateUrl: './po-field-container-bottom.component.html',
14+
changeDetection: ChangeDetectionStrategy.OnPush
1415
})
1516
export class PoFieldContainerBottomComponent {
1617
/**

projects/ui/src/lib/components/po-field/po-field-container/po-field-container.component.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ describe('PoFieldContainerComponent:', () => {
2121
beforeEach(() => {
2222
fixture = TestBed.createComponent(PoFieldContainerComponent);
2323
component = fixture.componentInstance;
24-
fixture.detectChanges();
2524
});
2625

2726
it('should be created', () => {

projects/ui/src/lib/components/po-field/po-field-container/po-field-container.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input } from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
22

33
import { convertToBoolean, getShortBrowserLanguage } from '../../../utils/util';
44

@@ -9,7 +9,8 @@ import { convertToBoolean, getShortBrowserLanguage } from '../../../utils/util';
99
*/
1010
@Component({
1111
selector: 'po-field-container',
12-
templateUrl: './po-field-container.component.html'
12+
templateUrl: './po-field-container.component.html',
13+
changeDetection: ChangeDetectionStrategy.OnPush
1314
})
1415
export class PoFieldContainerComponent {
1516
private _optional: boolean = false;

0 commit comments

Comments
 (0)