File tree 3 files changed +6
-5
lines changed
3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,6 @@ export class IndexedDbDocumentOverlayCache implements DocumentOverlayCache {
147
147
) : PersistencePromise < Map < DocumentKey , Overlay > > {
148
148
const result = new Map < DocumentKey , Overlay > ( ) ;
149
149
let currentBatchId : number | undefined = undefined ;
150
- let currentCount = 0 ;
151
150
// We want batch IDs larger than `sinceBatchId`, and so the lower bound
152
151
// is not inclusive.
153
152
const range = IDBKeyRange . bound (
@@ -164,16 +163,15 @@ export class IndexedDbDocumentOverlayCache implements DocumentOverlayCache {
164
163
( _ , dbOverlay , control ) => {
165
164
// We do not want to return partial batch overlays, even if the size
166
165
// of the result set exceeds the given `count` argument. Therefore, we
167
- // continue to aggregate the results even after `currentCount` exceeds
166
+ // continue to aggregate results even after the result size exceeds
168
167
// `count` if there are more overlays from the `currentBatchId`.
169
168
const overlay = fromDbDocumentOverlay ( this . serializer , dbOverlay ) ;
170
169
if (
171
- currentCount < count ||
170
+ result . size < count ||
172
171
overlay . largestBatchId === currentBatchId
173
172
) {
174
173
result . set ( overlay . getKey ( ) , overlay ) ;
175
174
currentBatchId = overlay . largestBatchId ;
176
- ++ currentCount ;
177
175
} else {
178
176
control . done ( ) ;
179
177
}
Original file line number Diff line number Diff line change @@ -32,7 +32,6 @@ import { PersistenceTransaction } from './persistence_transaction';
32
32
export class MemoryDocumentOverlayCache implements DocumentOverlayCache {
33
33
// A map sorted by DocumentKey, whose value is a pair of the largest batch id
34
34
// for the overlay and the overlay itself.
35
-
36
35
private overlays = new SortedMap < DocumentKey , Overlay > (
37
36
DocumentKey . comparator
38
37
) ;
Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ export class DocumentKey {
53
53
54
54
/** Returns the collection group (i.e. the name of the parent collection) for this key. */
55
55
getCollectionGroup ( ) : string {
56
+ debugAssert (
57
+ ! this . path . isEmpty ( ) ,
58
+ 'Cannot get collection group for empty key'
59
+ ) ;
56
60
return this . path . get ( this . path . length - 2 ) ;
57
61
}
58
62
You can’t perform that action at this time.
0 commit comments