Permalink
Browse files

Return allLoaded instead of cachingStore's fetch, to ensure that the …

…correct result is returned
  • Loading branch information...
1 parent dd6c3a6 commit 1eef304323ea90eb91253d5320c6446268e6a938 @kriszyp kriszyp committed Feb 14, 2014
Showing with 2 additions and 8 deletions.
  1. +2 −8 Cache.js
View
@@ -95,22 +95,16 @@ define([
fetch: function () {
var cachingStore = this.cachingStore;
var store = this;
- if (this.allLoaded) {
- // everything has been loaded, use the caching store
- return when(this.allLoaded, function () {
- return store.cachingStore.fetch();
- });
- }
/* jshint boss: true */
- return this.allLoaded = when(this.inherited(arguments), function (results) {
+ return this.allLoaded || (this.allLoaded = when(this.inherited(arguments), function (results) {
arrayUtil.forEach(results, function (object) {
// store each object before calling the callback
if (!store.isLoaded || store.isLoaded(object)) {
cachingStore.put(object);
}
});
return results;
- });
+ }));
},
// canCacheQuery: Function
// this function can be overriden to provide more specific functionality for

0 comments on commit 1eef304

Please sign in to comment.