@@ -30,7 +30,7 @@ export const operationsLoaders: Loader<string, SingleFileOptions>[] = [
30
30
document : parse ( pointer ) ,
31
31
} ) ,
32
32
} ,
33
- ]
33
+ ] ;
34
34
35
35
export type SiblingOperations = {
36
36
available : boolean ;
@@ -60,32 +60,30 @@ export function getSiblingOperations(options: ParserOptions, gqlConfig: GraphQLC
60
60
61
61
// We first try to use graphql-config for loading the operations paths, based on the type of the file,
62
62
// We are using the directory of the file as the key for the schema caching, to avoid reloading of the schema.
63
- if ( options && options . filePath && ! options . skipGraphQLConfig ) {
63
+ if ( gqlConfig && options ? .filePath ) {
64
64
const fileDir = dirname ( options . filePath ) ;
65
65
66
66
if ( operationsCache . has ( fileDir ) ) {
67
67
siblings = operationsCache . get ( fileDir ) ;
68
68
} else {
69
- if ( gqlConfig ) {
70
- const projectForFile = gqlConfig . getProjectForFile ( options . filePath ) ;
69
+ const projectForFile = gqlConfig . getProjectForFile ( options . filePath ) ;
71
70
72
- if ( projectForFile ) {
73
- siblings = projectForFile . getDocumentsSync ( ) ;
74
- operationsCache . set ( fileDir , siblings ) ;
75
- }
71
+ if ( projectForFile ) {
72
+ siblings = projectForFile . getDocumentsSync ( ) ;
73
+ operationsCache . set ( fileDir , siblings ) ;
76
74
}
77
75
}
78
76
}
79
77
80
- if ( options && options . operations && ! siblings ) {
78
+ if ( ! siblings && options ? .operations ) {
81
79
const loadPaths = Array . isArray ( options . operations ) ? options . operations : [ options . operations ] || [ ] ;
82
80
const loadKey = loadPaths . join ( ',' ) ;
83
81
84
- if ( ! operationsCache . has ( loadKey ) ) {
82
+ if ( operationsCache . has ( loadKey ) ) {
83
+ siblings = operationsCache . get ( loadKey ) ;
84
+ } else {
85
85
siblings = loadSiblings ( process . cwd ( ) , loadPaths ) ;
86
86
operationsCache . set ( loadKey , siblings ) ;
87
- } else {
88
- siblings = operationsCache . get ( loadKey ) ;
89
87
}
90
88
}
91
89
0 commit comments