@@ -93,10 +93,14 @@ class ParseGraphQLSchema {
9393
9494 async load ( ) {
9595 const { parseGraphQLConfig } = await this . _initializeSchemaAndConfig ( ) ;
96- const parseClasses = await this . _getClassesForSchema ( parseGraphQLConfig ) ;
96+ const parseClassesArray = await this . _getClassesForSchema ( parseGraphQLConfig ) ;
9797 const functionNames = await this . _getFunctionNames ( ) ;
9898 const functionNamesString = JSON . stringify ( functionNames ) ;
9999
100+ const parseClasses = parseClassesArray . reduce ( ( acc , clazz ) => {
101+ acc [ clazz . className ] = clazz ;
102+ return acc ;
103+ } , { } ) ;
100104 if (
101105 ! this . _hasSchemaInputChanged ( {
102106 parseClasses,
@@ -127,7 +131,7 @@ class ParseGraphQLSchema {
127131 defaultRelaySchema . load ( this ) ;
128132 schemaTypes . load ( this ) ;
129133
130- this . _getParseClassesWithConfig ( parseClasses , parseGraphQLConfig ) . forEach (
134+ this . _getParseClassesWithConfig ( parseClassesArray , parseGraphQLConfig ) . forEach (
131135 ( [ parseClass , parseClassConfig ] ) => {
132136 // Some times schema return the _auth_data_ field
133137 // it will lead to unstable graphql generation order
@@ -155,7 +159,7 @@ class ParseGraphQLSchema {
155159 }
156160 ) ;
157161
158- defaultGraphQLTypes . loadArrayResult ( this , parseClasses ) ;
162+ defaultGraphQLTypes . loadArrayResult ( this , parseClassesArray ) ;
159163 defaultGraphQLQueries . load ( this ) ;
160164 defaultGraphQLMutations . load ( this ) ;
161165
@@ -500,29 +504,17 @@ class ParseGraphQLSchema {
500504 const { parseClasses , parseGraphQLConfig , functionNamesString } = params ;
501505
502506 // First init
503- if ( ! this . parseCachedClasses || ! this . graphQLSchema ) {
504- const thisParseClassesObj = parseClasses . reduce ( ( acc , clzz ) => {
505- acc [ clzz . className ] = clzz ;
506- return acc ;
507- } , { } ) ;
508- this . parseCachedClasses = thisParseClassesObj ;
507+ if ( ! this . graphQLSchema ) {
509508 return true ;
510509 }
511510
512- const newParseCachedClasses = parseClasses . reduce ( ( acc , clzz ) => {
513- acc [ clzz . className ] = clzz ;
514- return acc ;
515- } , { } ) ;
516-
517511 if (
518512 isDeepStrictEqual ( this . parseGraphQLConfig , parseGraphQLConfig ) &&
519513 this . functionNamesString === functionNamesString &&
520- isDeepStrictEqual ( this . parseCachedClasses , newParseCachedClasses )
514+ isDeepStrictEqual ( this . parseClasses , parseClasses )
521515 ) {
522516 return false ;
523517 }
524-
525- this . parseCachedClasses = newParseCachedClasses ;
526518 return true ;
527519 }
528520}
0 commit comments