From 9890082c32403784217016e0002b023acf29e9fb Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 29 Jul 2020 12:12:48 -0700 Subject: [PATCH] Next bug fix --- packages/firestore/src/core/firestore_client.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/firestore/src/core/firestore_client.ts b/packages/firestore/src/core/firestore_client.ts index c542f46037f..9595b264018 100644 --- a/packages/firestore/src/core/firestore_client.ts +++ b/packages/firestore/src/core/firestore_client.ts @@ -195,9 +195,7 @@ export class FirestoreClient { }); // Block the async queue until initialization is done - this.asyncQueue.enqueueAndForget(() => { - return this.initializationDone.promise; - }); + this.asyncQueue.enqueueAndForget(() => this.initializationDone.promise); // Return only the result of enabling persistence. Note that this does not // need to await the completion of initializationDone because the result of @@ -409,8 +407,8 @@ export class FirestoreClient { docKey: DocumentKey ): Promise { this.verifyNotTerminated(); - await this.initializationDone; - return enqueueReadDocumentFromLocalCache( + await this.initializationDone.promise; + return enqueueReadDocumentFromCache( this.asyncQueue, this.localStore, docKey @@ -419,8 +417,8 @@ export class FirestoreClient { async getDocumentsFromLocalCache(query: Query): Promise { this.verifyNotTerminated(); - await this.initializationDone; - return enqueueExecuteQueryFromLocalCache( + await this.initializationDone.promise; + return enqueueExecuteQueryFromCache( this.asyncQueue, this.localStore, query @@ -540,7 +538,7 @@ export function enqueueSnapshotsInSyncListen( }; } -export async function enqueueReadDocumentFromLocalCache( +export async function enqueueReadDocumentFromCache( asyncQueue: AsyncQueue, localStore: LocalStore, docKey: DocumentKey @@ -575,7 +573,7 @@ export async function enqueueReadDocumentFromLocalCache( return deferred.promise; } -export async function enqueueExecuteQueryFromLocalCache( +export async function enqueueExecuteQueryFromCache( asyncQueue: AsyncQueue, localStore: LocalStore, query: Query