@@ -8,12 +8,7 @@ import {
8
8
isObservable ,
9
9
Unsubscribable ,
10
10
} from '@graphiql/toolkit' ;
11
- import {
12
- ExecutionResult ,
13
- FragmentDefinitionNode ,
14
- GraphQLError ,
15
- print ,
16
- } from 'graphql' ;
11
+ import { ExecutionResult , GraphQLError , print } from 'graphql' ;
17
12
import { getFragmentDependenciesForAST } from 'graphql-language-service' ;
18
13
import setValue from 'set-value' ;
19
14
import getValue from 'get-value' ;
@@ -185,9 +180,10 @@ export const createExecutionSlice: CreateExecutionSlice =
185
180
queryId : 0 ,
186
181
actions : {
187
182
stop ( ) {
188
- const { subscription } = get ( ) ;
189
- subscription ?. unsubscribe ( ) ;
190
- set ( { isFetching : false , subscription : null } ) ;
183
+ set ( ( { subscription } ) => {
184
+ subscription ?. unsubscribe ( ) ;
185
+ return { isFetching : false , subscription : null } ;
186
+ } ) ;
191
187
} ,
192
188
async run ( ) {
193
189
const {
@@ -258,12 +254,9 @@ export const createExecutionSlice: CreateExecutionSlice =
258
254
const fragmentDependencies = documentAST
259
255
? getFragmentDependenciesForAST ( documentAST , externalFragments )
260
256
: [ ] ;
261
- if ( fragmentDependencies . length > 0 ) {
257
+ if ( fragmentDependencies . length ) {
262
258
query +=
263
- '\n' +
264
- fragmentDependencies
265
- . map ( ( node : FragmentDefinitionNode ) => print ( node ) )
266
- . join ( '\n' ) ;
259
+ '\n' + fragmentDependencies . map ( node => print ( node ) ) . join ( '\n' ) ;
267
260
}
268
261
269
262
setResponse ( '' ) ;
0 commit comments