Skip to content

Commit f9d4208

Browse files
committed
Pass empty mask, not null when recalculation.
1 parent 93ba4a7 commit f9d4208

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/local/LocalDocumentsView.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ private void recalculateAndSaveOverlays(Map<DocumentKey, MutableDocument> docs)
203203
// along the way.
204204
for (MutationBatch batch : batches) {
205205
for (DocumentKey key : batch.getKeys()) {
206-
FieldMask mask = batch.applyToLocalView(docs.get(key), masks.get(key));
206+
FieldMask mask =
207+
masks.containsKey(key) ? masks.get(key) : FieldMask.fromSet(new HashSet<>());
208+
mask = batch.applyToLocalView(docs.get(key), mask);
207209
masks.put(key, mask);
208210
int batchId = batch.getBatchId();
209211
if (!documentsByBatchId.containsKey(batchId)) {

firebase-firestore/src/main/java/com/google/firebase/firestore/local/SQLiteSchema.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class SQLiteSchema {
7373
}
7474

7575
void runSchemaUpgrades() {
76-
runSchemaUpgrades(0, VERSION);
76+
runSchemaUpgrades(0);
7777
}
7878

7979
void runSchemaUpgrades(int fromVersion) {
@@ -657,7 +657,9 @@ private void createDataMigrationTable() {
657657
}
658658

659659
private void addPendingDataMigration(String migration) {
660-
db.execSQL("INSERT OR IGNORE INTO data_migrations (migration_name) VALUES (?)", new String[] {migration});
660+
db.execSQL(
661+
"INSERT OR IGNORE INTO data_migrations (migration_name) VALUES (?)",
662+
new String[] {migration});
661663
}
662664

663665
private boolean tableExists(String table) {

firebase-firestore/src/test/java/com/google/firebase/firestore/local/SQLiteOverlayMigrationManagerTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
@RunWith(RobolectricTestRunner.class)
4545
@Config(manifest = Config.NONE)
4646
public class SQLiteOverlayMigrationManagerTest {
47-
private static boolean overlayEnabled;
48-
4947
private Persistence persistence;
5048
private LocalStore localStore;
5149

0 commit comments

Comments
 (0)