diff --git a/packages/firestore/src/local/indexeddb_index_manager.ts b/packages/firestore/src/local/indexeddb_index_manager.ts index 33da3faa41d..04a380601b3 100644 --- a/packages/firestore/src/local/indexeddb_index_manager.ts +++ b/packages/firestore/src/local/indexeddb_index_manager.ts @@ -120,7 +120,7 @@ export class IndexedDbIndexManager implements IndexManager { */ private collectionParentsCache = new MemoryCollectionParentIndex(); - private uid: string; + private readonly uid: string; /** * Maps from a target to its equivalent list of sub-targets. Each sub-target @@ -131,7 +131,7 @@ export class IndexedDbIndexManager implements IndexManager { (l, r) => targetEquals(l, r) ); - constructor(private user: User, private readonly databaseId: DatabaseId) { + constructor(user: User, private readonly databaseId: DatabaseId) { this.uid = user.uid || ''; } @@ -210,7 +210,7 @@ export class IndexedDbIndexManager implements IndexManager { states.put( toDbIndexState( indexId, - this.user, + this.uid, index.indexState.sequenceNumber, index.indexState.offset ) @@ -754,7 +754,7 @@ export class IndexedDbIndexManager implements IndexManager { states.put( toDbIndexState( config.indexId!, - this.user, + this.uid, nextSequenceNumber, offset ) diff --git a/packages/firestore/src/local/local_serializer.ts b/packages/firestore/src/local/local_serializer.ts index e31f57ed9f2..b8916608711 100644 --- a/packages/firestore/src/local/local_serializer.ts +++ b/packages/firestore/src/local/local_serializer.ts @@ -16,7 +16,6 @@ */ import { Timestamp } from '../api/timestamp'; -import { User } from '../auth/user'; import { BundleMetadata, NamedQuery } from '../core/bundle'; import { LimitType, Query, queryWithLimit } from '../core/query'; import { SnapshotVersion } from '../core/snapshot_version'; @@ -476,13 +475,13 @@ export function fromDbIndexConfiguration( export function toDbIndexState( indexId: number, - user: User, + uid: string, sequenceNumber: number, offset: IndexOffset ): DbIndexState { return { indexId, - uid: user.uid || '', + uid, sequenceNumber, readTime: toDbTimestamp(offset.readTime), documentKey: encodeResourcePath(offset.documentKey.path), diff --git a/packages/firestore/test/unit/local/local_serializer.test.ts b/packages/firestore/test/unit/local/local_serializer.test.ts index 8631ebc48ec..ecb8b8548be 100644 --- a/packages/firestore/test/unit/local/local_serializer.test.ts +++ b/packages/firestore/test/unit/local/local_serializer.test.ts @@ -17,7 +17,6 @@ import { expect } from 'chai'; -import { User } from '../../../src/auth/user'; import { DatabaseId } from '../../../src/core/database_info'; import { encodeResourcePath } from '../../../src/local/encoded_resource_path'; import { DbMutationBatch } from '../../../src/local/indexeddb_schema'; @@ -258,7 +257,7 @@ describe('Local Serializer', () => { const dbIndexState = toDbIndexState( /* indexId= */ 1, - User.UNAUTHENTICATED, + /* uid= */ '', /* sequenceNumber= */ 2, expected );