Skip to content

Commit

Permalink
Firestore: local_serializer.ts: change toDbIndexState() argument from…
Browse files Browse the repository at this point in the history
… user:User to uid:string (#7909)
  • Loading branch information
dconeybe committed Jan 2, 2024
1 parent 97fabd4 commit 096542a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 4 additions & 4 deletions packages/firestore/src/local/indexeddb_index_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 || '';
}

Expand Down Expand Up @@ -210,7 +210,7 @@ export class IndexedDbIndexManager implements IndexManager {
states.put(
toDbIndexState(
indexId,
this.user,
this.uid,
index.indexState.sequenceNumber,
index.indexState.offset
)
Expand Down Expand Up @@ -754,7 +754,7 @@ export class IndexedDbIndexManager implements IndexManager {
states.put(
toDbIndexState(
config.indexId!,
this.user,
this.uid,
nextSequenceNumber,
offset
)
Expand Down
5 changes: 2 additions & 3 deletions packages/firestore/src/local/local_serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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),
Expand Down
3 changes: 1 addition & 2 deletions packages/firestore/test/unit/local/local_serializer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -258,7 +257,7 @@ describe('Local Serializer', () => {

const dbIndexState = toDbIndexState(
/* indexId= */ 1,
User.UNAUTHENTICATED,
/* uid= */ '',
/* sequenceNumber= */ 2,
expected
);
Expand Down

0 comments on commit 096542a

Please sign in to comment.