diff --git a/src/util/make_model.js b/src/util/make_model.js index 851c87b..e167db2 100644 --- a/src/util/make_model.js +++ b/src/util/make_model.js @@ -61,11 +61,8 @@ export default (options={}) => { limit = _cache.upstream_limit || _cache.count || Infinity // be lazy 1: if the data is presented, return the value immediately - // - // note that Array.every(list) == true if list is empty - let _portion = _cache.data.slice(offset, offset+limit) - if (_portion.length > 0 && _portion.every(data => data != undefined)) - return Promise.resolve(_portion) + if (this.data(offset, limit).length > 0 && !this.data(offset, limit).includes(undefined)) + return Promise.resolve(this.data(offset, limit)) // be lazy 2: if there is a promise, return it if ambient matches or // cancel it