fullcalendar / fullcalendar-react

The official React Component for FullCalendar
https://fullcalendar.io/docs/react
MIT License
2.09k stars 110 forks source link

"Maximum update depth exceeded" error when updating event state on datesSet with dateIncrement in days #131

Closed saramcicchi closed 2 years ago

saramcicchi commented 3 years ago

In a custom view, when the dateIncrement is set to { day: # } as opposed to a string "hh:mm", a "Maximum update depth exceeded" error occurs.

https://codesandbox.io/s/full-calendar-date-increment-bug-yo87v?file=/src/DemoApp.jsx

The above sandbox initially works. But if you comment out the dateIncrement: "24:00" and uncomment the dateIncrement: { days: 1 }, an error occurs. image

acerix commented 3 years ago

I believe the issue is with updating the event state from datesSet which causes a loop, and likely the same cause as in this issue:

https://github.com/fullcalendar/fullcalendar/issues/7069

eg. there is no error by commenting out "datesSet":

https://codesandbox.io/s/full-calendar-date-increment-bug-forked-1p5e1?file=/src/DemoApp.jsx

It does seem like a bug and I'm not sure why dateIncrement is related, but if you want to supply dynamic events based on dates of the view, you can supply the events "as a function" which is designed for that:

https://fullcalendar.io/docs/events-function

sseemmiin commented 3 years ago

same as me on 5.8.0

brandonklk commented 3 years ago

same as me on 5.10.0

arshaw commented 2 years ago

This is been fixed in v5.11.2

Updated demo: https://codesandbox.io/s/full-calendar-date-increment-bug-forked-fhxz4q?file=/src/DemoApp.jsx