Witek
Witek

Reputation: 6472

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.

Upvotes: 1

Views: 66

Answers (2)

Witek
Witek

Reputation: 6472

Call waitForPendingUpdates() and wait for the resulting promise.

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

Upvotes: 0

Doug Stevenson
Doug Stevenson

Reputation: 317758

None of the Firestore SDKs on any platform offer an API for this. If this is something you require, you'll have to build your own application component that somehow keeps track of all writes to completion and persists that between app launches.

You're not the first person to ask this, and it's worth writing a feature request for this publicly or privately.

Upvotes: 2

Related Questions