Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tiny-lobsters-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/auth': patch
---

Protection from enumerating an empty list in Auth's reading of IndexedDB results, as this causes errors in some macOS and iOS browser runtimes.
13 changes: 8 additions & 5 deletions packages/auth/src/platform_browser/persistence/indexed_db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,16 @@ class IndexedDBLocalPersistence implements InternalPersistence {

const keys = [];
const keysInResult = new Set();
for (const { fbase_key: key, value } of result) {
keysInResult.add(key);
if (JSON.stringify(this.localCache[key]) !== JSON.stringify(value)) {
this.notifyListeners(key, value as PersistenceValue);
keys.push(key);
if (result.length !== 0) {
for (const { fbase_key: key, value } of result) {
keysInResult.add(key);
if (JSON.stringify(this.localCache[key]) !== JSON.stringify(value)) {
this.notifyListeners(key, value as PersistenceValue);
keys.push(key);
}
}
}

for (const localKey of Object.keys(this.localCache)) {
if (this.localCache[localKey] && !keysInResult.has(localKey)) {
// Deleted
Expand Down