Issue 616: addEventSource renders events twice
Status:  Released
Owner: ----
Closed:  Aug 2013
Reported by renzo.la...@gmail.com, Aug 24, 2010
I've had a case, where I needed to add a googleCalender event source with addEventSource and at the same time refetch events from a json event source. Because addEventSource calls fetchEventSource, the events from the googleCalender where rendered twice.
I have added a second parameter to the function addEventSource which can be set to false to prevent it to call the fetchEventSource (see below).
Maybe you can include this in the next release as it might help in other cases...

addEventSource: function(source, update) {
  if(update == null) update = true;
  eventSources.push(source);
  if(update) fetchEventSource(source, eventsChanged);
}

Further I had a case, where addEventSource had to be called twice for the same source (googleCalendar). This again rendered the events twice. I was able to fix this by adding an inArray test for eventSources:

addEventSource: function(source, update) {
  if(update == null) update = true;
  if($.inArray(source, eventSources) < 0) eventSources.push(source);
  if(update) fetchEventSource(source, eventsChanged);
}

Aug 25, 2010
Project Member #1 adamrs...@gmail.com
thanks, but could you help me out a little by providing a demo?

"...please submit a report with a detailed description and a demonstration of the bug. This can be a link to a website or a ZIP containing a runnable HTML file. Please include everything needed to recreate the bug (JS, CSS, event JSON)."

i'd like to see the cause of the problem more in-depth. thanks!
Aug 26, 2010
#2 renzo.la...@gmail.com
Adam

I am sorry for not describing the error in more detail by giving you a demo.

I have now created a test case in the attached zip file with the two cases:
- gcal.html with fullcalendar.js which shows you the error
- gcal-fixed.html with fullcalendar-fixed.js containing my fixes described in the previous comment.
You can also check it online:
http://www.lauper.cc/gcal/gcal.html
http://www.lauper.cc/gcal/gcal-fixed.html

The file adds a json event source and one for a google calendar. If you first remove the google event source and then add it again, you will see these events twice. Clicking "Add cal and refetch" several times will add the events again and again - which is also fixed in fullcalendar-fixed.js.

I use this functionality in one of my applications where one click needs to add/remove one or more Google eventSources and refetch the events, as this click also changes the display of events retrieved through a JSON event source.
gcal.zip
90.6 KB   Download
Oct 7, 2010
Project Member #3 adamrs...@gmail.com
(No comment was entered for this change.)
Status: Reproducing
Oct 11, 2010
Project Member #4 adamrs...@gmail.com
(No comment was entered for this change.)
Summary: addEventSource renders events twice
Status: Accepted
Labels: Type-Defect
Oct 16, 2010
Project Member #5 adamrs...@gmail.com
this has been fixed in version 1.4.8 (just released). thanks!
Status: Fixed
Aug 13, 2013
Project Member #6 adamrs...@gmail.com
(No comment was entered for this change.)
Status: Implemented
Aug 13, 2013
Project Member #7 adamrs...@gmail.com
(No comment was entered for this change.)
Status: Released