Skip to content

Collection snapshot queries with no documents don't store anything in cache. Always requires server snapshot. #5873

Closed
@burtonator

Description

@burtonator

[REQUIRED] Describe your environment

  • Operating System version: MacOS 12.1
  • Browser version: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
  • Firebase SDK version: 8.10.0
  • Firebase Product: firestore

[REQUIRED] Describe the problem

If a collection snapshot query doesn't have any documents, nothing is stored in the cache.

Each time we try to wait for an empty collection it has to wait for a server snapshot.

That should be a quick fix.

It's either not from cache or fromCache in the metadata is wrong.

Here's our code:

https://gist.github.com/burtonator/b9535237fd1c726960fb0fc77430160a

Maybe what's happening is that since no documents at ALL are found, the code assumes nothing is in the cache.

You should store a negative cache entry for that use case.

This is SUPER important for us because the latency is high when waiting for a server snapshot and this breaks our offline support.

Steps to reproduce:

Relevant Code:

Pseudocode is here:

https://gist.github.com/burtonator/b9535237fd1c726960fb0fc77430160a

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    close