firebase / firebase/firebase-js-sdk

FR: add offline (IndexedDB) flag to queries

Open
#5,284 6 comments 0 reactions 1 assignee Claimed by @dconeybe View on GitHub
api: firestore feature request
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

As it is today, [offline data access](https://firebase.google.com/docs/firestore/manage-data/enable-offline) can only be enabled for all cases. Imagine a case with two user types:

* **Users** don't have access to sensitive information, and can enable IndexedDB right away.
* **Administrators** have access to sensitive information, and they need to confirm if they are on a trusted device before enabling offline access.

Now, assume that the ratio between Users and Administrators is 100x (which is common: there are way more Users than Administrators). This leaves with two options:

* **Ask every User and Administrator if they are on a trusted device**, which is unnecessary friction to Users (100x in ratio) and carries performance loss if they decide not to turn it on
* **Enable offline by default and present an opt-out to Administrators**, which is insecure by default (note: this does not seem possible with the current API, where offline access cannot be disabled)

**The Request**

It would be nice to have an `offline` flag associated to the query, assuming that sensitive information is not associated to the connection as a whole, but to the specific collections accessed in each part of the application.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.