Fix some updating issues after non-requested data is returned by server
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 15 Jun 2009 11:02:43 +0000 (05:02 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 15 Jun 2009 18:26:44 +0000 (12:26 -0600)
imp/js/src/ViewPort.js

index 665397b..381176d 100644 (file)
@@ -638,19 +638,22 @@ var ViewPort = Class.create({
             this.opts.onCacheUpdate(r.view);
         }
 
-        if (r.request_id == this.active_req) {
+        if (r.request_id &&
+            r.request_id == this.active_req) {
             this.active_req = null;
             offset = buffer.getMetaData('req_offset');
             buffer.setMetaData({ req_offset: undefined });
 
-            // TODO: Flag for no _fetchBuffer()?
-            this._updateContent(Object.isUndefined(offset) ? (r.rownum ? Number(r.rownum) - 1 : this.currentOffset()) : offset);
-
             if (this.opts.onEndFetch) {
                 this.opts.onEndFetch();
             }
         }
 
+        // TODO: Flag for no _fetchBuffer()?
+        if (this.view == r.view) {
+            this._updateContent(Object.isUndefined(offset) ? (r.rownum ? Number(r.rownum) - 1 : this.currentOffset()) : offset);
+        }
+
         this.isbusy = false;
     },