Skip to content

Commit

Permalink
feat(visitResult): ignore if field not present in visited object
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Feb 24, 2022
1 parent 66ffb1a commit baf807b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/healthy-rules-knock.md
@@ -0,0 +1,5 @@
---
'@graphql-tools/utils': patch
---

feat(visitResult): ignore if field not present in visited object
2 changes: 1 addition & 1 deletion packages/utils/src/visitResult.ts
Expand Up @@ -222,7 +222,7 @@ function visitObjectValue(

for (const [responseKey, subFieldNodes] of fieldNodeMap) {
const fieldName = subFieldNodes[0].name.value;
const fieldType = fieldName === '__typename' ? TypeNameMetaFieldDef.type : fieldMap[fieldName].type;
const fieldType = fieldName === '__typename' ? TypeNameMetaFieldDef.type : fieldMap[fieldName]?.type;

const newPathIndex = pathIndex + 1;

Expand Down

1 comment on commit baf807b

@vercel
Copy link

@vercel vercel bot commented on baf807b Feb 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.