-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Events disappear when reference to events array changes #7235
Comments
just re-mounting the calendar : The consumption is too large, which is not a good solution for me。 The phenomenon you described is the same as what I saw。 |
Yea re-mounting is a bad solution, also the whole UI state is lost when re-mounting. |
I tried to load data using FN, but found that the FN method would trigger many times, which undoubtedly put a lot of pressure on back-end services. |
Reduced Test Case
https://codesandbox.io/p/sandbox/happy-visvesvaraya-kpkkxh?file=%2Fsrc%2FDemoApp.jsx
Do you understand that if a reduced test case is not provided, we will intentionally delay triaging of your ticket?
Which connector are you using (React/Angular/etc)?
React
Bug Description
Hello!
So I've been hunting down this bug for quite some time now, and I think I stumbled upon the root cause.
Initial situation
In our case, the Calendar is used in a React App that leverages
react-query
for fetching data from an API that returns events.Those events mostly have an RRule defined.
Every time the user changes the date, an API request is issued, and the events within the date range are returned.
The problem
On the first render (so the default date range), the events are displayed correctly. But as soon as the date range changes, and thus the events are updated, the rendering becomes buggy: Repeating events are not shown anymore, the calendar is empty.
Reproducing it
In the codesandbox I provided, the bug can be reproduced by changing the date range.
The example doesn't make use of any external library and just simulates the creation of a new
events
array upon date range change.After changing the date range, the calendar becomes blank.
I also discovered, that this is only the case for events with an RRule.
The event with the title
no-rrule
is correctly rendered, as you can see in the example when navigating to the next week.My interpreation
It seems that the problem is caused when the reference to the events array changes. When provided statically, this problem doesn't occur.
Temporary fix
I also tried to find a temporary fix, by just re-mounting the calendar when the event change, but this is less than ideal.
To try out the version with the fix applied, in the file
DemoApp.jsx
set the constantSHOULD_APPLY_WORKAROUND
totrue
, and the events are displayed correctly.Am I missing something very obvious here?
Should I use the non-declarative way of data fetching (data sources)?
I hope I was able to clearly state the problem.
Thanks for helping out!
Fullcalendar is great.
The text was updated successfully, but these errors were encountered: