@@ -185,18 +185,11 @@ export class IndexedDbOfflineComponentProvider extends MemoryOfflineComponentPro
185
185
186
186
// NOTE: This will immediately call the listener, so we make sure to
187
187
// set it after localStore / remoteStore are started.
188
- await this . persistence . setPrimaryStateListener ( async isPrimary => {
189
- await syncEngineApplyPrimaryState (
190
- this . onlineComponentProvider . syncEngine ,
191
- isPrimary
192
- ) ;
193
- if ( this . gcScheduler ) {
194
- if ( isPrimary && ! this . gcScheduler . started ) {
188
+ await this . persistence . setPrimaryStateListener ( ( ) => {
189
+ if ( this . gcScheduler && ! this . gcScheduler . started ) {
195
190
this . gcScheduler . start ( this . localStore ) ;
196
- } else if ( ! isPrimary ) {
197
- this . gcScheduler . stop ( ) ;
198
- }
199
191
}
192
+ return Promise . resolve ( ) ;
200
193
} ) ;
201
194
}
202
195
@@ -283,6 +276,22 @@ export class MultiTabOfflineComponentProvider extends IndexedDbOfflineComponentP
283
276
} ;
284
277
await this . sharedClientState . start ( ) ;
285
278
}
279
+
280
+ // NOTE: This will immediately call the listener, so we make sure to
281
+ // set it after localStore / remoteStore are started.
282
+ await this . persistence . setPrimaryStateListener ( async isPrimary => {
283
+ await syncEngineApplyPrimaryState (
284
+ this . onlineComponentProvider . syncEngine ,
285
+ isPrimary
286
+ ) ;
287
+ if ( this . gcScheduler ) {
288
+ if ( isPrimary && ! this . gcScheduler . started ) {
289
+ this . gcScheduler . start ( this . localStore ) ;
290
+ } else if ( ! isPrimary ) {
291
+ this . gcScheduler . stop ( ) ;
292
+ }
293
+ }
294
+ } ) ;
286
295
}
287
296
288
297
createSharedClientState ( cfg : ComponentConfiguration ) : SharedClientState {
0 commit comments