Skip to content

Conversation

paultranvan
Copy link
Contributor

We rely on the indexedDb.databases() method to iterate over all local
db to be removed, at login time. We also do it later, in the
SharedWorkerProvider as a fallback.
However, this does not work for old browsers that do not support this
function.
Therefore, we now store the db names locally in PouchLink, and rely on
it to remove the databases.

We know store Pouch db names in indexeddb. This is useful for cleanup,
for browsers not supporting the `indexeddb.databases()` function.
We rely on the `indexedDb.databases()` method to iterate over all local
db to be removed, at login time. We also do it later, in the
`SharedWorkerProvider` as a fallback.
However, this does not work for old browsers that do not support this
function.
Therefore, we now store the db names locally in PouchLink, and rely on
it to remove the databases.
if (db.name) {
window.indexedDB.deleteDatabase(db.name)
log.info('Deleted indexedDB database : ', db.name)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no fallback for old browser?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hesitated but thought it's not worth the effort:

  • it's a fallback that should be rarely useful
  • our workaround is not perfect
  • old browsers are not safe either way

@paultranvan paultranvan merged commit 6ac0676 into main Oct 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants