firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

Fix Firestore failing to return empty results from the local cache

Open dconeybe opened this issue 3 years ago • 2 comments

Fix a bug where Firestore fails to return results from the local cache if the result set was empty.

This bug is due to the following logic in event_manager.ts:

https://github.com/firebase/firebase-js-sdk/blob/4ddf5566ca52b1f9ef776dd647c7d514e3b3f9f5/packages/firestore/src/core/event_manager.ts#L374-L375 where it

which assumes that if the result set from the local cache is empty that there is no cached result; however, if the result set of the query is indeed empty then it should be returning that empty result set from the cache.

This fix improves the logic to use the presence of a resume token for the query to indicate that the empty result set is cached data and should be raised to the client.

Fixed #5873

dconeybe avatar Jan 17 '22 15:01 dconeybe

⚠️ No Changeset found

Latest commit: dfb45ad40205fcc0f616ce3d53b17792ffd489aa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Jan 17 '22 15:01 changeset-bot[bot]

Size Analysis Report 1

Affected Products

  • @firebase/firestore

    • enableMultiTabIndexedDbPersistence

      Size

      TypeBase (e35db6f)Merge (3ef2847)Diff
      size206 kB207 kB+349 B (+0.2%)
      size-with-ext-deps266 kB267 kB+349 B (+0.1%)
    • getDoc

      Size

      TypeBase (e35db6f)Merge (3ef2847)Diff
      size132 kB133 kB+362 B (+0.3%)
      size-with-ext-deps192 kB192 kB+362 B (+0.2%)
    • getDocFromServer

      Size

      TypeBase (e35db6f)Merge (3ef2847)Diff
      size132 kB133 kB+362 B (+0.3%)
      size-with-ext-deps192 kB192 kB+362 B (+0.2%)
    • getDocs

      Size

      TypeBase (e35db6f)Merge (3ef2847)Diff
      size134 kB134 kB+362 B (+0.3%)
      size-with-ext-deps193 kB194 kB+362 B (+0.2%)
    • getDocsFromCache

      Size

      TypeBase (e35db6f)Merge (3ef2847)Diff
      size96.3 kB96.6 kB+309 B (+0.3%)
      size-with-ext-deps155 kB156 kB+309 B (+0.2%)
    • getDocsFromServer

      Size

      TypeBase (e35db6f)Merge (3ef2847)Diff
      size134 kB134 kB+362 B (+0.3%)
      size-with-ext-deps193 kB194 kB+362 B (+0.2%)
    • onSnapshot

      Size

      TypeBase (e35db6f)Merge (3ef2847)Diff
      size134 kB135 kB+362 B (+0.3%)
      size-with-ext-deps194 kB194 kB+362 B (+0.2%)
    • onSnapshotsInSync

      Size

      TypeBase (e35db6f)Merge (3ef2847)Diff
      size124 kB124 kB+314 B (+0.3%)
      size-with-ext-deps183 kB184 kB+314 B (+0.2%)

Test Logs

google-oss-bot avatar Sep 19 '22 20:09 google-oss-bot

Closing since this PR was obsoleted by https://github.com/firebase/firebase-js-sdk/pull/6624

dconeybe avatar Oct 07 '22 19:10 dconeybe