Skip to content

Commit

Permalink
Catch possible Safari error (#7890)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsubox76 authored Jan 3, 2024
1 parent 096542a commit 16728cf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/good-seals-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/app': patch
---

Catch possible error in Safari browsers.
9 changes: 8 additions & 1 deletion packages/app/src/indexeddb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ function getDbPromise(): Promise<IDBPDatabase<AppDB>> {
// eslint-disable-next-line default-case
switch (oldVersion) {
case 0:
db.createObjectStore(STORE_NAME);
try {
db.createObjectStore(STORE_NAME);
} catch (e) {
// Safari/iOS browsers throw occasional exceptions on
// db.createObjectStore() that may be a bug. Avoid blocking
// the rest of the app functionality.
console.warn(e);
}
}
}
}).catch(e => {
Expand Down

0 comments on commit 16728cf

Please sign in to comment.