Skip to content

Commit b24acca

Browse files
committed
resolve comments
1 parent 32edd5b commit b24acca

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

firebase-firestore/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Unreleased
2+
Fix Firestore failing to raise initial snapshot from empty local cache result.
23

34
# 24.4.0
45
* [unchanged] Updated to accommodate the release of the updated

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ private ViewSnapshot initializeViewAndComputeSnapshot(
226226
Query mirrorQuery = this.queriesByTarget.get(targetId).get(0);
227227
currentTargetSyncState = this.queryViewsByQuery.get(mirrorQuery).getView().getSyncState();
228228
}
229-
;
230229
synthesizedCurrentChange =
231230
TargetChange.createSynthesizedTargetChangeForCurrentChange(
232231
currentTargetSyncState == SyncState.SYNCED, resumeToken);

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,11 @@ public ViewChange applyChanges(DocumentChanges docChanges, TargetChange targetCh
300300
boolean syncStatedChanged = newSyncState != syncState;
301301
syncState = newSyncState;
302302
ViewSnapshot snapshot = null;
303+
303304
if (viewChanges.size() != 0 || syncStatedChanged) {
304305
boolean fromCache = newSyncState == SyncState.LOCAL;
306+
boolean hasCachedResults =
307+
targetChange == null ? false : !targetChange.getResumeToken().isEmpty();
305308
snapshot =
306309
new ViewSnapshot(
307310
query,
@@ -312,9 +315,7 @@ public ViewChange applyChanges(DocumentChanges docChanges, TargetChange targetCh
312315
docChanges.mutatedKeys,
313316
syncStatedChanged,
314317
/* excludesMetadataChanges= */ false,
315-
/* hasCachedResults= */ targetChange == null
316-
? false
317-
: !targetChange.getResumeToken().isEmpty());
318+
hasCachedResults);
318319
}
319320
return new ViewChange(snapshot, limboDocumentChanges);
320321
}

0 commit comments

Comments
 (0)