File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -29,10 +29,6 @@ export class Canceller {
29
29
}
30
30
31
31
withCancellation < T > ( originalPromise : Promise < T > ) : Promise < T > {
32
- if ( this . abortSignal === undefined ) {
33
- return originalPromise ;
34
- }
35
-
36
32
const { promise, resolve, reject } = promiseWithResolvers < T > ( ) ;
37
33
const abort = ( ) => reject ( this . abortSignal . reason ) ;
38
34
this . _aborts . add ( abort ) ;
Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ class IncrementalPublisher {
127
127
IteratorResult < SubsequentIncrementalExecutionResult , void >
128
128
> => {
129
129
if ( isDone ) {
130
+ this . _context . canceller ?. unsubscribe ( ) ;
130
131
await this . _returnAsyncIteratorsIgnoringErrors ( ) ;
131
132
return { value : undefined , done : true } ;
132
133
}
@@ -173,6 +174,8 @@ class IncrementalPublisher {
173
174
batch = await this . _incrementalGraph . nextCompletedBatch ( ) ;
174
175
} while ( batch !== undefined ) ;
175
176
177
+ // TODO: add test for this case
178
+ /* c8 ignore next */
176
179
this . _context . canceller ?. unsubscribe ( ) ;
177
180
await this . _returnAsyncIteratorsIgnoringErrors ( ) ;
178
181
return { value : undefined , done : true } ;
Original file line number Diff line number Diff line change @@ -379,6 +379,8 @@ export function experimentalExecuteQueryOrMutationOrSubscriptionEvent(
379
379
}
380
380
return buildDataResponse ( exeContext , graphqlWrappedResult ) ;
381
381
} catch ( error ) {
382
+ // TODO: add test case for synchronous null bubbling to root with cancellation
383
+ /* c8 ignore next */
382
384
exeContext . canceller ?. unsubscribe ( ) ;
383
385
return { data : null , errors : withError ( exeContext . errors , error ) } ;
384
386
}
@@ -2205,6 +2207,8 @@ function executeSubscription(
2205
2207
const promise = canceller ?. withCancellation ( result ) ?? result ;
2206
2208
return promise . then ( assertEventStream ) . then (
2207
2209
( resolved ) => {
2210
+ // TODO: add test case
2211
+ /* c8 ignore next */
2208
2212
canceller ?. unsubscribe ( ) ;
2209
2213
return resolved ;
2210
2214
} ,
You can’t perform that action at this time.
0 commit comments