mirror of
https://github.com/vale981/grapher
synced 2025-03-05 09:31:42 -05:00
Fixes #309 - weird removal due to link handling
This commit is contained in:
parent
8e94ce89cf
commit
b55be7045e
2 changed files with 14 additions and 2 deletions
|
@ -84,6 +84,17 @@ export default class Link {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is just like fetch() but forces to get an array even if it's single result
|
||||||
|
*
|
||||||
|
* @param {*} filters
|
||||||
|
* @param {*} options
|
||||||
|
* @param {...any} others
|
||||||
|
*/
|
||||||
|
fetchAsArray(filters, options, ...others) {
|
||||||
|
return this.find(filters, options, ...others).fetch()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When we are dealing with multiple type relationships, $in would require an array. If the field value is null, it will fail
|
* When we are dealing with multiple type relationships, $in would require an array. If the field value is null, it will fail
|
||||||
* We use clean to make it an empty array by default.
|
* We use clean to make it an empty array by default.
|
||||||
|
|
|
@ -7,6 +7,7 @@ import smartArguments from './linkTypes/lib/smartArguments';
|
||||||
import dot from 'dot-object';
|
import dot from 'dot-object';
|
||||||
import { check } from 'meteor/check';
|
import { check } from 'meteor/check';
|
||||||
import { _ } from 'meteor/underscore';
|
import { _ } from 'meteor/underscore';
|
||||||
|
import { access } from 'fs';
|
||||||
|
|
||||||
export default class Linker {
|
export default class Linker {
|
||||||
/**
|
/**
|
||||||
|
@ -298,9 +299,9 @@ export default class Linker {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let accessor = this.createLink(doc);
|
const accessor = this.createLink(doc);
|
||||||
|
|
||||||
_.each(accessor.fetch(), linkedObj => {
|
_.each(accessor.fetchAsArray(), linkedObj => {
|
||||||
const { relatedLinker } = this.linkConfig;
|
const { relatedLinker } = this.linkConfig;
|
||||||
// We do this check, to avoid self-referencing hell when defining virtual links
|
// We do this check, to avoid self-referencing hell when defining virtual links
|
||||||
// Virtual links if not found "compile-time", we will try again to reprocess them on Meteor.startup
|
// Virtual links if not found "compile-time", we will try again to reprocess them on Meteor.startup
|
||||||
|
|
Loading…
Add table
Reference in a new issue