Skip to content

Commit 9f634a8

Browse files
committed
add todos
1 parent 3cf7d57 commit 9f634a8

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/execution/Canceller.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ export class Canceller {
2929
}
3030

3131
withCancellation<T>(originalPromise: Promise<T>): Promise<T> {
32-
if (this.abortSignal === undefined) {
33-
return originalPromise;
34-
}
35-
3632
const { promise, resolve, reject } = promiseWithResolvers<T>();
3733
const abort = () => reject(this.abortSignal.reason);
3834
this._aborts.add(abort);

src/execution/IncrementalPublisher.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ class IncrementalPublisher {
127127
IteratorResult<SubsequentIncrementalExecutionResult, void>
128128
> => {
129129
if (isDone) {
130+
this._context.canceller?.unsubscribe();
130131
await this._returnAsyncIteratorsIgnoringErrors();
131132
return { value: undefined, done: true };
132133
}
@@ -173,6 +174,8 @@ class IncrementalPublisher {
173174
batch = await this._incrementalGraph.nextCompletedBatch();
174175
} while (batch !== undefined);
175176

177+
// TODO: add test for this case
178+
/* c8 ignore next */
176179
this._context.canceller?.unsubscribe();
177180
await this._returnAsyncIteratorsIgnoringErrors();
178181
return { value: undefined, done: true };

src/execution/execute.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ export function experimentalExecuteQueryOrMutationOrSubscriptionEvent(
379379
}
380380
return buildDataResponse(exeContext, graphqlWrappedResult);
381381
} catch (error) {
382+
// TODO: add test case for synchronous null bubbling to root with cancellation
383+
/* c8 ignore next */
382384
exeContext.canceller?.unsubscribe();
383385
return { data: null, errors: withError(exeContext.errors, error) };
384386
}
@@ -2205,6 +2207,8 @@ function executeSubscription(
22052207
const promise = canceller?.withCancellation(result) ?? result;
22062208
return promise.then(assertEventStream).then(
22072209
(resolved) => {
2210+
// TODO: add test case
2211+
/* c8 ignore next */
22082212
canceller?.unsubscribe();
22092213
return resolved;
22102214
},

0 commit comments

Comments
 (0)