Skip to content

[Firestore] getDocumentsWithCompletion does not pull from cache when app is in offline mode.  #485

@lukegeiger

Description

@lukegeiger
  • Xcode version: any
  • Firebase SDK version: n/a
  • Firebase Component: firestore
  • Component version:any

[REQUIRED] Step 3: Describe the problem

getDocumentsWithCompletion does not pull from cache when app is in offline mode.

Steps to reproduce:

  1. Query a list of data offline (or online) (ex: fetch a list of teams)
  2. call updateData on any object from that list you fetched offline. (ex: change the name of a team)
  3. Again query data while offline. The fetched data will not be updated with any change stated in point

I have been able to sort of work around this by instead of calling getDocumentsWithCompletion I am calling addSnapshotListenerWithOptions on a query and I am then getting a updated value when I re query again offline, however if I relaunch the app any updates I made to any object are again gone.

I really don't want to use any snapshots in my application, I never have a time where I need a constant connection on something and I never want to manage the listeners on a snapshot. My desired use case is to just pull from my database once, either from web while having an internet connection, or from the cache while offline, without having to juggle listeners. Is this possible?

In short, how does one update an object while in offline mode and see those changes persist?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions