From: Jan Schneider Date: Fri, 21 May 2010 17:33:14 +0000 (+0200) Subject: Catch if events from ajax response are not for the current view anymore. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=64e56135c87a64deda6ab1a1a0877fb323d0cc9c;p=horde.git Catch if events from ajax response are not for the current view anymore. --- diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index bad00cfae..e0828e8c5 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -1339,17 +1339,24 @@ KronolithCore = { var start = this.parseDate(r.response.sig.substr(0, 8)), end = this.parseDate(r.response.sig.substr(8, 8)), - dates = [start, end]; + dates = [start, end], + currentDates; this.storeCache(r.response.events || {}, r.response.cal, dates); // Check if this is the still the result of the most current request. - if (r.response.view != this.view || - r.response.sig != this.eventsLoading[r.response.cal]) { + if (r.response.sig != this.eventsLoading[r.response.cal]) { return; } delete this.eventsLoading[r.response.cal]; + // Check if the result is still for the current view. + currentDates = this.viewDates(this.date, this.view); + if (r.response.view != this.view || + !currentDates[0].equals(start)) { + return; + } + if (this.view != 'year' || !$H(this.eventsLoading).size()) { this.insertEvents(dates, this.view, r.response.cal); }