-
Notifications
You must be signed in to change notification settings - Fork 874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enablePersistence
doesn't work when the app starts offline
#3905
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
I might be misunderstanding, but are you enabling persistence in Firestore and then expecting it to enable persistence for Realtime Database? They are two separate products. If you want to use Firestore's offline persistence I believe you want to be querying Firestore ( Sorry if I'm misunderstanding what you're trying to do! |
Apparently I was the one who misunderstanding. I didn't notice that this doc is under |
If someone is interested, I implemented a partially offline support for firebase. When the user online, each snapshot ( As I said, it's only partially implemented but it can gives an idea and the basic for further work. moshfeu/synced-shopping-list@7124fb8#diff-b13a37881b4b22091b672007c3d25647 |
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
Steps to reproduce:
firebase.firestore().enablePersistence();
after the app initilization.app.database().goOffline();
(just to demonstrate offline mode. I also tested it without this line and without internet).db.ref().on( 'value', (snapshot) => { console.log(snapshot) })
The
cosnole.log
never fired.If the app starts in online and then go offline, it works well.
A note: If I understand correctly,
firebase.firestore().enablePersistence();
makes firebase storing a local version of the data but I couldn't find it anywhere (localStorage, cache, indexedb)(Followed this doc: https://firebase.google.com/docs/firestore/manage-data/enable-offline#configure_offline_persistence)
Relevant Code:
https://codesandbox.io/s/charming-haslett-hfu7l?file=/src/App.js
The text was updated successfully, but these errors were encountered: