firebase / firebase/firebase-js-sdk

FR: Realtime DB Web Offline Write Persistence and Read Caching

Open
#7,442 2 comments 1 reaction 0 assignees View on GitHub
api: database feature request needs-attention question
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### 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](https://firebase.google.com/docs/database#:~:text=Firebase%20apps%20remain%20responsive%20even%20when%20offline%20because%20the%20Firebase%20Realtime%20Database%20SDK%20persists%20your%20data%20to%20disk.) in the documentation holds true.

However, the web with the JavaScript SDK has been left behind and swept under the rug:
- it only supports persisting writes offline by keeping them stored in memory. If the process is closed or the browser reloads everything is gone.
- reads are not cached at all, not in memory nor on disk. If you go offline, an onValue() that has been invoked before will not run. If you start offline, it's the same result.

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.

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by reproducing the two reported cases in the web Realtime Database SDK: an offline onValue() after reload or while starting offline, and an offline set() followed by reload. Done means web clients persist offline writes and cache reads across reloads with behavior comparable to the other SDKs.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.