Skip to content

Commit 7064a1c

Browse files
committed
Preserve totalLength, refs #97
Preserves totalLength in a back-compat way for 1.0
1 parent 380e1eb commit 7064a1c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Trackable.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ define([
55
'dojo/when',
66
'dojo/promise/all',
77
'dojo/_base/array',
8-
'dojo/on'
8+
'dojo/on',
9+
'./QueryResults'
910
/*=====, './api/Store' =====*/
10-
], function (lang, declare, aspect, when, whenAll, arrayUtil, on /*=====, Store =====*/) {
11+
], function (lang, declare, aspect, when, whenAll, arrayUtil, on, QueryResults /*=====, Store =====*/) {
1112

1213
// module:
1314
// dstore/Trackable
@@ -95,13 +96,16 @@ define([
9596
function makeFetch() {
9697
return function () {
9798
var self = this;
98-
return when(this.inherited(arguments), function (results) {
99+
var fetchResults = this.inherited(arguments);
100+
return new QueryResults(when(fetchResults, function (results) {
99101
results = self._results = results.slice();
100102

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

104106
return results;
107+
}), {
108+
totalLength: fetchResults.totalLength
105109
});
106110
};
107111
}

0 commit comments

Comments
 (0)