Skip to content

Commit

Permalink
Clean-up formatting and change approach for deep ref
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhefner committed Oct 8, 2020
1 parent 5e7e76b commit a9d4628
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/parsers/graphqlParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,18 @@ export function graphqlParser(rootKey, data, definitionMap, props = { include: 1
if (referenceArray) {
// Convert reference array into GraphQL
const collectionKey = `${key}Collection`
objectClone[collectionKey] = parseCollection(field, `${typename}${capitalizeFirstLetter(collectionKey)}`, definitionMap?.[collectionKey], depth + 1);
objectClone[collectionKey] = parseCollection(
field,
`${typename}${capitalizeFirstLetter(collectionKey)}`,
definitionMap?.[collectionKey],
depth + 1
);

// Delete old flat array field
delete objectClone[key];
} else {
objectClone[key] = field
.map((item, index) => cleanClone(item, object?.fields[key][index]))
.map((item, index) => cleanClone(item, object && object.fields && object.fields[key][index]))
.filter(item => !!item)
}
} else if (field &&
Expand Down

0 comments on commit a9d4628

Please sign in to comment.