@@ -76,9 +76,9 @@ export function createStitchingInfo<TContext = Record<string, any>>(
7676
7777 return {
7878 subschemaMap,
79- selectionSetsByType : undefined ,
79+ selectionSetsByType : Object . create ( null ) ,
8080 selectionSetsByField,
81- dynamicSelectionSetsByField : undefined ,
81+ dynamicSelectionSetsByField : Object . create ( null ) ,
8282 mergedTypes,
8383 } ;
8484}
@@ -227,17 +227,15 @@ export function completeStitchingInfo<TContext = Record<string, any>>(
227227 resolvers : IResolvers ,
228228 schema : GraphQLSchema
229229) : StitchingInfo < TContext > {
230- const selectionSetsByType = Object . create ( null ) ;
230+ const { selectionSetsByType, selectionSetsByField, dynamicSelectionSetsByField } = stitchingInfo ;
231+
231232 const rootTypes = [ schema . getQueryType ( ) , schema . getMutationType ( ) ] ;
232233 for ( const rootType of rootTypes ) {
233234 if ( rootType ) {
234235 selectionSetsByType [ rootType . name ] = parseSelectionSet ( '{ __typename }' , { noLocation : true } ) ;
235236 }
236237 }
237238
238- const selectionSetsByField = stitchingInfo . selectionSetsByField ;
239- const dynamicSelectionSetsByField = Object . create ( null ) ;
240-
241239 for ( const typeName in resolvers ) {
242240 const type = resolvers [ typeName ] ;
243241 if ( isScalarType ( type ) ) {
@@ -288,10 +286,6 @@ export function completeStitchingInfo<TContext = Record<string, any>>(
288286 }
289287 }
290288
291- stitchingInfo . selectionSetsByType = selectionSetsByType ;
292- stitchingInfo . selectionSetsByField = selectionSetsByField ;
293- stitchingInfo . dynamicSelectionSetsByField = dynamicSelectionSetsByField ;
294-
295289 return stitchingInfo ;
296290}
297291
0 commit comments