Skip to content

Cache returning deleted objects #7697

@WillBishop

Description

@WillBishop

Operating System

macOS 14.0

Browser Version

Safari Version 17.0 (19616.1.27.211.1)

Firebase SDK Version

10.4.0

Firebase SDK Product:

Firestore

Describe your project's tooling

Vue app built with Vite

Describe the problem

I have an app on iOS I'm trying to port to the web. In order to minimise reads, the iOS app reads from the server where documents have a dateModified field greater than whatever time the last server snapshot was received. The rest of the documents are fetched from the cache. If a document is deleted, its ID is added to an array, and on launch the iOS app does a call to getDocument(id) to indicate to the cache that it no longer exists, and subsequent calls to cache do not include the deleted document.

Trying to replicate this on the web is proving difficult. getDocsFromCache is returning documents that have been deleted, even after a getDocFromServer(deleteDocumentID). Doing a really getDocs() successfully updates the cache the and deleted document is no longer included.

I'd like to find a way to remove a document from a cache, as I'd expect doing a getDoc (or deleteDoc which I also tried) would do, and as it does on iOS.

Steps and code to reproduce issue

To reproduce this issue, create a project which does the following.

Creates 5 documents and calls getDocsFromServer on the collection at least once.

Afterwards only using getDocsFromCache.

Delete one of the documents using deleteDoc(), and observe that the getDocsFromCache method still returns these documents.

I suspect it may be linked to #3838 but need confirmation

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: firestorenewA new issue that hasn't be categoirzed as question, bug or feature requestquestion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions