Skip to content

Commit 17d0f2b

Browse files
test brooken
1 parent f54ed81 commit 17d0f2b

File tree

3 files changed

+3
-49
lines changed

3 files changed

+3
-49
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/core/View.java

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -114,52 +114,6 @@ public <D extends MaybeDocument> DocumentChanges computeDocChanges(
114114
return computeDocChanges(docChanges, null);
115115
}
116116

117-
/**
118-
* Computes the initial set of document changes based on the provided documents.
119-
*
120-
* <p>Unlike `computeDocChanges`, documents with committed mutations don't raise
121-
* `hasPendingWrites`. This distinction allows us to only raise `hasPendingWrite` events for
122-
* documents that changed during the lifetime of the View.
123-
*
124-
* @param docs The docs to apply to this view.
125-
* @return A new set of docs, changes, and refill flag.
126-
*/
127-
public <D extends MaybeDocument> DocumentChanges computeInitialChanges(
128-
ImmutableSortedMap<DocumentKey, D> docs) {
129-
hardAssert(
130-
this.documentSet.isEmpty(), "computeInitialChanges() called when docs are already present");
131-
132-
DocumentViewChangeSet changeSet = new DocumentViewChangeSet();
133-
ImmutableSortedSet<DocumentKey> newMutatedKeys = this.mutatedKeys;
134-
DocumentSet newDocumentSet = this.documentSet;
135-
136-
for (Map.Entry<DocumentKey, ? extends MaybeDocument> entry : docs) {
137-
DocumentKey key = entry.getKey();
138-
MaybeDocument maybeDoc = entry.getValue();
139-
140-
if (maybeDoc instanceof Document) {
141-
Document doc = (Document) maybeDoc;
142-
if (this.query.matches(doc)) {
143-
changeSet.addChange(DocumentViewChange.create(Type.ADDED, doc));
144-
newDocumentSet = newDocumentSet.add(doc);
145-
if (doc.hasLocalMutations()) {
146-
newMutatedKeys = newMutatedKeys.insert(key);
147-
}
148-
}
149-
}
150-
}
151-
152-
if (this.query.hasLimit()) {
153-
for (long i = newDocumentSet.size() - this.query.getLimit(); i > 0; --i) {
154-
Document oldDoc = newDocumentSet.getLastDocument();
155-
newDocumentSet = newDocumentSet.remove(oldDoc.getKey());
156-
newMutatedKeys = newMutatedKeys.remove(oldDoc.getKey());
157-
changeSet.addChange(DocumentViewChange.create(Type.REMOVED, oldDoc));
158-
}
159-
}
160-
return new DocumentChanges(newDocumentSet, changeSet, newMutatedKeys, /*needsRefill=*/ false);
161-
}
162-
163117
/**
164118
* Iterates over a set of doc changes, applies the query limit, and computes what the new results
165119
* should be, what the changes were, and whether we may need to go back to the local cache for

firebase-firestore/src/test/java/com/google/firebase/firestore/core/ViewTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ public void testRaisesHasPendingWritesForPendingMutationsInInitialSnapshot() {
566566
Document doc1 = doc("rooms/eros/messages/1", 0, map(), Document.DocumentState.LOCAL_MUTATIONS);
567567
View view = new View(query, DocumentKey.emptyKeySet());
568568

569-
View.DocumentChanges changes = view.computeInitialChanges(docUpdates(doc1));
569+
View.DocumentChanges changes = view.computeDocChanges(docUpdates(doc1));
570570
ViewChange viewChange = view.applyChanges(changes);
571571

572572
assertTrue(viewChange.getSnapshot().hasPendingWrites());
@@ -579,7 +579,7 @@ public void testDoesntRaiseHasPendingWritesForCommittedMutationsInInitialSnapsho
579579
doc("rooms/eros/messages/1", 0, map(), Document.DocumentState.COMMITTED_MUTATIONS);
580580
View view = new View(query, DocumentKey.emptyKeySet());
581581

582-
View.DocumentChanges changes = view.computeInitialChanges(docUpdates(doc1));
582+
View.DocumentChanges changes = view.computeDocChanges(docUpdates(doc1));
583583
ViewChange viewChange = view.applyChanges(changes);
584584

585585
assertFalse(viewChange.getSnapshot().hasPendingWrites());

firebase-firestore/src/test/resources/json/write_spec_test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5115,7 +5115,7 @@
51155115
"describeName": "Writes:",
51165116
"itName": "Held writes are released when there are no queries left.",
51175117
"tags": [
5118-
"eager-gc"
5118+
"eager-gc", "exclusive"
51195119
],
51205120
"comment": "This test expects a new target id for a new listen, but without eager gc, the same target id is reused",
51215121
"config": {

0 commit comments

Comments
 (0)