Skip to content

Commit

Permalink
fix: don't create empty ByIds queries when loading virtuals @ service…
Browse files Browse the repository at this point in the history
…-cluster
  • Loading branch information
kukeiko committed Dec 28, 2017
1 parent f0eddda commit eea8edf
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/execution/service-cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,13 @@ export class ServiceCluster {
keys.add(e[keyName]);
});

promises.push(this._loadIntoWorkspace(Query.ByIds({
ids: Array.from(keys),
entity: nav.otherType,
expand: v.extracted.expansions
})));
if (keys.size > 0) {
promises.push(this._loadIntoWorkspace(Query.ByIds({
ids: Array.from(keys),
entity: nav.otherType,
expand: v.extracted.expansions
})));
}
break;

case "array:child":
Expand Down Expand Up @@ -331,11 +333,13 @@ export class ServiceCluster {
keys.forEach(k => refKeys.add(k));
});

promises.push(this._loadIntoWorkspace(Query.ByIds({
ids: Array.from(keys),
entity: nav.otherType,
expand: v.extracted.expansions
})));
if (keys.size > 0) {
promises.push(this._loadIntoWorkspace(Query.ByIds({
ids: Array.from(keys),
entity: nav.otherType,
expand: v.extracted.expansions
})));
}
break;
}
});
Expand Down

0 comments on commit eea8edf

Please sign in to comment.