Skip to content

Commit 16728cf

Browse files
authored
Catch possible Safari error (#7890)
1 parent 096542a commit 16728cf

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.changeset/good-seals-promise.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/app': patch
3+
---
4+
5+
Catch possible error in Safari browsers.

packages/app/src/indexeddb.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,14 @@ function getDbPromise(): Promise<IDBPDatabase<AppDB>> {
4545
// eslint-disable-next-line default-case
4646
switch (oldVersion) {
4747
case 0:
48-
db.createObjectStore(STORE_NAME);
48+
try {
49+
db.createObjectStore(STORE_NAME);
50+
} catch (e) {
51+
// Safari/iOS browsers throw occasional exceptions on
52+
// db.createObjectStore() that may be a bug. Avoid blocking
53+
// the rest of the app functionality.
54+
console.warn(e);
55+
}
4956
}
5057
}
5158
}).catch(e => {

0 commit comments

Comments
 (0)