简体   繁体   中英

Does the firestore bundle facility require persistent offline cache in the client to be enabled

To use a firestore bundle, does the client need to have persistence enabled for the offline cache. If persistence is enabled, does it mean that the offline cache and the bundle are retained when the app or browser is closed and don't have to be re-downloaded when the app or browser window starts up again.

According to the firebase website, for the web, offline persistence is supported only by chrome, safari and firefox. Is this information up to date - is it possible that Edge, Opera and Brave browsers support persistent cache.

For the web, if cache persistence isn't available, is it possible to cache the firestore bundle locally some other way?

If the app requests to ead a document from the local cache and it's not there, will the document be read from the cloud if the device is online?

When you enable disk persistence, your app writes the data locally to the device so your app can maintain state while offline, even if the user or operating system restarts the app.
By enabling persistence, any data that the Firebase Realtime Database client would sync while online persists to disk and is available offline , even when the user or operating system restarts the app. This means your app works as it would online by using the local data stored in the cache. Listener callbacks will continue to fire for local updates.
Check the section here for more information on Handling Transactions Offline
Even with persistence enabled, transactions are not persisted across app restarts. So you cannot rely on transactions done offline being committed to your Firebase Realtime Database. To provide the best user experience, your app should show that a transaction has not been saved into your Firebase Realtime Database yet, or make sure your app remembers them manually and executes them again after an app restart. As per the official documentation,Offline persistence is supported only in Android, Apple, and web apps.For the web version, offline persistence is supported only by the Chrome, Safari, and Firefox web browsers For the web, offline persistence is disabled by default. To enable persistence, call the enablePersistence method .
While.network access is disabled, all snapshot listeners and document requests retrieve results from the cache. Write operations are queued until.network access is re-enabled.

Also, check the following for similar implementations examples:

  1. Firebase Offline persistence Upfront Caching
  2. Firebase Offline possibilities
  3. What happens when an offline device goes online

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM