File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
packages/gatsby/src/schema Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -1040,13 +1040,10 @@ const addInferredChildOfExtension = ({ schemaComposer, typeComposer }) => {
10401040 let childOfExtension = childTypeComposer . getExtension ( `childOf` )
10411041 const many = maxChildCount > 1
10421042
1043- // Only warn when the parent-child relation has not been explicitly set with
1044- if (
1045- ! childOfExtension ||
1046- ! childOfExtension . types . includes ( parentTypeName ) ||
1047- childOfExtension . many !== many
1048- ) {
1043+ // Add `@childOf` extension automatically unless it is already set for this type
1044+ if ( ! childOfExtension ?. types . includes ( parentTypeName ) ) {
10491045 // Adding children fields to types with the `@dontInfer` extension is deprecated
1046+ // Only warn when the parent-child relation has not been explicitly set with
10501047 if ( shouldInfer === false ) {
10511048 const fieldName = many
10521049 ? fieldNames . convenienceChildren ( typeName )
@@ -1072,9 +1069,7 @@ const addInferredChildOfExtension = ({ schemaComposer, typeComposer }) => {
10721069 childOfExtension . many = many
10731070 }
10741071 }
1075- if ( ! childOfExtension . types . includes ( parentTypeName ) ) {
1076- childOfExtension . types . push ( parentTypeName )
1077- }
1072+ childOfExtension . types . push ( parentTypeName )
10781073 childTypeComposer . setExtension ( `childOf` , childOfExtension )
10791074 }
10801075 } )
You can’t perform that action at this time.
0 commit comments