From d6255b900b3824cc1e5bdbfe519a808d1f6f3e52 Mon Sep 17 00:00:00 2001 From: Ehsan Nasiri Date: Wed, 12 Apr 2023 12:34:02 -0700 Subject: [PATCH] Allow aggregations to work with multi-tab. Fixes #7198. A proper long-term solution for multi-tab should be implemented. --- .../firestore/src/core/firestore_client.ts | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/packages/firestore/src/core/firestore_client.ts b/packages/firestore/src/core/firestore_client.ts index 2d69b322db7..11f05bf4b13 100644 --- a/packages/firestore/src/core/firestore_client.ts +++ b/packages/firestore/src/core/firestore_client.ts @@ -42,7 +42,6 @@ import { newSerializer } from '../platform/serializer'; import { newTextEncoder } from '../platform/text_serializer'; import { Datastore, invokeRunAggregationQueryRpc } from '../remote/datastore'; import { - canUseNetwork, RemoteStore, remoteStoreDisableNetwork, remoteStoreEnableNetwork, @@ -536,20 +535,11 @@ export function firestoreClientRunAggregateQuery( // to the implementation in firestoreClientGetDocumentsViaSnapshotListener // above try { - const remoteStore = await getRemoteStore(client); - if (!canUseNetwork(remoteStore)) { - deferred.reject( - new FirestoreError( - Code.UNAVAILABLE, - 'Failed to get aggregate result because the client is offline.' - ) - ); - } else { - const datastore = await getDatastore(client); - deferred.resolve( - invokeRunAggregationQueryRpc(datastore, query, aggregates) - ); - } + // TODO(b/277628384): check `canUseNetwork()` and handle multi-tab. + const datastore = await getDatastore(client); + deferred.resolve( + invokeRunAggregationQueryRpc(datastore, query, aggregates) + ); } catch (e) { deferred.reject(e as Error); }