Skip to content

Web Worker support for persisting multiple tab #8438

Open
@u12206050

Description

@u12206050

Operating System

Windows & OSX

Browser Version

All

Firebase SDK Version

10.13.0

Firebase SDK Product:

Firestore

Describe your project's tooling

Vite, Vue, Web Worker

Describe the problem

We have a had massive success in regards to performance moving all the Firestore logic to a Web worker, however when we implemented it a year ago the only option for persistence was with persistentSingleTabManager and forceOwnership: true. A year on and one of the our most common issues are users opening our app in multiple tabs, and then saying things are not working as expected.

It seems currently due to the lack of support of Local Storage in web workers, I propose a simple adapter solution, whereby during the setup of persistentMultipleTabManager in the context of a web worker, developers can supply there own local storage adapter, that implements the same interface as the most common localStorage in modern browsers.

The adapter could then handle the messaging part/storage that Firestore requires in order to manage multiple tabs.

Steps and code to reproduce issue

Setup firestore in a Web worker, and use persistentMultipleTabManager

by default it attempts to use LocalStorage, but ideally can be supplied with an adapter for LocalStorage that could handle cross window messaging.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions