React-native-firebase: Firestore offline persistence, fromCache is always false

Created on 15 Jan 2018  路  4Comments  路  Source: invertase/react-native-firebase

Issue

I already set my internet access to Airplane Mode, however the metada fromCache is always false.

ref.onSnapshot((qrySnapshot) => {
console.log(qrySnapshot.metadata);
});

android log
01-15 11:26:09.518 15260 6986 I ReactNativeJS: { hasPendingWrites: false, fromCache: false }

Environment

  1. Application Target Platform:
    Android
  2. Development Operating System:
    Windows 10
  3. Build Tools:
    React-native run-android
  4. React Native version:
    react-native-cli: 2.0.1
    react-native: 0.51.0
  5. RNFirebase Version:
    [email protected]
  6. Firebase Module:
    Firestore

Most helpful comment

Offline persistence doesn't seem to be working for firestore. If I turn off wifi, my data stops loading and I get Network Request Failed error. If I call firebase.firestore().enablePersistence() then I get Persistence is enabled by default on the Firestore SDKs

Offline persistence is working for authentication though. I just can't load any data from firestore that should already be cached.

All 4 comments

(Update)
It seems, the app just needed to be restarted for the onSnapshot to behave properly.

@eugenecp I am reading that the module does not support enablePersistence. So, it does support offline caching for firestore?

Offline persistence doesn't seem to be working for firestore. If I turn off wifi, my data stops loading and I get Network Request Failed error. If I call firebase.firestore().enablePersistence() then I get Persistence is enabled by default on the Firestore SDKs

Offline persistence is working for authentication though. I just can't load any data from firestore that should already be cached.

+1

Was this page helpful?
0 / 5 - 0 ratings