some small changes to marcsj PR

This commit is contained in:
Theodor Diaconu 2017-06-27 11:56:53 +03:00
parent bf2319c80f
commit ec487ee614
2 changed files with 9 additions and 3 deletions

View file

@ -58,9 +58,14 @@ export default class Link {
let appliedFilters = _.extend({}, filters, searchFilters);
// I'm sorry.
// see https://github.com/cult-of-coders/grapher/issues/134
return (linkedCollection.find && linkedCollection.find(appliedFilters, options, userId)) || linkedCollection.default.find(appliedFilters, options, userId);
// happens due to recursive importing of modules
// TODO: find another way to do this
if (linkedCollection.find) {
return linkedCollection.find(appliedFilters, options, userId)
} else {
return linkedCollection.default.find(appliedFilters, options, userId);
}
}
/**

View file

@ -31,7 +31,8 @@ export function createNodes(root) {
}
// workaround, see https://github.com/cult-of-coders/grapher/issues/134
if(root.collection.default) {
// TODO: find another way to do this
if (root.collection.default) {
root.collection = root.collection.default;
}