mirror of
https://github.com/vale981/grapher
synced 2025-03-05 17:41:41 -05:00
performance fixes
This commit is contained in:
parent
6974ea17be
commit
7a7a147794
2 changed files with 5 additions and 5 deletions
|
@ -180,11 +180,13 @@ function snapBackCaches(node) {
|
||||||
// process stuff
|
// process stuff
|
||||||
_.each(node.snapCaches, (linkName, cacheField) => {
|
_.each(node.snapCaches, (linkName, cacheField) => {
|
||||||
const isSingle = _.contains(node.snapCachesSingles, cacheField);
|
const isSingle = _.contains(node.snapCachesSingles, cacheField);
|
||||||
|
const linker = node.collection.getLinker(linkName);
|
||||||
|
// we do this because for one direct and one meta direct, id is not stored
|
||||||
|
const shoudStoreLinkStorage = !linker.isMany() && !linker.isVirtual();
|
||||||
|
|
||||||
node.results.forEach(result => {
|
node.results.forEach(result => {
|
||||||
if (result[cacheField]) {
|
if (result[cacheField]) {
|
||||||
const linker = node.collection.getLinker(linkName);
|
if (shoudStoreLinkStorage) {
|
||||||
|
|
||||||
if (!linker.isMany() && !linker.isVirtual()) {
|
|
||||||
Object.assign(result[cacheField], {
|
Object.assign(result[cacheField], {
|
||||||
_id: linker.isMeta()
|
_id: linker.isMeta()
|
||||||
? result[linker.linkStorageField]._id
|
? result[linker.linkStorageField]._id
|
||||||
|
|
|
@ -41,8 +41,6 @@ describe('Query Link Cache', function () {
|
||||||
assert.isObject(post.author);
|
assert.isObject(post.author);
|
||||||
assert.isString(post.author._id);
|
assert.isString(post.author._id);
|
||||||
|
|
||||||
console.log(post.author);
|
|
||||||
|
|
||||||
unstubFind(Authors);
|
unstubFind(Authors);
|
||||||
|
|
||||||
// now that we specify an additional field, it should bypass the cache
|
// now that we specify an additional field, it should bypass the cache
|
||||||
|
|
Loading…
Add table
Reference in a new issue