@@ -80,7 +80,7 @@ export class IndexedDbMutationQueue implements MutationQueue {
80
80
// For the moment store these together in the same mutations table assuming
81
81
// that empty userIDs aren't allowed.
82
82
assert ( user . uid !== '' , 'UserID must not be an empty string.' ) ;
83
- const userId = user . isUnauthenticated ( ) ? '' : user . uid ! ;
83
+ const userId = user . isAuthenticated ( ) ? user . uid ! : '' ;
84
84
return new IndexedDbMutationQueue ( userId , serializer ) ;
85
85
}
86
86
@@ -222,7 +222,6 @@ export class IndexedDbMutationQueue implements MutationQueue {
222
222
. next ( ( ) => {
223
223
const promises : Array < PersistencePromise < void > > = [ ] ;
224
224
for ( const mutation of mutations ) {
225
- const encodedPath = EncodedResourcePath . encode ( mutation . key . path ) ;
226
225
const indexKey = DbDocumentMutation . key (
227
226
this . userId ,
228
227
mutation . key . path ,
@@ -379,7 +378,6 @@ export class IndexedDbMutationQueue implements MutationQueue {
379
378
this . userId ,
380
379
queryPath
381
380
) ;
382
- const encodedQueryPath = indexPrefix [ 1 ] ;
383
381
const indexStart = IDBKeyRange . lowerBound ( indexPrefix ) ;
384
382
385
383
// Collect up unique batchIDs encountered during a scan of the index. Use a
@@ -516,8 +514,8 @@ export class IndexedDbMutationQueue implements MutationQueue {
516
514
const startRange = IDBKeyRange . lowerBound ( indexKey ) ;
517
515
let containsKey = false ;
518
516
return documentMutationsStore ( txn )
519
- . iterate ( { range : startRange , keysOnly : true } , ( key , _ , control ) => {
520
- const [ userID , keyPath , batchID ] = key ;
517
+ . iterate ( { range : startRange , keysOnly : true } , ( key , value , control ) => {
518
+ const [ userID , keyPath , /* batchID*/ _ ] = key ;
521
519
if ( userID === this . userId && keyPath === encodedPath ) {
522
520
containsKey = true ;
523
521
}
0 commit comments