mirror of
https://github.com/vale981/grapher
synced 2025-03-05 09:31:42 -05:00
Fixed #304 , options to reducers no longer fail
This commit is contained in:
parent
a070922c2c
commit
863eb5075e
1 changed files with 6 additions and 1 deletions
|
@ -44,8 +44,13 @@ function cleanNestedFields(parts, results, root) {
|
|||
const snapCacheField = root.snapCaches[parts[0]];
|
||||
const fieldName = snapCacheField ? snapCacheField : parts[0];
|
||||
|
||||
if (parts.length === 1) {
|
||||
// We add this rule because if by any chance you use your reducer in conjunction with $options, $filters
|
||||
// They are removed from the body and will no longer be present.
|
||||
if (!root[fieldName]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (parts.length === 1) {
|
||||
results.forEach(result => {
|
||||
if (_.isObject(result) && fieldName !== '_id') {
|
||||
delete result[fieldName];
|
||||
|
|
Loading…
Add table
Reference in a new issue