Skip to content

Commit 021a38c

Browse files
author
Michael Lehenbauer
authored
Remove unnecessary getMutationQueueMetadata() call. (#1863)
1 parent 76539be commit 021a38c

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

packages/firestore/src/local/indexeddb_mutation_queue.ts

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -244,27 +244,25 @@ export class IndexedDbMutationQueue implements MutationQueue {
244244
transaction: PersistenceTransaction,
245245
batchId: BatchId
246246
): PersistencePromise<MutationBatch | null> {
247-
return this.getMutationQueueMetadata(transaction).next(metadata => {
248-
const nextBatchId = batchId + 1;
249-
250-
const range = IDBKeyRange.lowerBound([this.userId, nextBatchId]);
251-
let foundBatch: MutationBatch | null = null;
252-
return mutationsStore(transaction)
253-
.iterate(
254-
{ index: DbMutationBatch.userMutationsIndex, range },
255-
(key, dbBatch, control) => {
256-
if (dbBatch.userId === this.userId) {
257-
assert(
258-
dbBatch.batchId >= nextBatchId,
259-
'Should have found mutation after ' + nextBatchId
260-
);
261-
foundBatch = this.serializer.fromDbMutationBatch(dbBatch);
262-
}
263-
control.done();
247+
const nextBatchId = batchId + 1;
248+
249+
const range = IDBKeyRange.lowerBound([this.userId, nextBatchId]);
250+
let foundBatch: MutationBatch | null = null;
251+
return mutationsStore(transaction)
252+
.iterate(
253+
{ index: DbMutationBatch.userMutationsIndex, range },
254+
(key, dbBatch, control) => {
255+
if (dbBatch.userId === this.userId) {
256+
assert(
257+
dbBatch.batchId >= nextBatchId,
258+
'Should have found mutation after ' + nextBatchId
259+
);
260+
foundBatch = this.serializer.fromDbMutationBatch(dbBatch);
264261
}
265-
)
266-
.next(() => foundBatch);
267-
});
262+
control.done();
263+
}
264+
)
265+
.next(() => foundBatch);
268266
}
269267

270268
getAllMutationBatches(

0 commit comments

Comments
 (0)