prescottprue / react-redux-firebase

Redux bindings for Firebase. Includes React Hooks and Higher Order Components.
https://react-redux-firebase.com
MIT License
2.55k stars 559 forks source link

Offline app startup fails to SET_PROFILE, stops at LOGIN action #933

Open anujmv opened 4 years ago

anujmv commented 4 years ago

I have enabled firestore offline persistence. Offline startup fails to SET_PROFILE, Even with redux persist, since the LOGIN action clears the firebaseReducer.profile

log:-

reactReduxFirebase/AUTHENTICATION_INIT_STARTED reactReduxFirebase/AUTHENTICATION_INIT_FINISHED

reactReduxFirebase/LOGIN 2020-05-11T22:58:13.199Z] @firebase/firestore: Firestore (7.14.3): Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error: FirebaseError: [code=unavailable]: The operation could not be completed This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.

firebaseReducer.auth gets loaded from local cache, but SET_PROFILE never gets executed.

anujmv commented 4 years ago

Adding on to issue, was able to load profile using

const rrfConfig = { preserveOnLogin: { auth: true, profile: true }, ...config }

How ever the isEmpty on profile changes to true on LOGIN action, and remains there even though profile is loaded via persistence. profile:{ ...restOfProfile, isEmpty: true, isLoaded: true }

Is there a way to run SET_PROFILE action in offline mode.

prescottprue commented 4 years ago

I have not experimented with the profile in offline mode, thanks for reporting

alexstanbury commented 3 years ago

I'm running into this same problem, @anujmv did you manage to work around it?