Skip to content

Commit 36458ab

Browse files
authored
feat: remove change detection strategy from all components (#101)
BREAKING CHANGE: For enhanced performance it is recommended that you add `changeDetection: ChangeDetectionStrategy.OnPush` on all components that use this library. This will restrict change detection to only run when the components inputs change Closes #94
1 parent 6e752bf commit 36458ab

File tree

4 files changed

+2
-7
lines changed

4 files changed

+2
-7
lines changed

demo/demo.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component } from '@angular/core';
1+
import { Component, ChangeDetectionStrategy } from '@angular/core';
22
import {
33
startOfDay,
44
subDays,
@@ -36,6 +36,7 @@ const colors: any = {
3636

3737
@Component({
3838
selector: 'mwl-demo-app',
39+
changeDetection: ChangeDetectionStrategy.OnPush,
3940
styles: [`
4041
h3 {
4142
margin: 0;

src/components/day/calendarDayView.component.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
Component,
3-
ChangeDetectionStrategy,
43
Input,
54
OnChanges,
65
Output,
@@ -20,7 +19,6 @@ const SEGMENT_HEIGHT: number = 30;
2019

2120
@Component({
2221
selector: 'mwl-calendar-day-view',
23-
changeDetection: ChangeDetectionStrategy.OnPush,
2422
template: `
2523
<div class="cal-day-view">
2624
<mwl-calendar-all-day-event

src/components/month/calendarMonthView.component.ts

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
Input,
55
Output,
66
EventEmitter,
7-
ChangeDetectionStrategy,
87
ChangeDetectorRef,
98
OnInit,
109
OnDestroy,
@@ -25,7 +24,6 @@ import isSameDay from 'date-fns/is_same_day';
2524

2625
@Component({
2726
selector: 'mwl-calendar-month-view',
28-
changeDetection: ChangeDetectionStrategy.OnPush,
2927
template: `
3028
<div class="cal-month-view">
3129
<div class="cal-cell-row cal-header">

src/components/week/calendarWeekView.component.ts

-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
Input,
44
Output,
55
EventEmitter,
6-
ChangeDetectionStrategy,
76
ChangeDetectorRef,
87
OnChanges,
98
OnInit,
@@ -27,7 +26,6 @@ import { CalendarEventTimesChangedEvent } from './../../interfaces/calendarEvent
2726

2827
@Component({
2928
selector: 'mwl-calendar-week-view',
30-
changeDetection: ChangeDetectionStrategy.OnPush,
3129
template: `
3230
<div class="cal-week-view">
3331
<div class="cal-day-headers">

0 commit comments

Comments
 (0)