0
votes

The app I built performs some of the Firestore queries and updates in offline mode, even though connectivity is available. I've run firebase.firestore().settings({persistence: false})

When resetting the simulator to factory settings, on the first run, it does run queries in online mode, but then quickly falls back to offline.

Is there a possibility that due to some failed writes it automatically degrades to offline mode with no option to recover? Is there any way to check whether Firestore is currently online or offline? Is there any way to force queries to sync with the servers?

Using RNfirebase 4.0.6, Xcode 9.3, iOS 11.3, react-native 0.54. Also happens on iOS 10.3

1

1 Answers

0
votes

After approximately 20 hours of trying to fix this, I have found the cause.

When calling firebase.firestore().collection('someCollection').doc('docId').set(...), when docId points to a non-existing DocumentReference, RNfirebase internals shut the outgoing write queue. Reads are possible but not writes.

To fix the issue, all I had to do was to change:

firebase.firestore().collection('someCollection').doc('docId').set(someObject)

to

firebase.firestore().collection('someCollection').doc('docId').update(someObject, { merge: true })