Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infinite before view render calls #1695

Open
SirAlfred0 opened this issue Nov 8, 2023 · 1 comment
Open

infinite before view render calls #1695

SirAlfred0 opened this issue Nov 8, 2023 · 1 comment

Comments

@SirAlfred0
Copy link

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
@matts-bot
Copy link

matts-bot bot commented Nov 8, 2023

Thanks so much for opening an issue! If you'd like to support this project, then please consider sponsoring me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant