@@ -93,10 +93,14 @@ class ParseGraphQLSchema {
93
93
94
94
async load ( ) {
95
95
const { parseGraphQLConfig } = await this . _initializeSchemaAndConfig ( ) ;
96
- const parseClasses = await this . _getClassesForSchema ( parseGraphQLConfig ) ;
96
+ const parseClassesArray = await this . _getClassesForSchema ( parseGraphQLConfig ) ;
97
97
const functionNames = await this . _getFunctionNames ( ) ;
98
98
const functionNamesString = JSON . stringify ( functionNames ) ;
99
99
100
+ const parseClasses = parseClassesArray . reduce ( ( acc , clazz ) => {
101
+ acc [ clazz . className ] = clazz ;
102
+ return acc ;
103
+ } , { } ) ;
100
104
if (
101
105
! this . _hasSchemaInputChanged ( {
102
106
parseClasses,
@@ -127,7 +131,7 @@ class ParseGraphQLSchema {
127
131
defaultRelaySchema . load ( this ) ;
128
132
schemaTypes . load ( this ) ;
129
133
130
- this . _getParseClassesWithConfig ( parseClasses , parseGraphQLConfig ) . forEach (
134
+ this . _getParseClassesWithConfig ( parseClassesArray , parseGraphQLConfig ) . forEach (
131
135
( [ parseClass , parseClassConfig ] ) => {
132
136
// Some times schema return the _auth_data_ field
133
137
// it will lead to unstable graphql generation order
@@ -155,7 +159,7 @@ class ParseGraphQLSchema {
155
159
}
156
160
) ;
157
161
158
- defaultGraphQLTypes . loadArrayResult ( this , parseClasses ) ;
162
+ defaultGraphQLTypes . loadArrayResult ( this , parseClassesArray ) ;
159
163
defaultGraphQLQueries . load ( this ) ;
160
164
defaultGraphQLMutations . load ( this ) ;
161
165
@@ -500,29 +504,17 @@ class ParseGraphQLSchema {
500
504
const { parseClasses , parseGraphQLConfig , functionNamesString } = params ;
501
505
502
506
// 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 ) {
509
508
return true ;
510
509
}
511
510
512
- const newParseCachedClasses = parseClasses . reduce ( ( acc , clzz ) => {
513
- acc [ clzz . className ] = clzz ;
514
- return acc ;
515
- } , { } ) ;
516
-
517
511
if (
518
512
isDeepStrictEqual ( this . parseGraphQLConfig , parseGraphQLConfig ) &&
519
513
this . functionNamesString === functionNamesString &&
520
- isDeepStrictEqual ( this . parseCachedClasses , newParseCachedClasses )
514
+ isDeepStrictEqual ( this . parseClasses , parseClasses )
521
515
) {
522
516
return false ;
523
517
}
524
-
525
- this . parseCachedClasses = newParseCachedClasses ;
526
518
return true ;
527
519
}
528
520
}
0 commit comments