| Issue 679: | after adding multiple eventsources in a loop, events for some of the sources are not displayed | |
| 2 people starred this issue and may be notified of changes. | Back to list |
I don't have a portable use case at this time, i wanted to report it incase someone else has seen this.
with 1.4.8 , i add two eventsources (in a loop), which are urls returning JSON, each returns one event, the async requests both fire and somehow upon return the event from only one is shown on the calendar.
both URL's are fetched, as shown by net tab in firebug, both responses have data, somehow these overlap and one event is lost.
my project is behind a login currently, i'll try to make a public version and update this bug.
if i make the $.ajax() request synchronous everything works correctly:
$.ajax({
url: src,
async:false, //<<< needed for a bug in fetching >>???
dataType: 'json',
data: params,
when it is failing, i print out the number of events in the clientEvents array and it appears that the events from the second source are not in that array.
i suspect there is a variable that is inflight and overwritten if the second request returns before the first ?
Oct 20, 2010
this is the assumption i'm questioning
if ( savedID == fetchID && eventStart <= currentView.visStart && eventEnd >= currentView.visEnd) {
// same fetchEventSources call, and still in correct date range
>>>> savedID == fetchID
does not indicate same fetchEventSources call, only that it returned before it was called again, which is not always true and should not be required, right ?
Oct 20, 2010
These changes appear to work
>> use a var for the callback, should ensure we don't re-enter this from different ajax() calls
var sourceDone = function (source, sourceEvents) {
>> comment out check for savedID
if ( /*savedID == fetchID && */ eventStart <= currentView.visStart && eventEnd >= currentView.visEnd) {
this is working in my testing so far.
Oct 20, 2010
vnehess, thanks you for looking at this. i am quite familiar with this code as i just coded it for 1.4.8. i understand where the bug is and i will come up with a fix asap.
Status:
Accepted
Oct 22, 2010
Thanks for your work on this project, the code re-org looks very well thought out. ping me if you ever need a job!
Nov 21, 2010
ok, this is fixed in 1.4.9 (just released). thanks for the report
Status:
Fixed
Aug 13, 2013
(No comment was entered for this change.)
Status:
Implemented
Aug 13, 2013
(No comment was entered for this change.)
Status:
Released
|
|
| ► Sign in to add a comment |
i think understand the issue, don't have a fix / diff yet given: local var fetchID = 0; [..] my code calls addEventSource, twice quickly to get data into the calendar therefore two calls to : function fetchEventSources(sources, callback) { var savedID = ++fetchID; <<< ?? bug ?? fetchID is now incremented twice while the first $.ajax() call goes out and comes back with a valid payload the following code executes if (savedID == fetchID && eventStart < blah, blah... So the valid first payload sees savedID < fetchID and discards the payload from the first event source the second source comes back and savedID == fetchID is now true , so events are loaded This can and should happen anytime multiple event sources are added quickly, when there is latency in the database callbacks > the rate event sources are added. I'm not sure that the callback sourceDone() can access a global variable to determine if the payload is the correct one. Actually i'm mostly sure that is incorrect. since i don't understand the use of savedID (except to deny my payload) i may comment it out.