You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] All items not loading when calendar loading fails #4243
MagicMirror² version: 2.37.0
Node version: 26.3.0
npm version: 11.16.0
Platform: Raspberry Pi OS and MacOS
Which start option are you using?
node --run start
Are you using PM2?
Yes
Module
calendar
Have you tried disabling other modules?
Yes
No
Have you searched if someone else has already reported the issue on the forum or in the issues?
Yes
What did you do?
When i started up the program on my mirror all of a sudden all modules wouldn't load anymore. I tried disabling all other modules and found that the issue was in the calendar module.
What did you expect to happen?
I expected everything to startup as usually where all modules load.
What actually happened?
When the calendar has no entry for a single day, the while loop in the calendar module does not increment the counter and it gets into an infinite loop. That causes the whole system to become stuck and stop loading the calendar and other modules.
while(daysCollected<this.config.limitDays){constdateStr=currentDate.format("YYYY-MM-DD");// Check if there are events on the currentDateif(eventsByDate[dateStr]&&eventsByDate[dateStr].length>0){// If there are any events today then get all those events and select the currently active events and the events that are starting later in the day.newEvents.push(...eventsByDate[dateStr].filter((ev)=>this.timestampToMoment(ev.endDate).isAfter(moment())));// Since we found a day with events, increase the daysCollected by 1daysCollected++;// <---- THIS LINE SHOULD BE OUTSIDE THIS IF STATEMENT}// Search for the next daycurrentDate.add(1,"day");}
Additional comments
I have made a fix for this so i will submit this in the coming days when i find the time for it. Should be quite soon since it is only a one line fix.
Participation
I am willing to submit a pull request for this change.
Activity
Fixes issue 4243: Ensure while loop in calendar module does not get s…