@@ -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