Skip to content

Commit

Permalink
Preserve totalLength, refs #97
Browse files Browse the repository at this point in the history
Preserves totalLength in a back-compat way for 1.0
  • Loading branch information
kriszyp committed Mar 20, 2015
1 parent 380e1eb commit 7064a1c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Trackable.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ define([
'dojo/when',
'dojo/promise/all',
'dojo/_base/array',
'dojo/on'
'dojo/on',
'./QueryResults'
/*=====, './api/Store' =====*/
], function (lang, declare, aspect, when, whenAll, arrayUtil, on /*=====, Store =====*/) {
], function (lang, declare, aspect, when, whenAll, arrayUtil, on, QueryResults /*=====, Store =====*/) {

// module:
// dstore/Trackable
Expand Down Expand Up @@ -95,13 +96,16 @@ define([
function makeFetch() {
return function () {
var self = this;
return when(this.inherited(arguments), function (results) {
var fetchResults = this.inherited(arguments);
return new QueryResults(when(fetchResults, function (results) {
results = self._results = results.slice();

self._ranges = [];
registerRange(self._ranges, 0, results.length);

return results;
}), {
totalLength: fetchResults.totalLength
});
};
}
Expand Down

0 comments on commit 7064a1c

Please sign in to comment.