Skip to content

infinite before view render calls #1695

Open
@SirAlfred0

Description

@SirAlfred0

Describe the bug

hello @mattlewis92, I'm experiencing some issues with your package.
as you can see in the below screenshot beforeViewRender event calls infinite times when I try to feed events to the calendar lazily here is my code

  <mwl-calendar-month-view
    *ngSwitchCase="'month'"
    [viewDate]="viewDate"
    [events]="events"
    [activeDayIsOpen]="true"
    [refresh]="refresh"
    (eventTimesChanged)="eventTimesChanged($event)"
    (beforeViewRender)="onViewRender($event)"
  >

and the logic

  onViewRender(viewRenderEvent: any): void
  {
    const start = new Date(viewRenderEvent.period.start).toISOString();
    const end = new Date(viewRenderEvent.period.end).toISOString();

    console.log(start, end);
    setTimeout(() => {
      this.events = e.filter(ev => ev.start.toISOString() >= start && ev.end?.toISOString()! <= end);
    });
    
  }

just so you know this is just a demo in a real application I'm gonna fetch the events from the server via period.start and period.end.

image

  • @angular/core: ^16.1.0
  • angular-calendar: ^0.31.0
  • Browser name and version: Chorome@latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions