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

List of events for a day is not changing after selecting another day #959

Closed
Dafnik opened this issue Apr 24, 2019 · 15 comments
Closed

List of events for a day is not changing after selecting another day #959

Dafnik opened this issue Apr 24, 2019 · 15 comments
Labels

Comments

@Dafnik
Copy link

Dafnik commented Apr 24, 2019

Describe the bug
After clickling in the month view on another day, the list of all events on this day is not changed. Sometimes it changes (after a long pause) and sometimes it doesn't change at all. Please note that this bug isn't affecting the demo and in my example I simply copied the demo.

Minimal reproduction of the problem with instructions

  • Copy the demo to a new project.
  • Select the month view
  • Click on another day

Screenshots
Streamable link

Versions

  • @angular/core: 7.2.14
  • angular-calendar: 0.27.5
  • Browser name and version: Chromium - 73.0.3683.86 and Firefox - 66.0.3
@matts-bot
Copy link

matts-bot bot commented Apr 24, 2019

Thanks so much for opening an issue! If you'd like me to give priority to answering your issue or would just like to support this project, then please consider supporting me on Patreon

@mattlewis92
Copy link
Owner

Hey, sorry to hear you're having issues, please can you attach a runnable stackblitz that reproduces your issue? Without it I can't really tell what's going on, thanks! 😄

@Dafnik
Copy link
Author

Dafnik commented Apr 24, 2019

Here you go: Stackblitz app
And here you can edit everything: Stackblitz edit mode

@no-response no-response bot removed the needs reply label Apr 24, 2019
@mattlewis92
Copy link
Owner

Wow, that's so weird, it's like change detection just isn't working. If I call detectChanges after the dayClicked output it fixes it (https://stackblitz.com/edit/angular-eveyex?file=src%2Fapp%2Fapp.component.ts), but that shouldn't be needed at all.

@Dafnik
Copy link
Author

Dafnik commented Apr 24, 2019

Maybe it's a bug in Angular. Anyways thank you for the "dirty fix"! :)

@cosf87
Copy link

cosf87 commented Apr 25, 2019

I have this issue after upgrading from 0.27.2 to 0.27.3 version

@mattlewis92
Copy link
Owner

Ahhhh, yes, it'll be the lazy click handlers. I'll see what I can do!

@mattlewis92
Copy link
Owner

Fixed in 0.27.6!

@Dafnik
Copy link
Author

Dafnik commented Apr 29, 2019

I don't know if this belongs here, but if I'm adding an event to the events array after ngInit (Fetching data etc from a server) it's also don't updating the complete calendar view. With cdr.detectChanges() it's working.

@mattlewis92
Copy link
Owner

@Dafnik - Can you make a repro?

@Dafnik
Copy link
Author

Dafnik commented Apr 30, 2019

@mattlewis92
Copy link
Owner

Sorry I'm not sure I can see the issue, the stackblitz is the one from this comment: #959 (comment)

@Dafnik
Copy link
Author

Dafnik commented Apr 30, 2019

Sorry, I shared the wrong url. Here you have the new one, adding an event after three seconds. I hope you can see that the calendar view isn't updating until you click on it.
https://stackblitz.com/edit/angular-ildcfe

@mattlewis92
Copy link
Owner

Oh I see the issue, it's because you're using .push which doesn't create a new array references so angular doesn't know anything changed. You need to do something which creates a new array reference like this:

this.events = [
   ...this.events,
   {
          start: addHours(startOfDay(new Date()), 2),
          end: new Date(),
          title: 'An event added after three seconds',
          color: colors.yellow,
          actions: this.actions,
          resizable: {
            beforeStart: true,
            afterEnd: true
          },
          draggable: true
        }
]

@Dafnik
Copy link
Author

Dafnik commented May 1, 2019

Ohh, thank you!

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

No branches or pull requests

3 participants