Skip to content Skip to sidebar Skip to footer

How Does Firestore Persistence Really Work?

I read this in the documentation: To use offline persistence, you don't need to make any changes to the code that you use to access Cloud Firestore data. With offline persistence

Solution 1:

Firebase does not automatically cache all data from your database on the device. Its disk persistence only stores data that the client is already requesting in its local database.

From the same documentation page you linked:

this feature caches a copy of the Cloud Firestore data that your app is actively using, so your app can access the data when the device is offline.

If you think about it, that makes sense: if Firebase would sync all data that your user can possibly see, it would have to synchronize potentially the entire database. That isn't reasonable on a mobile device.

If you want specific data to be available offline, make sure to attach an observe to that data while the device is still online.

Post a Comment for "How Does Firestore Persistence Really Work?"