angular-calendar-scheduler icon indicating copy to clipboard operation
angular-calendar-scheduler copied to clipboard

Calendar Events Not Displaying Correctly with OnPush Change Detection

Open Rattenfaenger49 opened this issue 8 months ago • 0 comments

When I change the ChangeDetectionStrategy to OnPush in my Angular application, everything initially works correctly. However, when navigating the calendar view to another day, week, or month using the following buttons:

mwlCalendarPreviousView (=> dateOrViewChanged)
mwlCalendarNextView (=> dateOrViewChanged)
mwlCalendarToday (=> dateOrViewChanged)

The appointments or events on the calendar do not stretch to take the full width available. Instead, they occupy only half of the width. This issue resolves itself after I click on any part of the calendar, at which point the events correctly stretch to the full width of their respective dates. 1 2

ChangeDetectionStrategy.Default works fine with all functions i have used but an error is thrown by changing the view in case there is an Event in the new CalenderView ERROR Error: NG0100: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value for 'max-width': '74'. Current value: '153'. Expression location: CalendarSchedulerEventComponent component. Find more at https://angular.io/errors/NG0100

Triggering change detection manually after the view change throw an Assertion Error this.cdr.detectChanges(); => Error: ASSERTION ERROR: Should be run in update mode [Expected=> false == true <=Actual]

How could help me with solving this issue?

Rattenfaenger49 avatar Jun 21 '24 15:06 Rattenfaenger49