Skip to content

Commit 048fbb5

Browse files
more fixes
1 parent 4ee5d2c commit 048fbb5

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

packages/common/src/client/watched/processors/AbstractQueryProcessor.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,9 @@ export abstract class AbstractQueryProcessor<
7979
return this.options.watchOptions.reportFetching ?? true;
8080
}
8181

82-
protected async updateSettingsInternal(settings: Settings) {
83-
// Abort any previous requests
84-
this.abortController.abort();
85-
86-
// Keep track of this controller's abort status
87-
const abortController = new AbortController();
88-
// Allow this to be aborted externally
89-
this.abortController = abortController;
90-
82+
protected async updateSettingsInternal(settings: Settings, signal: AbortSignal) {
9183
// This may have been aborted while awaiting or if multiple calls to `updateSettings` were made
92-
if (abortController.signal.aborted) {
84+
if (signal.aborted) {
9385
return;
9486
}
9587

@@ -103,7 +95,7 @@ export abstract class AbstractQueryProcessor<
10395

10496
await this.runWithReporting(() =>
10597
this.linkQuery({
106-
abortSignal: abortController.signal,
98+
abortSignal: signal,
10799
settings
108100
})
109101
);
@@ -113,8 +105,16 @@ export abstract class AbstractQueryProcessor<
113105
* Updates the underlying query.
114106
*/
115107
async updateSettings(settings: Settings) {
108+
// Abort any previous requests
109+
this.abortController.abort();
110+
111+
// Keep track of this controller's abort status
112+
const abortController = new AbortController();
113+
// Allow this to be aborted externally
114+
this.abortController = abortController;
115+
116116
await this.initialized;
117-
return this.updateSettingsInternal(settings);
117+
return this.updateSettingsInternal(settings, abortController.signal);
118118
}
119119

120120
/**
@@ -168,7 +168,7 @@ export abstract class AbstractQueryProcessor<
168168

169169
// Initial setup
170170
await this.runWithReporting(async () => {
171-
await this.updateSettingsInternal(this.options.watchOptions);
171+
await this.updateSettingsInternal(this.options.watchOptions, this.abortController.signal);
172172
});
173173
}
174174

0 commit comments

Comments
 (0)