Skip to content

Commit 9743538

Browse files
Remove Mutation overhead from Lite SDK
1 parent 982acf9 commit 9743538

File tree

10 files changed

+820
-903
lines changed

10 files changed

+820
-903
lines changed

packages/firestore/lite/test/dependencies.json

+37-207
Large diffs are not rendered by default.

packages/firestore/src/api/field_value.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class ServerTimestampFieldValueImpl extends SerializableFieldValue {
123123
}
124124

125125
_toFieldTransform(context: ParseContext): FieldTransform {
126-
return new FieldTransform(context.path!, ServerTimestampTransform.instance);
126+
return new FieldTransform(context.path!, new ServerTimestampTransform());
127127
}
128128

129129
isEqual(other: FieldValue): boolean {

packages/firestore/src/local/local_documents_view.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { ResourcePath } from '../model/path';
3535
import { debugAssert } from '../util/assert';
3636
import { IndexManager } from './index_manager';
3737
import { MutationQueue } from './mutation_queue';
38-
import { PatchMutation } from '../model/mutation';
38+
import { applyMutationToLocalView, PatchMutation } from '../model/mutation';
3939
import { PersistenceTransaction } from './persistence';
4040
import { PersistencePromise } from './persistence_promise';
4141
import { RemoteDocumentCache } from './remote_document_cache';
@@ -258,7 +258,8 @@ export class LocalDocumentsView {
258258
for (const mutation of batch.mutations) {
259259
const key = mutation.key;
260260
const baseDoc = results.get(key);
261-
const mutatedDoc = mutation.applyToLocalView(
261+
const mutatedDoc = applyMutationToLocalView(
262+
mutation,
262263
baseDoc,
263264
baseDoc,
264265
batch.localWriteTime

packages/firestore/src/local/local_store.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ import {
3030
} from '../model/collections';
3131
import { MaybeDocument, NoDocument } from '../model/document';
3232
import { DocumentKey } from '../model/document_key';
33-
import { Mutation, PatchMutation, Precondition } from '../model/mutation';
33+
import {
34+
Mutation,
35+
PatchMutation,
36+
Precondition,
37+
extractMutationBaseValue
38+
} from '../model/mutation';
3439
import {
3540
BATCHID_UNKNOWN,
3641
MutationBatch,
@@ -449,7 +454,8 @@ class LocalStoreImpl implements LocalStore {
449454
const baseMutations: Mutation[] = [];
450455

451456
for (const mutation of mutations) {
452-
const baseValue = mutation.extractBaseValue(
457+
const baseValue = extractMutationBaseValue(
458+
mutation,
453459
existingDocs.get(mutation.key)
454460
);
455461
if (baseValue != null) {

0 commit comments

Comments
 (0)