Skip to content

Commit 4f728b0

Browse files
committed
Port Android PR #3691.
1 parent c5a1793 commit 4f728b0

File tree

2 files changed

+30
-12
lines changed

2 files changed

+30
-12
lines changed

packages/firestore/src/local/local_documents_view.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class LocalDocumentsView {
9494
mutationApplyToLocalView(
9595
overlay.mutation,
9696
document,
97-
null,
97+
FieldMask.empty(),
9898
Timestamp.now()
9999
);
100100
}
@@ -232,7 +232,12 @@ export class LocalDocumentsView {
232232
recalculateDocuments = recalculateDocuments.insert(doc.key, doc);
233233
} else if (overlay !== undefined) {
234234
mutatedFields.set(doc.key, overlay.mutation.getFieldMask());
235-
mutationApplyToLocalView(overlay.mutation, doc, null, Timestamp.now());
235+
mutationApplyToLocalView(
236+
overlay.mutation,
237+
doc,
238+
overlay.mutation.getFieldMask(),
239+
Timestamp.now()
240+
);
236241
}
237242
});
238243

@@ -453,7 +458,7 @@ export class LocalDocumentsView {
453458
mutationApplyToLocalView(
454459
overlay.mutation,
455460
document,
456-
null,
461+
FieldMask.empty(),
457462
Timestamp.now()
458463
);
459464
}

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

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,12 +1425,14 @@ function genericLocalStoreTests(
14251425
)
14261426
)
14271427
.toReturnChanged(doc('foo/bar', 1, { sum: 0, arrayUnion: [] }))
1428-
.afterMutations([
1429-
patchMutation('foo/bar', { sum: increment(1) }),
1430-
patchMutation('foo/bar', {
1431-
arrayUnion: arrayUnion('foo')
1432-
})
1433-
])
1428+
.after(patchMutation('foo/bar', { sum: increment(1) }))
1429+
.toReturnChanged(
1430+
doc('foo/bar', 1, {
1431+
sum: 1,
1432+
arrayUnion: []
1433+
}).setHasLocalMutations()
1434+
)
1435+
.after(patchMutation('foo/bar', { arrayUnion: arrayUnion('foo') }))
14341436
.toReturnChanged(
14351437
doc('foo/bar', 1, {
14361438
sum: 1,
@@ -1454,8 +1456,19 @@ function genericLocalStoreTests(
14541456
)
14551457
.afterAcknowledgingMutation({
14561458
documentVersion: 3,
1459+
transformResults: [{ integerValue: 1338 }]
1460+
})
1461+
.toReturnChanged(
1462+
doc('foo/bar', 3, {
1463+
sum: 1338,
1464+
arrayUnion: ['bar', 'foo']
1465+
})
1466+
.setReadTime(SnapshotVersion.fromTimestamp(new Timestamp(0, 3000)))
1467+
.setHasLocalMutations()
1468+
)
1469+
.afterAcknowledgingMutation({
1470+
documentVersion: 4,
14571471
transformResults: [
1458-
{ integerValue: 1338 },
14591472
{
14601473
arrayValue: {
14611474
values: [{ stringValue: 'bar' }, { stringValue: 'foo' }]
@@ -1464,11 +1477,11 @@ function genericLocalStoreTests(
14641477
]
14651478
})
14661479
.toReturnChanged(
1467-
doc('foo/bar', 3, {
1480+
doc('foo/bar', 4, {
14681481
sum: 1338,
14691482
arrayUnion: ['bar', 'foo']
14701483
})
1471-
.setReadTime(SnapshotVersion.fromTimestamp(new Timestamp(0, 3000)))
1484+
.setReadTime(SnapshotVersion.fromTimestamp(new Timestamp(0, 4000)))
14721485
.setHasCommittedMutations()
14731486
)
14741487
.finish()

0 commit comments

Comments
 (0)