firebase / firebase-js-sdk

Firebase Javascript SDK
https://firebase.google.com/docs/web/setup
Other
4.82k stars 885 forks source link

FR: Realtime DB Web Offline Write Persistence and Read Caching #7442

Open HazzMan2409 opened 1 year ago

HazzMan2409 commented 1 year ago

Operating System

Any

Browser Version

Any

Firebase SDK Version

Any

Firebase SDK Product:

Database

Describe your project's tooling

N/A

Describe the problem

Every other client SDK (iOS, Android and Flutter) supports persisting data offline with the Realtime Database and so this statement in the documentation holds true.

However, the web with the JavaScript SDK has been left behind and swept under the rug:

I know the Realtime Database is not new and shiny like the FireStore but it should support these use cases and get parity with other SDKs so that the docs hold true.

Steps and code to reproduce issue

Run an onValue() offline or do a set() whilst offline after reloading your browser.

waseber commented 1 year ago

I'm experiencing the same issue: using persistentLocalCache on web, the indexedDB will store mutations on existing data items (update and delete)--if you close and reopen a browser it will sync with firestore. However addDoc or setDoc do not appear in the IndexedDB, thus after closing the browser/PWA while offline, the new data is lost.

rockwotj commented 1 week ago

dup of https://github.com/firebase/firebase-js-sdk/issues/17