Skip to content

Commit d79b0ca

Browse files
authored
Dispose the cancellation callbacks used in Razor document synchronization.
1 parent a11c42a commit d79b0ca

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/razor/src/document/razorDocumentSynchronizer.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ export class RazorDocumentSynchronizer {
119119
}
120120

121121
private removeSynchronization(context: SynchronizationContext) {
122+
context.dispose();
123+
122124
const documentKey = getUriPath(context.projectedDocument.uri);
123125
const synchronizations = this.synchronizations[documentKey];
124126
clearTimeout(context.timeoutId);
@@ -167,6 +169,11 @@ export class RazorDocumentSynchronizer {
167169
reject(reason);
168170
}
169171
},
172+
dispose: () => {
173+
while (rejectionsForCancel.length > 0) {
174+
rejectionsForCancel.pop();
175+
}
176+
},
170177
projectedDocumentSynchronized,
171178
onProjectedDocumentSynchronized,
172179
projectedTextDocumentSynchronized,
@@ -271,4 +278,5 @@ interface SynchronizationContext {
271278
readonly projectedTextDocumentSynchronized: () => void;
272279
readonly onProjectedTextDocumentSynchronized: Promise<void>;
273280
readonly cancel: (reason: string) => void;
281+
readonly dispose: () => void;
274282
}

0 commit comments

Comments
 (0)