File tree 3 files changed +16
-13
lines changed
packages/firestore/src/core
3 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ import { _FirebaseService } from '@firebase/app-types-exp';
11
11
import { LogLevelString as LogLevel } from ' @firebase/logger' ;
12
12
import { Provider } from ' @firebase/component' ;
13
13
import { SetOptions as SetOptions_2 } from ' @firebase/firestore-types' ;
14
- import { SnapshotMetadata as SnapshotMetadata_2 } from ' @firebase/firestore-types' ;
15
14
16
15
// @public
17
16
export function addDoc<T >(reference : CollectionReference <T >, data : T ): Promise <DocumentReference <T >>;
@@ -440,11 +439,11 @@ export interface SnapshotListenOptions {
440
439
}
441
440
442
441
// @public
443
- export class SnapshotMetadata implements SnapshotMetadata_2 {
442
+ export class SnapshotMetadata {
444
443
constructor (hasPendingWrites : boolean , fromCache : boolean );
445
444
readonly fromCache: boolean ;
446
445
readonly hasPendingWrites: boolean ;
447
- isEqual(other : SnapshotMetadata_2 ): boolean ;
446
+ isEqual(other : SnapshotMetadata ): boolean ;
448
447
}
449
448
450
449
// @public
Original file line number Diff line number Diff line change @@ -168,8 +168,10 @@ export abstract class FieldValue {
168
168
abstract _toFieldTransform(context : ParseContext ): FieldTransform | null ;
169
169
}
170
170
171
+ // Warning: (ae-forgotten-export) The symbol "FirestoreService" needs to be exported by the entry point index.d.ts
172
+ //
171
173
// @public
172
- export class FirebaseFirestore implements _FirebaseService {
174
+ export class FirebaseFirestore implements FirestoreService {
173
175
constructor (databaseIdOrApp : DatabaseId | FirebaseApp , authProvider : Provider <FirebaseAuthInternalName >);
174
176
get app(): FirebaseApp ;
175
177
// Warning: (ae-forgotten-export) The symbol "CredentialsProvider" needs to be exported by the entry point index.d.ts
Original file line number Diff line number Diff line change @@ -118,10 +118,8 @@ export class FirestoreClient {
118
118
) {
119
119
this . credentials . setChangeListener ( user => {
120
120
logDebug ( LOG_TAG , 'Received user=' , user . uid ) ;
121
- if ( ! this . user . isEqual ( user ) ) {
122
- this . user = user ;
123
- this . credentialListener ( user ) ;
124
- }
121
+ this . user = user ;
122
+ this . credentialListener ( user ) ;
125
123
this . receivedInitialUser . resolve ( ) ;
126
124
} ) ;
127
125
}
@@ -199,11 +197,15 @@ export async function setOfflineComponentProvider(
199
197
const configuration = await client . getConfiguration ( ) ;
200
198
await offlineComponentProvider . initialize ( configuration ) ;
201
199
202
- client . setCredentialChangeListener ( user =>
203
- client . asyncQueue . enqueueRetryable ( async ( ) => {
204
- await handleUserChange ( offlineComponentProvider . localStore , user ) ;
205
- } )
206
- ) ;
200
+ let currentUser = configuration . initialUser ;
201
+ client . setCredentialChangeListener ( user => {
202
+ if ( ! currentUser . isEqual ( user ) ) {
203
+ currentUser = user ;
204
+ client . asyncQueue . enqueueRetryable ( async ( ) => {
205
+ await handleUserChange ( offlineComponentProvider . localStore , user ) ;
206
+ } ) ;
207
+ }
208
+ } ) ;
207
209
208
210
// When a user calls clearPersistence() in one client, all other clients
209
211
// need to be terminated to allow the delete to succeed.
You can’t perform that action at this time.
0 commit comments