@@ -79,26 +79,22 @@ export abstract class AbstractQueryProcessor<
79
79
return this . options . watchOptions . reportFetching ?? true ;
80
80
}
81
81
82
- /**
83
- * Updates the underlying query.
84
- */
85
- async updateSettings ( settings : Settings ) {
82
+ protected async updateSettingsInternal ( settings : Settings ) {
86
83
// Abort any previous requests
87
84
this . abortController . abort ( ) ;
88
85
89
- this . options . watchOptions = settings ;
90
86
// Keep track of this controller's abort status
91
87
const abortController = new AbortController ( ) ;
92
88
// Allow this to be aborted externally
93
89
this . abortController = abortController ;
94
90
95
- await this . initialized ;
96
-
97
91
// This may have been aborted while awaiting or if multiple calls to `updateSettings` were made
98
92
if ( abortController . signal . aborted ) {
99
93
return ;
100
94
}
101
95
96
+ this . options . watchOptions = settings ;
97
+
102
98
if ( ! this . state . isFetching && this . reportFetching ) {
103
99
await this . updateState ( {
104
100
isFetching : true
@@ -113,6 +109,14 @@ export abstract class AbstractQueryProcessor<
113
109
) ;
114
110
}
115
111
112
+ /**
113
+ * Updates the underlying query.
114
+ */
115
+ async updateSettings ( settings : Settings ) {
116
+ await this . initialized ;
117
+ return this . updateSettingsInternal ( settings ) ;
118
+ }
119
+
116
120
/**
117
121
* This method is used to link a query to the subscribers of this listener class.
118
122
* This method should perform actual query watching and report results via {@link updateState} method.
@@ -163,8 +167,8 @@ export abstract class AbstractQueryProcessor<
163
167
} ;
164
168
165
169
// 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 ) ;
168
172
} ) ;
169
173
}
170
174
0 commit comments