Skip to content

Commit

Permalink
prevent resolver from breaking when no existing node exists
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerBarnes committed Feb 27, 2021
1 parent 4226459 commit a9b139c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const buildGatsbyNodeObjectResolver = ({ field, fieldName }) => async (
schema: { typePrefix: prefix },
} = getPluginOptions()

if (!existingNode.__typename.startsWith(prefix)) {
if (existingNode?.__typename && !existingNode.__typename.startsWith(prefix)) {
existingNode.__typename = buildTypeName(existingNode.__typename)
}

Expand Down

0 comments on commit a9b139c

Please sign in to comment.