Skip to content

Commit 257499f

Browse files
committed
fix error
1 parent 7150ad9 commit 257499f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/gatsby/src/schema/schema.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ const addInferredChildOfExtension = ({ schemaComposer, typeComposer }) => {
10411041
const many = maxChildCount > 1
10421042

10431043
// Add `@childOf` extension automatically unless it is already set for this type
1044-
if (!childOfExtension?.types.includes(parentTypeName)) {
1044+
if (!childOfExtension?.types?.includes(parentTypeName)) {
10451045
// Adding children fields to types with the `@dontInfer` extension is deprecated
10461046
// Only warn when the parent-child relation has not been explicitly set with
10471047
if (shouldInfer === false) {
@@ -1062,7 +1062,7 @@ const addInferredChildOfExtension = ({ schemaComposer, typeComposer }) => {
10621062
// This will cause convenience children fields like `childImageSharp`
10631063
// to be added in `addConvenienceChildrenFields` method.
10641064
// Also required for proper printing of the `@childOf` directive in the snapshot plugin
1065-
if (!childOfExtension) {
1065+
if (!childOfExtension?.types) {
10661066
// FIXME: `many` is applied to all parent types equally which seems wrong?
10671067
childOfExtension = { types: [] }
10681068
if (many) {

0 commit comments

Comments
 (0)