Skip to content

Commit 5bf87ae

Browse files
committed
[AUTOMATED]: Prettier Code Styling
1 parent 2de3301 commit 5bf87ae

File tree

4 files changed

+43
-29
lines changed

4 files changed

+43
-29
lines changed

packages/firestore/src/local/indexeddb_mutation_queue.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,10 @@ export class IndexedDbMutationQueue implements MutationQueue {
382382
.iterate({ range: keyRange }, (indexKey, _, control) => {
383383
const [userID, encodedPath, batchID] = indexKey;
384384
const path = EncodedResourcePath.decode(encodedPath);
385-
if (userID !== this.userId || Path.comparator(path, documentKeys.last().path) > 0) {
385+
if (
386+
userID !== this.userId ||
387+
Path.comparator(path, documentKeys.last().path) > 0
388+
) {
386389
control.done();
387390
return;
388391
}
@@ -392,7 +395,7 @@ export class IndexedDbMutationQueue implements MutationQueue {
392395
}
393396
uniqueBatchIDs = uniqueBatchIDs.add(batchID);
394397
})
395-
.next(() => this.lookupMutationBatches(transaction, uniqueBatchIDs));
398+
.next(() => this.lookupMutationBatches(transaction, uniqueBatchIDs));
396399
}
397400

398401
getAllMutationBatchesAffectingQuery(
@@ -451,7 +454,8 @@ export class IndexedDbMutationQueue implements MutationQueue {
451454

452455
private lookupMutationBatches(
453456
transaction: PersistenceTransaction,
454-
batchIDs: SortedSet<BatchId>) : PersistencePromise<MutationBatch[]> {
457+
batchIDs: SortedSet<BatchId>
458+
): PersistencePromise<MutationBatch[]> {
455459
const results: MutationBatch[] = [];
456460
const promises: Array<PersistencePromise<void>> = [];
457461
// TODO(rockwood): Implement this using iterate.

packages/firestore/src/local/local_documents_view.ts

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,12 @@ export class LocalDocumentsView {
6767
key: DocumentKey,
6868
inBatches: MutationBatch[]
6969
): PersistencePromise<MaybeDocument | null> {
70-
return this.remoteDocumentCache
71-
.getEntry(transaction, key)
72-
.next(doc => {
73-
for (const batch of inBatches) {
74-
doc = batch.applyToLocalView(key, doc);
75-
}
76-
return doc;
77-
});
70+
return this.remoteDocumentCache.getEntry(transaction, key).next(doc => {
71+
for (const batch of inBatches) {
72+
doc = batch.applyToLocalView(key, doc);
73+
}
74+
return doc;
75+
});
7876
}
7977

8078
/**
@@ -88,22 +86,28 @@ export class LocalDocumentsView {
8886
keys: DocumentKeySet
8987
): PersistencePromise<MaybeDocumentMap> {
9088
return this.mutationQueue
91-
.getAllMutationBatchesAffectingDocumentKeys(transaction, keys).next(batches => {
92-
const promises = [] as Array<PersistencePromise<void>>;
93-
let results = maybeDocumentMap();
94-
keys.forEach(key => {
95-
promises.push(
96-
this.getDocumentInBatches(transaction, key, batches).next(maybeDoc => {
97-
// TODO(http://b/32275378): Don't conflate missing / deleted.
98-
if (!maybeDoc) {
99-
maybeDoc = new NoDocument(key, SnapshotVersion.forDeletedDoc());
100-
}
101-
results = results.insert(key, maybeDoc);
102-
})
103-
);
89+
.getAllMutationBatchesAffectingDocumentKeys(transaction, keys)
90+
.next(batches => {
91+
const promises = [] as Array<PersistencePromise<void>>;
92+
let results = maybeDocumentMap();
93+
keys.forEach(key => {
94+
promises.push(
95+
this.getDocumentInBatches(transaction, key, batches).next(
96+
maybeDoc => {
97+
// TODO(http://b/32275378): Don't conflate missing / deleted.
98+
if (!maybeDoc) {
99+
maybeDoc = new NoDocument(
100+
key,
101+
SnapshotVersion.forDeletedDoc()
102+
);
103+
}
104+
results = results.insert(key, maybeDoc);
105+
}
106+
)
107+
);
108+
});
109+
return PersistencePromise.waitFor(promises).next(() => results);
104110
});
105-
return PersistencePromise.waitFor(promises).next(() => results);
106-
});
107111
}
108112

109113
/** Performs a query against the local view of all documents. */
@@ -161,7 +165,11 @@ export class LocalDocumentsView {
161165
}
162166

163167
const baseDoc = results.get(key);
164-
const mutatedDoc = mutation.applyToLocalView(baseDoc, baseDoc, batch.localWriteTime);
168+
const mutatedDoc = mutation.applyToLocalView(
169+
baseDoc,
170+
baseDoc,
171+
batch.localWriteTime
172+
);
165173
if (!mutatedDoc || mutatedDoc instanceof NoDocument) {
166174
results = results.remove(key);
167175
} else if (mutatedDoc instanceof Document) {

packages/firestore/src/local/memory_mutation_queue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ export class MemoryMutationQueue implements MutationQueue {
317317
return PersistencePromise.resolve(this.findMutationBatches(uniqueBatchIDs));
318318
}
319319

320-
private findMutationBatches(batchIDs: SortedSet<number>) : MutationBatch[] {
320+
private findMutationBatches(batchIDs: SortedSet<number>): MutationBatch[] {
321321
// Construct an array of matching batches, sorted by batchID to ensure that
322322
// multiple mutations affecting the same document key are applied in order.
323323
const result: MutationBatch[] = [];

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,9 @@ function genericMutationQueueTests(): void {
405405
}
406406
const expected = [batches[1], batches[2], batches[4]];
407407
const matches = await mutationQueue.getAllMutationBatchesAffectingDocumentKeys(
408-
documentKeySet().add(key('foo/bar')).add(key('foo/baz'))
408+
documentKeySet()
409+
.add(key('foo/bar'))
410+
.add(key('foo/baz'))
409411
);
410412
expect(matches.length).to.deep.equal(expected.length);
411413
expectEqualArrays(matches, expected);

0 commit comments

Comments
 (0)