Skip to content

Commit 9bcba07

Browse files
Remove preconditions
1 parent 0c18d31 commit 9bcba07

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

packages/firestore/src/model/mutation.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,10 @@ function applySetMutationToLocalView(
410410
document: MutableDocument,
411411
localWriteTime: Timestamp
412412
): void {
413-
if (!preconditionIsValidForDocument(mutation.precondition, document)) {
414-
return;
415-
}
413+
debugAssert(
414+
mutation.precondition.isNone,
415+
'SetMutations should not have preconditions outside of Transactions'
416+
);
416417

417418
const newData = mutation.value.clone();
418419
const transformResults = localTransformResults(
@@ -625,12 +626,14 @@ function applyDeleteMutationToLocalView(
625626
document.key.isEqual(mutation.key),
626627
'Can only apply mutation to document with same key'
627628
);
629+
debugAssert(
630+
mutation.precondition.isNone,
631+
'DeleteMutions should not have preconditions outside of Transactions'
632+
);
628633

629-
if (preconditionIsValidForDocument(mutation.precondition, document)) {
630-
// We don't call `setHasLocalMutations()` since we want to be backwards
631-
// compatible with the existing SDK behavior.
632-
document.convertToNoDocument(SnapshotVersion.min());
633-
}
634+
// We don't call `setHasLocalMutations()` since we want to be backwards
635+
// compatible with the existing SDK behavior.
636+
document.convertToNoDocument(SnapshotVersion.min());
634637
}
635638

636639
/**

packages/firestore/src/model/object_value.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export class ObjectValue {
185185
): { mapValue: ProtoMapValue } | null {
186186
let modified = false;
187187

188-
const existingValue = this.extractNestedValue(
188+
const existingValue = ObjectValue.extractNestedValue(
189189
this.partialValue,
190190
currentPath
191191
);

0 commit comments

Comments
 (0)