Return before removing the event, if this is not the most recent response.
authorJan Schneider <jan@horde.org>
Thu, 10 Jun 2010 23:15:40 +0000 (01:15 +0200)
committerJan Schneider <jan@horde.org>
Thu, 10 Jun 2010 23:24:06 +0000 (01:24 +0200)
kronolith/js/kronolith.js

index c48bb10..1bf1631 100644 (file)
@@ -4414,7 +4414,10 @@ KronolithCore = {
                         view_end: end,
                         att: $H({ offDays: diff }).toJSON() },
                       function(r) {
-                          if (r.response.events) {
+                          // Check if this is the still the result of the most
+                          // current request.
+                          if (r.response.events &&
+                              r.response.sig == this.eventsLoading[r.response.cal]) {
                               var days;
                               if ((this.view == 'month' &&
                                    Kronolith.conf.max_events) ||
@@ -4552,7 +4555,10 @@ KronolithCore = {
               att: attributes.toJSON()
             },
             function(r) {
-                if (r.response.events) {
+                // Check if this is the still the result of the most current
+                // request.
+                if (r.response.events &&
+                    r.response.sig == this.eventsLoading[r.response.cal]) {
                     this.removeEvent(event.key, event.value.calendar);
                 }
                 this.loadEventsCallback(r);