Skip to content

Commit 096542a

Browse files
authored
Firestore: local_serializer.ts: change toDbIndexState() argument from user:User to uid:string (#7909)
1 parent 97fabd4 commit 096542a

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

packages/firestore/src/local/indexeddb_index_manager.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class IndexedDbIndexManager implements IndexManager {
120120
*/
121121
private collectionParentsCache = new MemoryCollectionParentIndex();
122122

123-
private uid: string;
123+
private readonly uid: string;
124124

125125
/**
126126
* Maps from a target to its equivalent list of sub-targets. Each sub-target
@@ -131,7 +131,7 @@ export class IndexedDbIndexManager implements IndexManager {
131131
(l, r) => targetEquals(l, r)
132132
);
133133

134-
constructor(private user: User, private readonly databaseId: DatabaseId) {
134+
constructor(user: User, private readonly databaseId: DatabaseId) {
135135
this.uid = user.uid || '';
136136
}
137137

@@ -210,7 +210,7 @@ export class IndexedDbIndexManager implements IndexManager {
210210
states.put(
211211
toDbIndexState(
212212
indexId,
213-
this.user,
213+
this.uid,
214214
index.indexState.sequenceNumber,
215215
index.indexState.offset
216216
)
@@ -754,7 +754,7 @@ export class IndexedDbIndexManager implements IndexManager {
754754
states.put(
755755
toDbIndexState(
756756
config.indexId!,
757-
this.user,
757+
this.uid,
758758
nextSequenceNumber,
759759
offset
760760
)

packages/firestore/src/local/local_serializer.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717

1818
import { Timestamp } from '../api/timestamp';
19-
import { User } from '../auth/user';
2019
import { BundleMetadata, NamedQuery } from '../core/bundle';
2120
import { LimitType, Query, queryWithLimit } from '../core/query';
2221
import { SnapshotVersion } from '../core/snapshot_version';
@@ -476,13 +475,13 @@ export function fromDbIndexConfiguration(
476475

477476
export function toDbIndexState(
478477
indexId: number,
479-
user: User,
478+
uid: string,
480479
sequenceNumber: number,
481480
offset: IndexOffset
482481
): DbIndexState {
483482
return {
484483
indexId,
485-
uid: user.uid || '',
484+
uid,
486485
sequenceNumber,
487486
readTime: toDbTimestamp(offset.readTime),
488487
documentKey: encodeResourcePath(offset.documentKey.path),

packages/firestore/test/unit/local/local_serializer.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import { expect } from 'chai';
1919

20-
import { User } from '../../../src/auth/user';
2120
import { DatabaseId } from '../../../src/core/database_info';
2221
import { encodeResourcePath } from '../../../src/local/encoded_resource_path';
2322
import { DbMutationBatch } from '../../../src/local/indexeddb_schema';
@@ -258,7 +257,7 @@ describe('Local Serializer', () => {
258257

259258
const dbIndexState = toDbIndexState(
260259
/* indexId= */ 1,
261-
User.UNAUTHENTICATED,
260+
/* uid= */ '',
262261
/* sequenceNumber= */ 2,
263262
expected
264263
);

0 commit comments

Comments
 (0)