@@ -68,7 +68,7 @@ export abstract class AbstractQueryProcessor<
6868 this . _closed = false ;
6969 this . state = this . constructInitialState ( ) ;
7070 this . disposeListeners = null ;
71- this . initialized = this . init ( ) ;
71+ this . initialized = this . init ( this . abortController . signal ) ;
7272 }
7373
7474 protected constructInitialState ( ) : WatchedQueryState < Data > {
@@ -113,7 +113,7 @@ export abstract class AbstractQueryProcessor<
113113 * Updates the underlying query.
114114 */
115115 async updateSettings ( settings : Settings ) {
116- // Abort any previous requests
116+ // Abort the previous request
117117 this . abortController . abort ( ) ;
118118
119119 // Keep track of this controller's abort status
@@ -154,11 +154,8 @@ export abstract class AbstractQueryProcessor<
154154 /**
155155 * Configures base DB listeners and links the query to listeners.
156156 */
157- protected async init ( ) {
157+ protected async init ( signal : AbortSignal ) {
158158 const { db } = this . options ;
159- // Make a ref copy of this early since it might be updated by updateSettings while this
160- // method is running
161- const { abortController } = this ;
162159
163160 const disposeCloseListener = db . registerListener ( {
164161 closing : async ( ) => {
@@ -183,7 +180,7 @@ export abstract class AbstractQueryProcessor<
183180
184181 // Initial setup
185182 await this . runWithReporting ( async ( ) => {
186- await this . updateSettingsInternal ( this . options . watchOptions , abortController . signal ) ;
183+ await this . updateSettingsInternal ( this . options . watchOptions , signal ) ;
187184 } ) ;
188185 }
189186
0 commit comments