Skip to content

Commit

Permalink
fix: did not properly build queries from root payload
Browse files Browse the repository at this point in the history
  • Loading branch information
kukeiko committed Dec 28, 2017
1 parent eea8edf commit 9583234
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/caching/query-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ export class QueryCache {
this._merge(query);

if (payload) {
// todo: hackity hack to to this here
let metadata = getEntityMetadata(query.entityType);
let pkName = metadata.primaryKey.dtoName;
let ids = new Set();

for (let i = 0; i < payload.length; ++i) {
ids.add(payload[i][pkName]);
}

this._merge(Query.ByIds({
entity: metadata.entityType,
ids: Array.from(ids.values()),
expand: query.expansions
}));

this._buildQueriesFromPayload(getEntityMetadata(query.entityType), payload, query.expansions.slice());
}
}
Expand Down

0 comments on commit 9583234

Please sign in to comment.