Issue 2559: Preventing EventSource duplicity
Status:  Done
Owner: ----
Closed:  Aug 2015
Reported by koli...@finreport.cz, Aug 10, 2015
Hello, I'm trying to solve an issue with duplicity while refetching EventSources.

In best case scenario there will be request followed by response as shown in the first image attached.

In worst case scenario which I'm trying to solve, the response gets delayed and since the second response comes immediately after the first one, all the events will be rendered twice.

It my code I'm trying to make a use of loading callback where I'm incrementing variable for every request and decreasing for every response. After decreasing I'm checking if the variable is bigger than 0 (request got delayed) and if so, I'm calling removeEvents method.

  var loading = 0;
  function fullcalendar_loading(is_loading, view){
    if(is_loading) {
      loading++;      
    }
    else {
      loading--;
      if(loading) {
        $('#calendar').fullCalendar('removeEvents');
      }
    }
  }

However this is not working our for me.

I'd LOVE to know if there's an option to stop loading or any other proper way to deal with duplicity.
Thanks for you response.

good.jpg
50.4 KB   View   Download
bad.jpg
49.9 KB   View   Download
Aug 13, 2015
Project Member #1 adamrs...@gmail.com
im not 100% sure i understand the problem as described, but you probably don't want to be calling removeEvents in the loading callback. would try to keep it simple and call refetchEvents and use the events (as a function) to gather the events. invert the flow. sorry i can't help more.
Status: Done
Aug 13, 2015
#2 koli...@finreport.cz
Basically if fullcalendar compares the eventSources everytime when trying to add a new one, and stop adding it if theese two are exactly the same (same number of keys, same keys and their values). It would solve the problem.

If you could point me where in the source code is this being processed. I would be able to solve it by myself.

Also THANKS A LOT for your awesome plugin!
I love it.