Skip to content

Commit ee12bb1

Browse files
Fix CI
1 parent 39c571d commit ee12bb1

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

packages/firestore/src/core/component_provider.ts

+19-10
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,11 @@ export class IndexedDbOfflineComponentProvider extends MemoryOfflineComponentPro
185185

186186
// NOTE: This will immediately call the listener, so we make sure to
187187
// 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) {
195190
this.gcScheduler.start(this.localStore);
196-
} else if (!isPrimary) {
197-
this.gcScheduler.stop();
198-
}
199191
}
192+
return Promise.resolve();
200193
});
201194
}
202195

@@ -283,6 +276,22 @@ export class MultiTabOfflineComponentProvider extends IndexedDbOfflineComponentP
283276
};
284277
await this.sharedClientState.start();
285278
}
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+
});
286295
}
287296

288297
createSharedClientState(cfg: ComponentConfiguration): SharedClientState {

0 commit comments

Comments
 (0)