@@ -79,26 +79,22 @@ export abstract class AbstractQueryProcessor<
7979 return this . options . watchOptions . reportFetching ?? true ;
8080 }
8181
82- /**
83- * Updates the underlying query.
84- */
85- async updateSettings ( settings : Settings ) {
82+ protected async updateSettingsInternal ( settings : Settings ) {
8683 // Abort any previous requests
8784 this . abortController . abort ( ) ;
8885
89- this . options . watchOptions = settings ;
9086 // Keep track of this controller's abort status
9187 const abortController = new AbortController ( ) ;
9288 // Allow this to be aborted externally
9389 this . abortController = abortController ;
9490
95- await this . initialized ;
96-
9791 // This may have been aborted while awaiting or if multiple calls to `updateSettings` were made
9892 if ( abortController . signal . aborted ) {
9993 return ;
10094 }
10195
96+ this . options . watchOptions = settings ;
97+
10298 if ( ! this . state . isFetching && this . reportFetching ) {
10399 await this . updateState ( {
104100 isFetching : true
@@ -113,6 +109,14 @@ export abstract class AbstractQueryProcessor<
113109 ) ;
114110 }
115111
112+ /**
113+ * Updates the underlying query.
114+ */
115+ async updateSettings ( settings : Settings ) {
116+ await this . initialized ;
117+ return this . updateSettingsInternal ( settings ) ;
118+ }
119+
116120 /**
117121 * This method is used to link a query to the subscribers of this listener class.
118122 * This method should perform actual query watching and report results via {@link updateState} method.
@@ -163,8 +167,8 @@ export abstract class AbstractQueryProcessor<
163167 } ;
164168
165169 // Initial setup
166- this . runWithReporting ( async ( ) => {
167- await this . updateSettings ( this . options . watchOptions ) ;
170+ await this . runWithReporting ( async ( ) => {
171+ await this . updateSettingsInternal ( this . options . watchOptions ) ;
168172 } ) ;
169173 }
170174
0 commit comments