Search code examples
google-cloud-firestoreoffline-caching

How to check if any local Firestore document has pending writes


I am using Firestore in the browser with offline mode.

How can I check, if there are any updates applied on my client but not yet transacted on the server?

I would like to check this, without knowing the specific documents. I want to know if there are such updates to ANY documents.


Solution

  • Call waitForPendingUpdates() and wait for the resulting promise.

    https://firebase.google.com/docs/reference/js/firestore_.md#waitforpendingwrites_231a8e0