Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions path.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,19 @@ exports.LinkResolving = function(model, getDataModel){
var rawResult = originalQuery.call(this, query, metadata);
if(model.links.some(function(link){ return link.resolution!==undefined; })){
return when(rawResult, function(rawResult){
var promises = rawResult.map(function(obj){
return resolve.call(self, obj, metadata);
});
// check for LazyArray
var promises;
if(rawResult instanceof LazyArray) {
promises = when(rawResult.toRealArray(), function(arr){
return arr.map(function(obj){
return resolve.call(self, obj, metadata);
});
});
} else {
promises = rawResult.map(function(obj){
return resolve.call(self, obj, metadata);
});
}
return when(all(promises), function(){ return rawResult; });
});
}
Expand Down